diff --git a/pkg/rbcs/RBCS_FIELDS.h b/pkg/rbcs/RBCS_FIELDS.h index eec459406a..bc9eff4bc4 100644 --- a/pkg/rbcs/RBCS_FIELDS.h +++ b/pkg/rbcs/RBCS_FIELDS.h @@ -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, diff --git a/pkg/rbcs/RBCS_PARAMS.h b/pkg/rbcs/RBCS_PARAMS.h index 118effd200..fac5bd1fd2 100644 --- a/pkg/rbcs/RBCS_PARAMS.h +++ b/pkg/rbcs/RBCS_PARAMS.h @@ -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 @@ -29,6 +34,7 @@ C _RL rbcsForcingOffset _RL deltaTrbcs _RL rbcsVanishingTime + _RL rbcsTempHalfWindow INTEGER rbcsIter0 LOGICAL rbcsSingleTimeFiles LOGICAL useRBCuVel @@ -52,7 +58,8 @@ C & rbcsForcingCycle, & rbcsForcingOffset, & rbcsVanishingTime, - & deltaTrbcs + & deltaTrbcs, + & rbcsTempHalfWindow COMMON /RBCS_PARM01_I/ & rbcsIter0 COMMON /RBCS_PARM01_L/ diff --git a/pkg/rbcs/rbcs_add_tendency.F b/pkg/rbcs/rbcs_add_tendency.F index 575b0558cf..1fb7bd1d19 100644 --- a/pkg/rbcs/rbcs_add_tendency.F +++ b/pkg/rbcs/rbcs_add_tendency.F @@ -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 @@ -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 diff --git a/pkg/rbcs/rbcs_fields_load.F b/pkg/rbcs/rbcs_fields_load.F index f2daff21ba..f94ccf07b1 100644 --- a/pkg/rbcs/rbcs_fields_load.F +++ b/pkg/rbcs/rbcs_fields_load.F @@ -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 === @@ -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 @@ -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 */ diff --git a/pkg/rbcs/rbcs_init_varia.F b/pkg/rbcs/rbcs_init_varia.F index 544f573b76..0e225a14f4 100644 --- a/pkg/rbcs/rbcs_init_varia.F +++ b/pkg/rbcs/rbcs_init_varia.F @@ -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 diff --git a/pkg/rbcs/rbcs_readparms.F b/pkg/rbcs/rbcs_readparms.F index d0875189e1..5ade115e86 100644 --- a/pkg/rbcs/rbcs_readparms.F +++ b/pkg/rbcs/rbcs_readparms.F @@ -75,7 +75,8 @@ SUBROUTINE RBCS_READPARMS( myThid ) & rbcsVanishingTime, & rbcsSingleTimeFiles, & deltaTrbcs, - & rbcsIter0 + & rbcsIter0, + & rbcsTempHalfWindow #ifdef ALLOW_PTRACERS NAMELIST /RBCS_PARM02/ @@ -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