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 14566 – NEMO

Changeset 14566


Ignore:
Timestamp:
2021-03-02T11:42:20+01:00 (3 years ago)
Author:
smueller
Message:

Synchronisation of the OSMOSIS boundary layer scheme with the version developed in branch /NEMO/branches/NERC/dev_r11078_OSMOSIS_IMMERSE_Nurser_4.0: transfer of changeset [14516] (ticket #2353)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/2021/dev_r14122_HPC-08_Mueller_OSMOSIS_streamlining/src/OCE/ZDF/zdfosm.F90

    r14565 r14566  
    550550      DO_2D( 0, 0, 0, 0 ) 
    551551         zhbl(ji,jj) = gdepw(ji,jj,ibld(ji,jj),Kmm) 
    552          imld(ji,jj) = MAX(3,ibld(ji,jj) - MAX( INT( dh(ji,jj) / e3t(ji, jj, ibld(ji,jj), Kmm )) , 1 )) 
     552         imld(ji,jj) = MAX(3,ibld(ji,jj) - MAX( INT( dh(ji,jj) / e3t(ji, jj, ibld(ji,jj) - 1, Kmm )) , 1 )) 
    553553         zhml(ji,jj) = gdepw(ji,jj,imld(ji,jj),Kmm) 
    554554         zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj) 
     
    582582         END_2D 
    583583 
    584 !! External gradient 
    585          CALL zdf_osm_external_gradients( ibld+2, zdtdz_bl_ext, zdsdz_bl_ext, zdbdz_bl_ext ) 
     584!! Calculate fairly-well-mixed depth zmld & its index mld_prof + lateral zmld-averaged gradients 
    586585         CALL zdf_osm_zmld_horizontal_gradients( zmld, zdtdx, zdtdy, zdsdx, zdsdy, dbdx_mle, dbdy_mle, zdbds_mle ) 
     586!! Calculate vertical gradients immediately below zmld 
    587587         CALL zdf_osm_external_gradients( mld_prof, zdtdz_mle_ext, zdsdz_mle_ext, zdbdz_mle_ext ) 
     588!! Calculate max vertical FK flux zwb_fk & set logical descriptors 
    588589         CALL zdf_osm_osbl_state_fk( lpyc, lflux, lmle, zwb_fk ) 
     590!! recalculate hmle, zmle, zvel_mle, zdiff_mle & redefine mld_proc to be index for new hmle 
    589591         CALL zdf_osm_mle_parameters( zmld, mld_prof, hmle, zhmle, zvel_mle, zdiff_mle ) 
    590592      ELSE    ! ln_osm_mle 
     
    597599         END_2D 
    598600      ENDIF   ! ln_osm_mle 
     601 
     602!! External gradient below BL needed both with and w/o FK 
     603      CALL zdf_osm_external_gradients( ibld+2, zdtdz_bl_ext, zdsdz_bl_ext, zdbdz_bl_ext ) 
    599604 
    600605! Test if pycnocline well resolved 
     
    615620      END_2D 
    616621 
     622      ! Recalculate bl averages using jp_ext & ml averages .... note no rotation of u & v here.. 
    617623      CALL zdf_osm_vertical_average( Kbb, Kmm,                                          & 
    618624         &                           ibld, zt_bl, zs_bl, zb_bl, zu_bl, zv_bl,           & 
     
    648654! is external level in bounds? 
    649655 
     656!   Recalculate BL averages and differences using new BL depth 
    650657      CALL zdf_osm_vertical_average( Kbb, Kmm,                                          & 
    651658         &                           ibld, zt_bl, zs_bl, zb_bl, zu_bl, zv_bl,           & 
     
    663670      dstokes(:,:) = MIN ( dstokes(:,:), hbl(:,:)/3. )  !  Limit delta for shallow boundary layers for calculating flux-gradient terms. 
    664671! 
    665     ! Average over the depth of the mixed layer in the convective boundary layer 
     672      ! Average over the depth of the mixed layer in the convective boundary layer 
    666673!      jp_ext = ibld - imld +1 
     674!     Recalculate ML averages and differences using new ML depth 
    667675      CALL zdf_osm_vertical_average( Kbb, Kmm,                                               & 
    668676         &                           imld-1, zt_ml, zs_ml, zb_ml, zu_ml, zv_ml,              & 
    669677         &                           ibld-imld+1, zdt_ml, zds_ml, zdb_ml, zdu_ml, zdv_ml ) 
    670     ! rotate mean currents and changes onto wind align co-ordinates 
    671     ! 
    672      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_ml, zv_ml, zdu_ml, zdv_ml ) 
    673      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_bl, zv_bl, zdu_bl, zdv_bl ) 
     678      ! rotate mean currents and changes onto wind align co-ordinates 
     679      ! 
     680      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_ml, zv_ml, zdu_ml, zdv_ml ) 
     681      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_bl, zv_bl, zdu_bl, zdv_bl ) 
    674682      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    675683      !  Pycnocline gradients for scalars and velocity 
     
    9931001                DO jk = imld(ji,jj) , ibld(ji,jj) 
    9941002                   zznd_pyc = -( gdepw(ji,jj,jk,Kmm) - zhbl(ji,jj) ) / MAX(zdh(ji,jj), 1.e-6) 
    995                     zviscos(ji,jj,jk) = zvispyc_n_sc(ji,jj) * ( za_cubic + zb_cubic * zznd_pyc + zc_cubic * zznd_pyc**2 + zd_cubic * zznd_pyc**3 ) 
    996                     zviscos(ji,jj,jk) = zviscos(ji,jj,jk) + zvispyc_s_sc(ji,jj) * ( 1.75 * zznd_pyc - 0.15 * zznd_pyc**2 -0.2 * zznd_pyc**3 ) 
     1003                   zviscos(ji,jj,jk) = zvispyc_n_sc(ji,jj) * ( za_cubic + zb_cubic * zznd_pyc + zc_cubic * zznd_pyc**2 + zd_cubic * zznd_pyc**3 ) 
     1004                   zviscos(ji,jj,jk) = zviscos(ji,jj,jk) + zvispyc_s_sc(ji,jj) * ( 1.75 * zznd_pyc - 0.15 * zznd_pyc**2 -0.2 * zznd_pyc**3 ) 
    9971005                END DO 
    9981006                IF ( zdhdt(ji,jj) > 0._wp ) THEN 
     
    13381346           jkb1 = MIN(jkb + 1, mbkt(ji,jj)) 
    13391347           zdtdz(ji,jj) = - ( ts(ji,jj,jkb1,jp_tem,Kmm) - ts(ji,jj,jkb,jp_tem,Kmm ) ) & 
    1340                 &   / e3t(ji,jj,jkb,Kmm) 
     1348                &   / e3w(ji,jj,jkb1,Kmm) 
    13411349           zdsdz(ji,jj) = - ( ts(ji,jj,jkb1,jp_sal,Kmm) - ts(ji,jj,jkb,jp_sal,Kmm ) ) & 
    1342                 &   / e3t(ji,jj,jkb,Kmm) 
     1350                &   / e3w(ji,jj,jkb1,Kmm) 
    13431351           zdbdz(ji,jj) = grav * zthermal * zdtdz(ji,jj) - grav * zbeta * zdsdz(ji,jj) 
    13441352        ELSE 
     
    16341642                 IF ( ln_osm_mle ) THEN 
    16351643                    zhbl_s = zhbl_s + MIN( & 
    1636                      & rn_Dt * ( ( -zwb_ent(ji,jj) - 2.0 * zwb_fk_b(ji,jj) )/ zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
    1637                      & e3w(ji,jj,jm,Kmm) ) 
     1644                       & rn_Dt * ( ( -zwb_ent(ji,jj) - 2.0 * zwb_fk_b(ji,jj) )/ zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
     1645                       & e3w(ji,jj,jm,Kmm) ) 
    16381646                 ELSE 
    1639                    zhbl_s = zhbl_s + MIN( & 
    1640                      & rn_Dt * (  -zwb_ent(ji,jj) / zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
    1641                      & e3w(ji,jj,jm,Kmm) ) 
     1647                    zhbl_s = zhbl_s + MIN( & 
     1648                       & rn_Dt * (  -zwb_ent(ji,jj) / zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
     1649                       & e3w(ji,jj,jm,Kmm) ) 
    16421650                 ENDIF 
    16431651 
    1644 !                    zhbl_s = MIN(zhbl_s,  gdepw(ji,jj, mbkt(ji,jj) + 1,Kmm) - depth_tol) 
     1652                 !                    zhbl_s = MIN(zhbl_s,  gdepw(ji,jj, mbkt(ji,jj) + 1,Kmm) - depth_tol) 
    16451653                 IF ( zhbl_s >= gdepw(ji,jj,mbkt(ji,jj) + 1,Kmm) ) THEN 
    1646                    zhbl_s = MIN(zhbl_s,  gdepw(ji,jj, mbkt(ji,jj) + 1,Kmm) - depth_tol) 
    1647                    lpyc(ji,jj) = .FALSE. 
     1654                    zhbl_s = MIN(zhbl_s,  gdepw(ji,jj, mbkt(ji,jj) + 1,Kmm) - depth_tol) 
     1655                    lpyc(ji,jj) = .FALSE. 
    16481656                 ENDIF 
    16491657                 IF ( zhbl_s >= gdepw(ji,jj,jm+1,Kmm) ) jm = jm + 1 
     
    16801688! change zero or one model level. 
    16811689          hbl(ji,jj) = MAX(zhbl_t(ji,jj), gdepw(ji,jj,4,Kmm) ) 
    1682         ENDIF 
    1683         zhbl(ji,jj) = gdepw(ji,jj,ibld(ji,jj),Kmm) 
     1690       ENDIF 
     1691       zhbl(ji,jj) = gdepw(ji,jj,ibld(ji,jj),Kmm) 
    16841692     END_2D 
    16851693     IF( ln_timing ) CALL timing_stop('zdf_osm_th') 
     
    17541762               zdh_ref = 0.2 * hbl(ji,jj) 
    17551763            ENDIF    ! IF (dhdt >= 0) 
    1756             dh(ji,jj) = dh(ji,jj) * EXP( -rn_Dt / ztau )+ zdh_ref * ( 1.0 - EXP( -rn_Dt / ztau ) ) 
     1764            dh(ji,jj) = dh(ji,jj) * EXP( -rn_Dt / ztau ) + zdh_ref * ( 1.0 - EXP( -rn_Dt / ztau ) ) 
    17571765            IF ( zdhdt(ji,jj) < 0._wp .and. dh(ji,jj) >= hbl(ji,jj) ) dh(ji,jj) = zdh_ref       ! can be a problem with dh>hbl for rapid collapse 
    1758             ! Alan: this hml is never defined or used -- do we need it? 
    17591766         ENDIF 
    17601767 
     
    18241831 
    18251832      hml(ji,jj) = hbl(ji,jj) - dh(ji,jj) 
    1826       inhml = MAX( INT( dh(ji,jj) / MAX(e3t(ji,jj,ibld(ji,jj),Kmm), 1.e-3) ) , 1 ) 
     1833      inhml = MAX( INT( dh(ji,jj) / MAX(e3t(ji,jj,ibld(ji,jj) - 1,Kmm), 1.e-3) ) , 1 ) 
    18271834      imld(ji,jj) = MAX( ibld(ji,jj) - inhml, 3) 
    18281835      zhml(ji,jj) = gdepw(ji,jj,imld(ji,jj),Kmm) 
Note: See TracChangeset for help on using the changeset viewer.