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

Changeset 14516


Ignore:
Timestamp:
2021-02-21T17:04:21+01:00 (3 years ago)
Author:
agn
Message:

Use e3t(ibld-1) as measure of layer thickness between imld & ibld

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/NERC/dev_r11078_OSMOSIS_IMMERSE_Nurser_4.0/src/OCE/ZDF/zdfosm.F90

    r14515 r14516  
    600600         DO ji = 2, jpim1 
    601601            zhbl(ji,jj) = gdepw_n(ji,jj,ibld(ji,jj)) 
    602             imld(ji,jj) = MAX(3,ibld(ji,jj) - MAX( INT( dh(ji,jj) / e3t_n(ji, jj, ibld(ji,jj) )) , 1 )) 
     602            imld(ji,jj) = MAX(3,ibld(ji,jj) - MAX( INT( dh(ji,jj) / e3t_n(ji, jj, ibld(ji,jj) - 1 )) , 1 )) 
    603603            zhml(ji,jj) = gdepw_n(ji,jj,imld(ji,jj)) 
    604604            zdh(ji,jj) = zhbl(ji,jj) - zhml(ji,jj) 
     
    635635         END DO 
    636636 
    637 !! External gradient 
    638          CALL zdf_osm_external_gradients( ibld+2, zdtdz_bl_ext, zdsdz_bl_ext, zdbdz_bl_ext ) 
     637!! Calculate fairly-well-mixed depth zmld & its index mld_prof + lateral zmld-averaged gradients 
    639638         CALL zdf_osm_zmld_horizontal_gradients( zmld, zdtdx, zdtdy, zdsdx, zdsdy, dbdx_mle, dbdy_mle, zdbds_mle ) 
     639!! Calculate vertical gradients immediately below zmld 
    640640         CALL zdf_osm_external_gradients( mld_prof, zdtdz_mle_ext, zdsdz_mle_ext, zdbdz_mle_ext ) 
     641!! calculate max vertical FK flux zwb_fk & set logical descriptors 
    641642         CALL zdf_osm_osbl_state_fk( lpyc, lflux, lmle, zwb_fk ) 
     643!! recalculate hmle, zmle, zvel_mle, zdiff_mle & redefine mld_proc to be index for new hmle 
    642644         CALL zdf_osm_mle_parameters( zmld, mld_prof, hmle, zhmle, zvel_mle, zdiff_mle ) 
    643645      ELSE    ! ln_osm_mle 
     
    652654         END DO 
    653655      ENDIF   ! ln_osm_mle 
     656 
     657!! External gradient below BL needed both with and w/o FK 
     658         CALL zdf_osm_external_gradients( ibld+2, zdtdz_bl_ext, zdsdz_bl_ext, zdbdz_bl_ext ) 
    654659 
    655660! Test if pycnocline well resolved 
     
    669674            jp_ext(ji,jj) = 0 
    670675          ENDIF 
    671         END DO 
    672       END DO 
    673  
    674       CALL zdf_osm_vertical_average(ibld, jp_ext, zt_bl, zs_bl, zb_bl, zu_bl, zv_bl, zdt_bl, zds_bl, zdb_bl, zdu_bl, zdv_bl ) 
     676       END DO 
     677    END DO 
     678 
     679    ! Recalculate bl averages using jp_ext & ml averages .... note no rotation of u & v here.. 
     680    CALL zdf_osm_vertical_average(ibld, jp_ext, zt_bl, zs_bl, zb_bl, zu_bl, zv_bl, zdt_bl, zds_bl, zdb_bl, zdu_bl, zdv_bl ) 
    675681!      jp_ext = ibld-imld+1 
    676       CALL zdf_osm_vertical_average(imld-1, ibld-imld+1, zt_ml, zs_ml, zb_ml, zu_ml, zv_ml, zdt_ml, zds_ml, zdb_ml, zdu_ml, zdv_ml) 
     682    CALL zdf_osm_vertical_average(imld-1, ibld-imld+1, zt_ml, zs_ml, zb_ml, zu_ml, zv_ml, zdt_ml, zds_ml, zdb_ml, zdu_ml, zdv_ml) 
     683 
    677684! Rate of change of hbl 
    678685      CALL zdf_osm_calculate_dhdt( zdhdt ) 
     
    685692             lpyc(ji,jj) = .FALSE. 
    686693          ENDIF 
    687          END DO 
    688        END DO 
     694        END DO 
     695      END DO 
    689696 
    690697      imld(:,:) = ibld(:,:)           ! use imld to hold previous blayer index 
     
    707714! is external level in bounds? 
    708715 
     716!   Recalculate BL averages and differences using new BL depth 
    709717      CALL zdf_osm_vertical_average( ibld, jp_ext, zt_bl, zs_bl, zb_bl, zu_bl, zv_bl, zdt_bl, zds_bl, zdb_bl, zdu_bl, zdv_bl ) 
    710718! 
     
    722730      dstokes(:,:) = MIN ( dstokes(:,:), hbl(:,:)/3. )  !  Limit delta for shallow boundary layers for calculating flux-gradient terms. 
    723731! 
    724     ! Average over the depth of the mixed layer in the convective boundary layer 
     732      ! Average over the depth of the mixed layer in the convective boundary layer 
    725733!      jp_ext = ibld - imld +1 
     734!     Recalculate ML averages and differences using new ML depth 
    726735      CALL zdf_osm_vertical_average( imld-1, ibld-imld+1, zt_ml, zs_ml, zb_ml, zu_ml, zv_ml, zdt_ml, zds_ml, zdb_ml, zdu_ml, zdv_ml ) 
    727     ! rotate mean currents and changes onto wind align co-ordinates 
    728     ! 
    729      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_ml, zv_ml, zdu_ml, zdv_ml ) 
    730      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_bl, zv_bl, zdu_bl, zdv_bl ) 
     736      ! rotate mean currents and changes onto wind align co-ordinates 
     737      ! 
     738      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_ml, zv_ml, zdu_ml, zdv_ml ) 
     739      CALL zdf_osm_velocity_rotation( zcos_wind, zsin_wind, zu_bl, zv_bl, zdu_bl, zdv_bl ) 
    731740      !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
    732741      !  Pycnocline gradients for scalars and velocity 
     
    14651474                   DO jk = imld(ji,jj) , ibld(ji,jj) 
    14661475                      zznd_pyc = -( gdepw_n(ji,jj,jk) - zhbl(ji,jj) ) / MAX(zdh(ji,jj), 1.e-6) 
    1467                        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 ) 
    1468                        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 ) 
     1476                      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 ) 
     1477                      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 ) 
    14691478                   END DO 
    14701479                   IF ( zdhdt(ji,jj) > 0._wp ) THEN 
     
    18911900              jkb1 = MIN(jkb + 1, mbkt(ji,jj)) 
    18921901              zdtdz(ji,jj) = - ( tsn(ji,jj,jkb1,jp_tem) - tsn(ji,jj,jkb,jp_tem ) ) & 
    1893                    &   / e3t_n(ji,jj,jkb) 
     1902                   &   / e3w_n(ji,jj,jkb1) 
    18941903              zdsdz(ji,jj) = - ( tsn(ji,jj,jkb1,jp_sal) - tsn(ji,jj,jkb,jp_sal ) ) & 
    1895                    &   / e3t_n(ji,jj,jkb) 
     1904                   &   / e3w_n(ji,jj,jkb1) 
    18961905              zdbdz(ji,jj) = grav * zthermal * zdtdz(ji,jj) - grav * zbeta * zdsdz(ji,jj) 
    18971906           ELSE 
     
    19471956                         zdbdz(ji,jj,jk) =  zbgrad * EXP( -zgamma_b * ( znd - zzeta_m )**2 ) 
    19481957                     ENDIF 
    1949                   END DO 
    1950                ENDIF ! if no pycnocline pycnocline gradients set to zero 
     1958                   END DO 
     1959                ENDIF ! if no pycnocline pycnocline gradients set to zero 
    19511960              ELSE 
    19521961                 ! stable conditions 
     
    20972106                           zari = MIN( 1.5 * zdb_bl(ji,jj) / ( zhbl(ji,jj) * ( MAX(zdbdz_bl_ext(ji,jj),0._wp) + zdb_bl(ji,jj)**2 / MAX(4.5 * zwstrc(ji,jj)**2 , 1.e-12 )) ), 0.2d0 ) 
    20982107                        ENDIF 
    2099 ! Relaxation to dh_ref = zari * hbl 
     2108                        ! Relaxation to dh_ref = zari * hbl 
    21002109                        zddhdt = -a_ddh_2 * ( 1.0 - zdh(ji,jj) / ( zari * zhbl(ji,jj) ) ) * zwb_ent(ji,jj) / zdb_bl(ji,jj) 
    2101                          
     2110 
    21022111                      ELSE IF ( j_ddh(ji,jj) == 0 ) THEN 
    21032112! Growing shear layer 
     
    22442253                    IF ( ln_osm_mle ) THEN 
    22452254                       zhbl_s = zhbl_s + MIN( & 
    2246                         & rn_rdt * ( ( -zwb_ent(ji,jj) - 2.0 * zwb_fk_b(ji,jj) )/ zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
    2247                         & e3w_n(ji,jj,jm) ) 
     2255                            & rn_rdt * ( ( -zwb_ent(ji,jj) - 2.0 * zwb_fk_b(ji,jj) )/ zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
     2256                            & e3w_n(ji,jj,jm) ) 
    22482257                    ELSE 
    2249                       zhbl_s = zhbl_s + MIN( & 
    2250                         & rn_rdt * (  -zwb_ent(ji,jj) / zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
    2251                         & e3w_n(ji,jj,jm) ) 
     2258                       zhbl_s = zhbl_s + MIN( & 
     2259                            & rn_rdt * (  -zwb_ent(ji,jj) / zdb ) / FLOAT(ibld(ji,jj) - imld(ji,jj) ), & 
     2260                            & e3w_n(ji,jj,jm) ) 
    22522261                    ENDIF 
    22532262 
    2254 !                    zhbl_s = MIN(zhbl_s,  gdepw_n(ji,jj, mbkt(ji,jj) + 1) - depth_tol) 
     2263                    !                    zhbl_s = MIN(zhbl_s,  gdepw_n(ji,jj, mbkt(ji,jj) + 1) - depth_tol) 
    22552264                    IF ( zhbl_s >= gdepw_n(ji,jj,mbkt(ji,jj) + 1) ) THEN 
    2256                       zhbl_s = MIN(zhbl_s,  gdepw_n(ji,jj, mbkt(ji,jj) + 1) - depth_tol) 
    2257                       lpyc(ji,jj) = .FALSE. 
     2265                       zhbl_s = MIN(zhbl_s,  gdepw_n(ji,jj, mbkt(ji,jj) + 1) - depth_tol) 
     2266                       lpyc(ji,jj) = .FALSE. 
    22582267                    ENDIF 
    22592268                    IF ( zhbl_s >= gdepw_n(ji,jj,jm+1) ) jm = jm + 1 
     
    22902299! change zero or one model level. 
    22912300             hbl(ji,jj) = MAX(zhbl_t(ji,jj), gdepw_n(ji,jj,4) ) 
    2292            ENDIF 
    2293            zhbl(ji,jj) = gdepw_n(ji,jj,ibld(ji,jj)) 
     2301          ENDIF 
     2302          zhbl(ji,jj) = gdepw_n(ji,jj,ibld(ji,jj)) 
    22942303         END DO 
    22952304      END DO 
     
    23642373                  zdh_ref = 0.2 * hbl(ji,jj) 
    23652374               ENDIF    ! IF (dhdt >= 0) 
    2366                dh(ji,jj) = dh(ji,jj) * EXP( -rn_rdt / ztau )+ zdh_ref * ( 1.0 - EXP( -rn_rdt / ztau ) ) 
     2375               dh(ji,jj) = dh(ji,jj) * EXP( -rn_rdt / ztau ) + zdh_ref * ( 1.0 - EXP( -rn_rdt / ztau ) ) 
    23672376               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 
    2368                ! Alan: this hml is never defined or used -- do we need it? 
    23692377            ENDIF 
    23702378              
     
    24342442  
    24352443         hml(ji,jj) = hbl(ji,jj) - dh(ji,jj) 
    2436          inhml = MAX( INT( dh(ji,jj) / MAX(e3t_n(ji,jj,ibld(ji,jj)), 1.e-3) ) , 1 ) 
     2444         inhml = MAX( INT( dh(ji,jj) / MAX(e3t_n(ji,jj,ibld(ji,jj)-1), 1.e-3) ) , 1 ) 
    24372445         imld(ji,jj) = MAX( ibld(ji,jj) - inhml, 3) 
    24382446         zhml(ji,jj) = gdepw_n(ji,jj,imld(ji,jj)) 
Note: See TracChangeset for help on using the changeset viewer.