Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/rbcs/RBCS_FIELDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ C--- RBCS 3-D Fields:
_RL RBCsalt(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
COMMON /RBCS_MASKS_TR/
& RBC_mask
_RL rbcsTempGlobMin(Nr)
COMMON /RBCS_FIELDS_TS/
& RBCtemp,
& RBCsalt
& RBCsalt,
& rbcsTempGlobMin

#ifdef ALLOW_PTRACERS
_RL RBC_ptracers(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy,
Expand Down
9 changes: 8 additions & 1 deletion pkg/rbcs/RBCS_PARAMS.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ C deltaTrbcs :: time step used to compute iteration numbers for singleTimeFi
C rbcsIter0 :: singleTimeFile iteration number corresponding to rbcsForcingOffset
C rbcsVanishingTime :: when rbcsVanishingTime .NE. 0. the relaxation strength reduces
C :: linearly to vanish at myTime .EQ. rbcsVanishingTime
C rbcsTempHalfWindow :: half-width (s) of the daily assimilation window centred on
C :: midnight; temperature relaxation is applied only when
C :: MIN(timeOfDay, 86400-timeOfDay) <= rbcsTempHalfWindow.
C :: Set <= 0 (default) to disable and always assimilate.
C :: For a window from 22h to 02h set it to 7200.
C
_RL tauRelaxU
_RL tauRelaxV
Expand All @@ -29,6 +34,7 @@ C
_RL rbcsForcingOffset
_RL deltaTrbcs
_RL rbcsVanishingTime
_RL rbcsTempHalfWindow
INTEGER rbcsIter0
LOGICAL rbcsSingleTimeFiles
LOGICAL useRBCuVel
Expand All @@ -52,7 +58,8 @@ C
& rbcsForcingCycle,
& rbcsForcingOffset,
& rbcsVanishingTime,
& deltaTrbcs
& deltaTrbcs,
& rbcsTempHalfWindow
COMMON /RBCS_PARM01_I/
& rbcsIter0
COMMON /RBCS_PARM01_L/
Expand Down
42 changes: 35 additions & 7 deletions pkg/rbcs/rbcs_add_tendency.F
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ SUBROUTINE RBCS_ADD_TENDENCY(
INTEGER irbc
_RL rbcsVanishingFac
_RL rec_tauRlx
_RL timeOfDay

C CHARACTER*(MAX_LEN_MBUF) msgBuf
#ifdef ALLOW_PTRACERS
INTEGER iTracer
#endif
Expand Down Expand Up @@ -85,17 +88,42 @@ SUBROUTINE RBCS_ADD_TENDENCY(
ENDIF
#endif /* DISABLE_RBCS_MOM */

C Added two conditions to assimilate temperature:
C 1. The global minimum of temperature on the plane k
C must be greater than -5
C 2. timeOfDay must be within rbcsTempHalfWindow, i.e.
C a time window centered at time 00h for each day.
IF ( tracerNum.EQ.1 .AND. useRBCtemp ) THEN
irbc = MIN(maskLEN,tracerNum)
rec_tauRlx = rbcsVanishingFac/tauRelaxT
DO j=0,sNy+1
DO i=0,sNx+1
gTendency(i,j) = gTendency(i,j)
& - RBC_mask(i,j,k,bi,bj,irbc)*rec_tauRlx
& *( theta(i,j,k,bi,bj)- RBCtemp(i,j,k,bi,bj) )

timeOfDay = MOD( myTime, 86400. _d 0 )
C _BEGIN_MASTER( myThid )
C WRITE(msgBuf,'(A,E16.9,E16.9)') 'timeOfDay, myTime: ',
C & timeOfDay, myTime
C CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
C & SQUEEZE_RIGHT, myThid )
C WRITE(msgBuf,'(A,I,E16.9)') 'k, rbcsTempGlobMin(k): ',
C & k , rbcsTempGlobMin(k)
C CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
C & SQUEEZE_RIGHT, myThid )
C _END_MASTER( myThid )
IF ( rbcsTempGlobMin(k) .GE. -5. _d 0 .AND.
& ( rbcsTempHalfWindow .LE. 0. _d 0 .OR.
& MIN( timeOfDay, 86400. _d 0 - timeOfDay )
& .LE. rbcsTempHalfWindow ) ) THEN
C _BEGIN_MASTER( myThid )
C WRITE(msgBuf,'(2A,E16.9)') 'Assimilating temperature'
C CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
C & SQUEEZE_RIGHT, myThid )
C _END_MASTER( myThid )
DO j=0,sNy+1
DO i=0,sNx+1
gTendency(i,j) = gTendency(i,j)
& - RBC_mask(i,j,k,bi,bj,irbc)*rec_tauRlx
& *( theta(i,j,k,bi,bj)- RBCtemp(i,j,k,bi,bj) )
ENDDO
ENDDO
ENDDO
ENDIF
ENDIF

IF ( tracerNum.EQ.2 .AND. useRBCsalt ) THEN
Expand Down
17 changes: 17 additions & 0 deletions pkg/rbcs/rbcs_fields_load.F
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SUBROUTINE RBCS_FIELDS_LOAD( myTime, myIter, myThid )
#include "RBCS_SIZE.h"
#include "RBCS_PARAMS.h"
#include "RBCS_FIELDS.h"
#include "GLOBAL_MAX.h"

C !INPUT/OUTPUT PARAMETERS:
C === Routine arguments ===
Expand All @@ -50,6 +51,7 @@ SUBROUTINE RBCS_FIELDS_LOAD( myTime, myIter, myThid )
C aWght, bWght :: Interpolation weights

INTEGER bi, bj, i, j, k
_RL localMinK
INTEGER intimeP, intime0, intime1
_RL aWght, bWght, locTime
INTEGER Ifprd
Expand Down Expand Up @@ -276,6 +278,21 @@ SUBROUTINE RBCS_FIELDS_LOAD( myTime, myIter, myThid )
ENDIF
#endif /* ALLOW_PTRACERS */

IF ( useRBCtemp ) THEN
DO k=1,Nr
localMinK = 1. _d 10
DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
localMinK = MIN( localMinK,
& MINVAL( RBCtemp(0:sNx+1,0:sNy+1,k,bi,bj) ) )
ENDDO
ENDDO
localMinK = -localMinK
CALL GLOBAL_MAX_R8( localMinK, myThid )
rbcsTempGlobMin(k) = -localMinK
ENDDO
ENDIF

CALL TIMER_STOP ('RBCS_FIELDS_LOAD [I/O]', myThid)

#endif /* ALLOW_RBCS */
Expand Down
6 changes: 6 additions & 0 deletions pkg/rbcs/rbcs_init_varia.F
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ SUBROUTINE RBCS_INIT_VARIA( myThid )
INTEGER iTracer
#endif

_BEGIN_MASTER( myThid )
DO k=1,Nr
rbcsTempGlobMin(k) = 1. _d 10
ENDDO
_END_MASTER( myThid )

DO bj = myByLo(myThid), myByHi(myThid)
DO bi = myBxLo(myThid), myBxHi(myThid)
rbcsLdRec(bi,bj) = 0
Expand Down
4 changes: 3 additions & 1 deletion pkg/rbcs/rbcs_readparms.F
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ SUBROUTINE RBCS_READPARMS( myThid )
& rbcsVanishingTime,
& rbcsSingleTimeFiles,
& deltaTrbcs,
& rbcsIter0
& rbcsIter0,
& rbcsTempHalfWindow

#ifdef ALLOW_PTRACERS
NAMELIST /RBCS_PARM02/
Expand Down Expand Up @@ -120,6 +121,7 @@ SUBROUTINE RBCS_READPARMS( myThid )
rbcsForcingCycle = 0. _d 0
rbcsForcingOffset = 0. _d 0
rbcsVanishingTime = 0. _d 0
rbcsTempHalfWindow = -1. _d 0
rbcsSingleTimeFiles = .FALSE.
deltaTrbcs = deltaTclock
rbcsIter0 = 0
Expand Down