New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 1239 for trunk/NEMO/OPA_SRC/restart.F90 – NEMO

Ignore:
Timestamp:
2008-12-31T10:35:35+01:00 (15 years ago)
Author:
ctlod
Message:

this version allows to stabilize the computation of En production term, see ticket: #281

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMO/OPA_SRC/restart.F90

    r1229 r1239  
    2424   USE eosbn2          ! equation of state            (eos bn2 routine) 
    2525   USE trdmld_oce      ! ocean active mixed layer tracers trends variables 
     26#if defined key_zdftke2 
     27   USE zdf_oce 
     28#endif 
    2629 
    2730   IMPLICIT NONE 
     
    6467         lrst_oce = .FALSE.    
    6568         nitrst = nitend 
     69#if defined key_zdftke2 
     70         nitrst_tke2 = nitrst + 1 
     71#endif 
    6672      ENDIF 
    6773      IF( MOD( kt - 1, nstock ) == 0 ) THEN    
     
    7076         IF( nitrst > nitend )   nitrst = nitend   ! make sure we write a restart at the end of the run 
    7177      ENDIF 
    72  
     78#if defined key_zdftke2 
     79      IF ( nitrst_tke2 .NE. kt ) nitrst_tke2 = nitrst + 1 
     80#endif 
    7381      ! to get better performances with NetCDF format: 
    7482      ! we open and define the ocean restart file one time step before writing the data (-> at nitrst - 1) 
     
    110118      INTEGER, INTENT(in) ::   kt   ! ocean time-step 
    111119      !!---------------------------------------------------------------------- 
     120 
     121#if defined key_zdftke2 
     122      IF( kt == nitrst_tke2 ) THEN 
     123         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
     124         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
     125      ELSE 
     126#endif 
    112127      !                                                                     ! the begining of the run [s] 
    113128      CALL iom_rstput( kt, nitrst, numrow, 'rdt'    , rdt               )   ! dynamics time step 
     
    129144      CALL iom_rstput( kt, nitrst, numrow, 'hdivn'  , hdivn   ) 
    130145 
     146#if defined key_zdftke2 
     147         CALL iom_rstput( kt, nitrst, numrow, 'rhop'   , rhop    ) 
     148#endif 
    131149      IF( nn_dynhpg_rst == 1 .OR. lk_vvl ) THEN 
    132150         CALL iom_rstput( kt, nitrst, numrow, 'rhd' , rhd  ) 
     151#if defined key_zdftke2 
     152         CALL iom_rstput( kt, nitrst, numrow, 'rn2' , rn2  ) 
     153         CALL iom_rstput( kt, nitrst, numrow, 'avt' , avt  ) 
     154      ENDIF 
     155#else 
    133156         CALL iom_rstput( kt, nitrst, numrow, 'rhop', rhop ) 
     157#endif 
    134158         IF( ln_zps ) THEN 
    135159            CALL iom_rstput( kt, nitrst, numrow, 'gtu' , gtu ) 
     
    141165         ENDIF 
    142166      ENDIF 
    143  
     167#if ! defined key_zdftke2 
    144168      IF( kt == nitrst ) THEN 
    145169         CALL iom_close( numrow )     ! close the restart file (only at last time step) 
    146170         IF( .NOT. lk_trdmld )   lrst_oce = .FALSE. 
    147171      ENDIF 
     172#endif 
    148173      ! 
    149174   END SUBROUTINE rst_write 
     
    163188      !!      - barotropic stream function arrays ("key_dynspg_rl" defined) 
    164189      !!        or free surface arrays  
    165       !!      - tke arrays (lk_zdftke=T) 
     190      !!      - tke arrays (lk_zdftke=T .OR. lk_zdftke2=T) 
    166191      !!      for this last three records,  the previous characteristics  
    167192      !!      could be different with those used in the present run.  
     
    215240      ENDIF 
    216241 
     242#if defined key_zdftke2 
     243      CALL eos( tb, sb, rhd, rhop )        ! before potential and in situ densities 
     244      IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN 
     245         CALL iom_get( numror, jpdom_autoglo, 'rhd' , rhd  ) 
     246      ENDIF 
     247      IF( iom_varid( numror, 'rhop', ldstop = .FALSE. ) > 0 ) THEN 
     248         CALL iom_get( numror, jpdom_autoglo, 'rhop', rhop ) 
     249      ENDIF 
     250#else 
    217251      IF( iom_varid( numror, 'rhd', ldstop = .FALSE. ) > 0 ) THEN 
    218252         CALL iom_get( numror, jpdom_autoglo, 'rhd' , rhd  ) 
     
    221255         CALL eos( tb, sb, rhd, rhop )        ! before potential and in situ densities 
    222256      ENDIF 
     257#endif 
     258#if defined key_zdftke2 
     259      CALL eos_init            ! usefull to get the equation state type neos parameter 
     260      IF( iom_varid( numror, 'rn2', ldstop = .FALSE. ) > 0 ) THEN 
     261         CALL iom_get( numror, jpdom_autoglo, 'rn2' , rn2  ) 
     262      ELSE 
     263         IF ( ln_dynhpg_imp ) THEN 
     264            CALL bn2( tb, sb, rn2 )  ! before Brunt-Vaisala frequency    
     265         ENDIF       
     266      ENDIF 
     267      IF( iom_varid( numror, 'avt', ldstop = .FALSE. ) > 0 ) THEN 
     268         CALL iom_get( numror, jpdom_autoglo, 'avt' , avt  ) 
     269      ELSE 
     270         IF ( ln_dynhpg_imp ) avt (:,:,:) = 1.2e-5 * tmask(:,:,:) 
     271      ENDIF 
     272#endif 
     273 
    223274      IF( ln_zps .AND. .NOT. lk_c1d ) THEN 
    224275         IF( iom_varid( numror, 'gtu', ldstop = .FALSE. ) > 0 ) THEN 
Note: See TracChangeset for help on using the changeset viewer.