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 12322 for NEMO/branches/UKMO/NEMO_4.0_FKOSM/src/OCE/ZDF/zdfosm.F90 – NEMO

Ignore:
Timestamp:
2020-01-15T10:33:19+01:00 (4 years ago)
Author:
cguiavarch
Message:

Update with George's latest changes for restartability and reproducibility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0_FKOSM/src/OCE/ZDF/zdfosm.F90

    r12311 r12322  
    141141   !!---------------------------------------------------------------------- 
    142142   !! NEMO/OCE 4.0 , NEMO Consortium (2018) 
    143    !! $Id$ 
     143   !! $Id: zdfosm.F90 12317 2020-01-14 12:40:47Z agn $ 
    144144   !! Software governed by the CeCILL license (see ./LICENSE) 
    145145   !!---------------------------------------------------------------------- 
     
    483483     !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 
    484484     ! BL must be always 4 levels deep. 
     485     ! For calculation of lateral buoyancy gradients for FK in 
     486     ! zdf_osm_zmld_horizontal_gradients need halo values for ibld, so must 
     487     ! previously exist for hbl also. 
    485488      hbl(:,:) = MAX(hbl(:,:), gdepw_n(:,:,4) ) 
    486489      ibld(:,:) = 4 
    487490      DO jk = 5, jpkm1 
    488          DO jj = 2, jpjm1 
    489             DO ji = 2, jpim1 
     491         DO jj = 1, jpj 
     492            DO ji = 1, jpi 
    490493               IF ( hbl(ji,jj) >= gdepw_n(ji,jj,jk) ) THEN 
    491494                  ibld(ji,jj) = MIN(mbkt(ji,jj), jk) 
     
    526529         END DO 
    527530 
    528       imld = ibld           ! use imld to hold previous blayer index 
     531      imld(:,:) = ibld(:,:)           ! use imld to hold previous blayer index 
    529532      ibld(:,:) = 4 
    530533 
     
    10081011       END DO 
    10091012 
     1013       IF(ln_dia_osm) THEN 
     1014          IF ( iom_use("zdtdz_pyc") ) CALL iom_put( "zdtdz_pyc", wmask*zdtdz_pyc ) 
     1015          IF ( iom_use("zdsdz_pyc") ) CALL iom_put( "zdsdz_pyc", wmask*zdsdz_pyc ) 
     1016          IF ( iom_use("zdbdz_pyc") ) CALL iom_put( "zdbdz_pyc", wmask*zdbdz_pyc ) 
     1017       END IF 
     1018 
    10101019! KPP-style Ri# mixing 
    10111020       IF( ln_kpprimix) THEN 
     
    11391148           END DO 
    11401149        END DO 
     1150        ! Lateral boundary conditions on final outputs for hbl,  on T-grid (sign unchanged) 
     1151        CALL lbc_lnk_multi( 'zdfosm', hbl, 'T', 1., dh, 'T', 1., hmle, 'T', 1. ) 
    11411152        ! Lateral boundary conditions on final outputs for gham[ts],  on W-grid  (sign unchanged) 
    11421153        ! Lateral boundary conditions on final outputs for gham[uv],  on [UV]-grid  (sign unchanged) 
     
    21862197        CALL iom_set_rstw_var_active('wn') 
    21872198        CALL iom_set_rstw_var_active('hbl') 
    2188         CALL iom_set_rstw_var_active('hbli') 
     2199        CALL iom_set_rstw_var_active('dh') 
     2200        IF( ln_osm_mle ) THEN 
     2201            CALL iom_set_rstw_var_active('hmle') 
     2202        END IF 
    21892203     ENDIF 
    21902204   END SUBROUTINE zdf_osm_init 
     
    22042218     CHARACTER(len=*), INTENT(in) ::   cdrw   ! "READ"/"WRITE" flag 
    22052219 
    2206      INTEGER ::   id1, id2   ! iom enquiry index 
     2220     INTEGER ::   id1, id2, id3   ! iom enquiry index 
    22072221     INTEGER  ::   ji, jj, jk     ! dummy loop indices 
    22082222     INTEGER  ::   iiki, ikt ! local integer 
     
    22322246           CALL iom_get( numror, jpdom_autoglo, 'dh', dh, ldxios = lrxios  ) 
    22332247           WRITE(numout,*) ' ===>>>> :  hbl & dh read from restart file' 
     2248           IF( ln_osm_mle ) THEN 
     2249              id3 = iom_varid( numror, 'hmle'   , ldstop = .FALSE. ) 
     2250              IF( id3 > 0) THEN 
     2251                 CALL iom_get( numror, jpdom_autoglo, 'hmle' , hmle , ldxios = lrxios ) 
     2252                 WRITE(numout,*) ' ===>>>> :  hmle read from restart file' 
     2253              ELSE 
     2254                 WRITE(numout,*) ' ===>>>> :  hmle not found, set to hbl' 
     2255                 hmle(:,:) = hbl(:,:)            ! Initialise MLE depth. 
     2256              END IF 
     2257           END IF 
    22342258           RETURN 
    22352259        ELSE                      ! 'hbl' & 'dh' not in restart file, recalculate 
     
    22432267     IF( TRIM(cdrw) == 'WRITE') THEN     !* Write hbli into the restart file, then return 
    22442268        IF(lwp) WRITE(numout,*) '---- osm-rst ----' 
    2245          IF( lwxios ) CALL iom_swap(      cwxios_context          ) 
    2246             CALL iom_rstput( kt, nitrst, numrow, 'wn'     , wn  , ldxios = lwxios ) 
    2247             CALL iom_rstput( kt, nitrst, numrow, 'hbl'    , hbl , ldxios = lwxios ) 
    2248             CALL iom_rstput( kt, nitrst, numrow, 'dh'     , dh, ldxios = lwxios ) 
    2249          IF( lwxios ) CALL iom_swap(      cxios_context          ) 
     2269         CALL iom_rstput( kt, nitrst, numrow, 'wn'     , wn,   ldxios = lwxios ) 
     2270         CALL iom_rstput( kt, nitrst, numrow, 'hbl'    , hbl,  ldxios = lwxios ) 
     2271         CALL iom_rstput( kt, nitrst, numrow, 'dh'     , dh,   ldxios = lwxios ) 
     2272         IF( ln_osm_mle ) THEN 
     2273            CALL iom_rstput( kt, nitrst, numrow, 'hmle', hmle, ldxios = lwxios ) 
     2274         END IF 
    22502275        RETURN 
    22512276     END IF 
     
    22812306     END DO 
    22822307 
    2283      IF( ln_osm_mle ) hmle(:,:) = hbl(:,:)            ! Initialise MLE depth. 
    2284  
    22852308     WRITE(numout,*) ' ===>>>> : hbl computed from stratification' 
     2309 
     2310     IF( ln_osm_mle ) THEN 
     2311        hmle(:,:) = hbl(:,:)            ! Initialise MLE depth. 
     2312        WRITE(numout,*) ' ===>>>> : hmle set = to hbl' 
     2313     END IF 
     2314 
    22862315     wn(:,:,:) = 0._wp 
    22872316     WRITE(numout,*) ' ===>>>> :  wn not in restart file, set to zero initially' 
Note: See TracChangeset for help on using the changeset viewer.