Skip to content

Commit cd002df

Browse files
committed
Merge branch 'MPAS-v8.0/ccpp_sfclayrev' into develop (PR #1054)
This merge adds the initial implementation of the CCPP-compliant version of the MM5 revised surface layer scheme. The initial version of module_sf_sfclayrev.F is split in two separate files: sf_sfclayrev.F in physics_mmm contains the actual parameterization of the MM5 revised surface layer scheme whereas the modified version of module_sf_sfclayrev.F reduces to a buffer between the parameterization and the MPAS physics driver.
2 parents cf37902 + 94c05f7 commit cd002df

7 files changed

Lines changed: 1617 additions & 13 deletions

File tree

src/core_atmosphere/physics/mpas_atmphys_control.F

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ module mpas_atmphys_control
7272
! * modified logic in subroutine physics_tables_init so that the Thompson microphysics tables are read in each
7373
! MPI task.
7474
! Laura D. Fowler (laura@ucar.edu) / 2016-12-30.
75+
! * added the option sf_monin_obukhov_rev to run the revised surface layer scheme with the YSU PBL scheme.
76+
! Laura D. Fowler (laura@ucar.edu) / 2023-05-15.
7577

7678

7779
contains
@@ -255,9 +257,10 @@ subroutine physics_namelist_check(configs)
255257
endif
256258

257259
!surface-layer scheme:
258-
if(.not. (config_sfclayer_scheme .eq. 'off' .or. &
259-
config_sfclayer_scheme .eq. 'sf_mynn' .or. &
260-
config_sfclayer_scheme .eq. 'sf_monin_obukhov')) then
260+
if(.not. (config_sfclayer_scheme .eq. 'off' .or. &
261+
config_sfclayer_scheme .eq. 'sf_mynn' .or. &
262+
config_sfclayer_scheme .eq. 'sf_monin_obukhov' .or. &
263+
config_sfclayer_scheme .eq. 'sf_monin_obukhov_rev')) then
261264

262265
write(mpas_err_message,'(A,A10)') 'illegal value for surface layer scheme: ', &
263266
trim(config_sfclayer_scheme)
@@ -266,7 +269,12 @@ subroutine physics_namelist_check(configs)
266269
if(config_pbl_scheme == 'bl_mynn') then
267270
config_sfclayer_scheme = 'sf_mynn'
268271
elseif(config_pbl_scheme == 'bl_ysu') then
269-
config_sfclayer_scheme = 'sf_monin_obukhov'
272+
if(config_sfclayer_scheme /= 'sf_monin_obukhov' .and. &
273+
config_sfclayer_scheme /= 'sf_monin_obukhov_rev') then
274+
write(mpas_err_message,'(A,A10)') 'wrong choice for surface layer scheme with YSU PBL: ', &
275+
trim(config_sfclayer_scheme)
276+
call physics_error_fatal(mpas_err_message)
277+
endif
270278
endif
271279
endif
272280

src/core_atmosphere/physics/mpas_atmphys_driver_sfclayer.F

Lines changed: 142 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ module mpas_atmphys_driver_sfclayer
1717
!wrf physics:
1818
use module_sf_mynn
1919
use module_sf_sfclay
20+
use module_sf_sfclayrev,only: sfclayrev
21+
use sf_sfclayrev,only: sf_sfclayrev_init
2022

2123
implicit none
2224
private
@@ -78,7 +80,13 @@ module mpas_atmphys_driver_sfclayer
7880
! Laura D. Fowler (laura@ucar.edu) / 2016-10-18.
7981
! * since we removed the local variable sfclayer_scheme from mpas_atmphys_vars.F, now defines sfclayer_scheme
8082
! as a pointer to config_sfclayer_scheme.
81-
! Laura D. Fowler (laura@ucar.edu) / 2917-02-16.
83+
! Laura D. Fowler (laura@ucar.edu) / 2017-02-16.
84+
! * in subroutine driver_sfclayer, replaced the call to sfclay with a call to sfclayrev to use the revised
85+
! version of the MONIN-OBUKHOV surface layer scheme.
86+
! Laura D. Fowler (laura@ucar.edu) / 2023-05-15.
87+
! * added the option sf_monin_obukhov_rev to run the revised surface layer scheme with the YSU PBL scheme.
88+
! Laura D. Fowler (laura@ucar.edu) / 2023-05-15.
89+
8290

8391

8492
contains
@@ -184,14 +192,25 @@ subroutine allocate_sfclayer(configs)
184192

185193
sfclayer_select: select case (trim(sfclayer_scheme))
186194

187-
case("sf_monin_obukhov")
195+
case("sf_monin_obukhov","sf_monin_obukhov_rev")
188196
if(.not.allocated(fh_p)) allocate(fh_p(ims:ime,jms:jme))
189197
if(.not.allocated(fm_p)) allocate(fm_p(ims:ime,jms:jme))
190198
if(config_frac_seaice) then
191199
if(.not.allocated(fh_sea)) allocate(fh_sea(ims:ime,jms:jme))
192200
if(.not.allocated(fm_sea)) allocate(fm_sea(ims:ime,jms:jme))
193201
endif
194202

203+
sfclayer2_select: select case(sfclayer_scheme)
204+
205+
case("sf_monin_obukhov_rev")
206+
if(.not.allocated(waterdepth_p)) allocate(waterdepth_p(ims:ime,jms:jme))
207+
if(.not.allocated(lakedepth_p) ) allocate(lakedepth_p(ims:ime,jms:jme) )
208+
if(.not.allocated(lakemask_p) ) allocate(lakemask_p(ims:ime,jms:jme) )
209+
210+
case default
211+
212+
end select sfclayer2_select
213+
195214
case("sf_mynn")
196215
if(.not.allocated(snowh_p)) allocate(snowh_p(ims:ime,jms:jme))
197216
if(.not.allocated(ch_p) ) allocate(ch_p(ims:ime,jms:jme) )
@@ -301,14 +320,25 @@ subroutine deallocate_sfclayer(configs)
301320

302321
sfclayer_select: select case (trim(sfclayer_scheme))
303322

304-
case("sf_monin_obukhov")
323+
case("sf_monin_obukhov","sf_monin_obukhov_rev")
305324
if(allocated(fh_p)) deallocate(fh_p)
306325
if(allocated(fm_p)) deallocate(fm_p)
307326
if(config_frac_seaice) then
308327
if(allocated(fh_sea)) deallocate(fh_sea)
309328
if(allocated(fm_sea)) deallocate(fm_sea)
310329
endif
311330

331+
sfclayer2_select: select case(sfclayer_scheme)
332+
333+
case("sf_monin_obukhov_rev")
334+
if(allocated(waterdepth_p)) deallocate(waterdepth_p)
335+
if(allocated(lakedepth_p) ) deallocate(lakedepth_p )
336+
if(allocated(lakemask_p) ) deallocate(lakemask_p )
337+
338+
case default
339+
340+
end select sfclayer2_select
341+
312342
case("sf_mynn")
313343
if(allocated(snowh_p)) deallocate(snowh_p)
314344
if(allocated(ch_p) ) deallocate(ch_p )
@@ -516,7 +546,7 @@ subroutine sfclayer_from_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
516546

517547
sfclayer_select: select case (trim(sfclayer_scheme))
518548

519-
case("sf_monin_obukhov")
549+
case("sf_monin_obukhov","sf_monin_obukhov_rev")
520550
call mpas_pool_get_array(diag_physics,'fh',fh)
521551
call mpas_pool_get_array(diag_physics,'fm',fm)
522552

@@ -531,6 +561,22 @@ subroutine sfclayer_from_MPAS(configs,mesh,diag_physics,sfc_input,its,ite)
531561
enddo
532562
enddo
533563

564+
sfclayer2_select: select case(sfclayer_scheme)
565+
566+
case("sf_monin_obukhov_rev")
567+
568+
do j = jts,jte
569+
do i = its,ite
570+
waterdepth_p(i,j) = 0._RKIND
571+
lakedepth_p(i,j) = 0._RKIND
572+
lakemask_p(i,j) = 0._RKIND
573+
enddo
574+
enddo
575+
576+
case default
577+
578+
end select sfclayer2_select
579+
534580
case("sf_mynn")
535581
!input variables:
536582
call mpas_pool_get_array(diag_physics,'qcg' ,qcg )
@@ -733,7 +779,7 @@ subroutine sfclayer_to_MPAS(configs,sfc_input,diag_physics,its,ite)
733779

734780
sfclayer_select: select case (trim(sfclayer_scheme))
735781

736-
case("sf_monin_obukhov")
782+
case("sf_monin_obukhov","sf_monin_obukhov_rev")
737783
call mpas_pool_get_array(diag_physics,'fh',fh)
738784
call mpas_pool_get_array(diag_physics,'fm',fm)
739785

@@ -791,15 +837,26 @@ subroutine init_sfclayer(configs)
791837
logical, parameter:: allowed_to_read = .false. !actually not used in subroutine sfclayinit.
792838
character(len=StrKIND),pointer:: sfclayer_scheme
793839

840+
!CCPP-compliant flags:
841+
character(len=StrKIND):: errmsg
842+
integer:: errflg
843+
794844
!-----------------------------------------------------------------------------------------------------------------
795845

846+
!initialization of CCPP-compliant flags:
847+
errmsg = ' '
848+
errflg = 0
849+
796850
call mpas_pool_get_config(configs,'config_sfclayer_scheme',sfclayer_scheme)
797851

798852
sfclayer_select: select case (trim(sfclayer_scheme))
799853

800854
case("sf_monin_obukhov")
801855
call sfclayinit(allowed_to_read)
802856

857+
case("sf_monin_obukhov_rev")
858+
call sf_sfclayrev_init(errmsg,errflg)
859+
803860
case("sf_mynn")
804861
call mynn_sf_init_driver(allowed_to_read)
805862

@@ -833,10 +890,18 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite
833890
integer:: initflag
834891
real(kind=RKIND):: dx
835892

893+
!CCPP-compliant flags:
894+
character(len=StrKIND):: errmsg
895+
integer:: errflg
896+
836897
!-----------------------------------------------------------------------------------------------------------------
837898
!call mpas_log_write('')
838899
!call mpas_log_write('--- enter subroutine driver_sfclayer:')
839900

901+
!initialization of CCPP-compliant flags:
902+
errmsg = ' '
903+
errflg = 0
904+
840905
call mpas_pool_get_config(configs,'config_do_restart' ,config_do_restart )
841906
call mpas_pool_get_config(configs,'config_frac_seaice' ,config_frac_seaice)
842907
call mpas_pool_get_config(configs,'config_sfclayer_scheme',sfclayer_scheme )
@@ -854,12 +919,12 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite
854919
sfclayer_select: select case (trim(sfclayer_scheme))
855920

856921
case("sf_monin_obukhov")
857-
call mpas_timer_start('Monin-Obukhov')
922+
call mpas_timer_start('sf_monin_obukhov')
858923
call sfclay( &
859924
p3d = pres_hyd_p , psfc = psfc_p , t3d = t_p , &
860925
u3d = u_p , v3d = v_p , qv3d = qv_p , &
861926
dz8w = dz_p , cp = cp , g = gravity , &
862-
rovcp = rcp , R = R_d , xlv = xlv , &
927+
rovcp = rcp , R = R_d , xlv = xlv , &
863928
chs = chs_p , chs2 = chs2_p , cqs2 = cqs2_p , &
864929
cpm = cpm_p , znt = znt_p , ust = ust_p , &
865930
pblh = hpbl_p , mavail = mavail_p , zol = zol_p , &
@@ -912,7 +977,76 @@ subroutine driver_sfclayer(itimestep,configs,mesh,diag_physics,sfc_input,its,ite
912977
its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte &
913978
)
914979
endif
915-
call mpas_timer_stop('Monin-Obukhov')
980+
call mpas_timer_stop('sf_monin_obukhov')
981+
982+
case("sf_monin_obukhov_rev")
983+
call mpas_timer_start('sf_monin_obukhov_rev')
984+
call mpas_log_write('--- enter subroutine sfclayrev:')
985+
call sfclayrev( &
986+
p3d = pres_hyd_p , psfc = psfc_p , t3d = t_p , &
987+
u3d = u_p , v3d = v_p , qv3d = qv_p , &
988+
dz8w = dz_p , cp = cp , g = gravity , &
989+
rovcp = rcp , R = R_d , xlv = xlv , &
990+
chs = chs_p , chs2 = chs2_p , cqs2 = cqs2_p , &
991+
cpm = cpm_p , znt = znt_p , ust = ust_p , &
992+
pblh = hpbl_p , mavail = mavail_p , zol = zol_p , &
993+
mol = mol_p , regime = regime_p , psim = psim_p , &
994+
psih = psih_p , fm = fm_p , fh = fh_p , &
995+
xland = xland_p , hfx = hfx_p , qfx = qfx_p , &
996+
lh = lh_p , tsk = tsk_p , flhc = flhc_p , &
997+
flqc = flqc_p , qgh = qgh_p , qsfc = qsfc_p , &
998+
rmol = rmol_p , u10 = u10_p , v10 = v10_p , &
999+
th2 = th2m_p , t2 = t2m_p , q2 = q2_p , &
1000+
gz1oz0 = gz1oz0_p , wspd = wspd_p , br = br_p , &
1001+
isfflx = isfflx , dx = dx_p , svp1 = svp1 , &
1002+
svp2 = svp2 , svp3 = svp3 , svpt0 = svpt0 , &
1003+
ep1 = ep_1 , ep2 = ep_2 , karman = karman , &
1004+
eomeg = eomeg , stbolt = stbolt , P1000mb = P0 , &
1005+
ustm = ustm_p , ck = ck_p , cka = cka_p , &
1006+
cd = cd_p , cda = cda_p , isftcflx = isftcflx , &
1007+
iz0tlnd = iz0tlnd , shalwater_z0 = shalwater_flag , shalwater_depth = shalwater_depth , &
1008+
water_depth = waterdepth_p , scm_force_flux = scm_force_flux , &
1009+
errmsg = errmsg , errflg = errflg , &
1010+
ids = ids , ide = ide , jds = jds , jde = jde , kds = kds , kde = kde , &
1011+
ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , &
1012+
its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte &
1013+
)
1014+
call mpas_log_write('--- end subroutine sfclayrev:')
1015+
1016+
if(config_frac_seaice) then
1017+
call mpas_log_write('--- enter subroutine sfclayrev seaice:')
1018+
call sfclayrev( &
1019+
p3d = pres_hyd_p , psfc = psfc_p , t3d = t_p , &
1020+
u3d = u_p , v3d = v_p , qv3d = qv_p , &
1021+
dz8w = dz_p , cp = cp , g = gravity , &
1022+
rovcp = rcp , R = R_d , xlv = xlv , &
1023+
chs = chs_sea , chs2 = chs2_sea , cqs2 = cqs2_sea , &
1024+
cpm = cpm_sea , znt = znt_sea , ust = ust_sea , &
1025+
pblh = hpbl_p , mavail = mavail_sea , zol = zol_sea , &
1026+
mol = mol_sea , regime = regime_sea , psim = psim_sea , &
1027+
psih = psih_sea , fm = fm_sea , fh = fh_sea , &
1028+
xland = xland_sea , hfx = hfx_sea , qfx = qfx_sea , &
1029+
lh = lh_sea , tsk = tsk_sea , flhc = flhc_sea , &
1030+
flqc = flqc_sea , qgh = qgh_sea , qsfc = qsfc_sea , &
1031+
rmol = rmol_sea , u10 = u10_sea , v10 = v10_sea , &
1032+
th2 = th2m_sea , t2 = t2m_sea , q2 = q2_sea , &
1033+
gz1oz0 = gz1oz0_sea , wspd = wspd_sea , br = br_sea , &
1034+
isfflx = isfflx , dx = dx_p , svp1 = svp1 , &
1035+
svp2 = svp2 , svp3 = svp3 , svpt0 = svpt0 , &
1036+
ep1 = ep_1 , ep2 = ep_2 , karman = karman , &
1037+
eomeg = eomeg , stbolt = stbolt , P1000mb = P0 , &
1038+
ustm = ustm_sea , ck = ck_sea , cka = cka_sea , &
1039+
cd = cd_sea , cda = cda_sea , isftcflx = isftcflx , &
1040+
iz0tlnd = iz0tlnd , shalwater_z0 = shalwater_flag , shalwater_depth = shalwater_depth , &
1041+
water_depth = waterdepth_p , scm_force_flux = scm_force_flux , &
1042+
errmsg = errmsg , errflg = errflg , &
1043+
ids = ids , ide = ide , jds = jds , jde = jde , kds = kds , kde = kde , &
1044+
ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , &
1045+
its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte &
1046+
)
1047+
call mpas_log_write('--- end subroutine sfclayrev seaice:')
1048+
endif
1049+
call mpas_timer_stop('sf_monin_obukhov_rev')
9161050

9171051
case("sf_mynn")
9181052
call mpas_timer_start('MYNN_sfclay')

src/core_atmosphere/physics/mpas_atmphys_vars.F

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ module mpas_atmphys_vars
116116
! Laura D. Fowler (laura@ucar.edu) / 2022-05-10.
117117
! * added the local parameters flag_bep and idiff in the call to subroutine ysu to update the YSU PBL scheme to
118118
! that of WRF version 4.4.1.
119+
! * added local flags and variables needed to initialize and run the revised version of the MONIN-OBUKHOV surface
120+
! layer scheme from the WRF version 4.4.1.
119121
! Laura D. Fowler (laura@ucar.edu) / 2023-05-15.
120122

121123

@@ -490,6 +492,26 @@ module mpas_atmphys_vars
490492
fh_p, &!integrated stability function for heat [-]
491493
fm_p !integrated stability function for momentum [-]
492494

495+
!... variables and arrays only in the revised version of monin_obukhov (module_sf_sfclayrev.F) to include the
496+
! shallow water roughness scheme:
497+
integer,parameter:: &
498+
bathymetry_flag = 0!this flag is set to 1 if input bathymetry data is available (this option is not available
499+
!in MPAS and therefore set to 0 by default.
500+
integer,parameter:: &
501+
shalwater_flag = 0!this flag is set to 1 to run the shallow water roughness scheme (this option is not
502+
!available in MPAS and therefore set to 0 by default.
503+
integer,parameter:: &
504+
lakemodel_flag = 0!this flag is set to 1 to run the lake model physics (this option is not available in MPAS
505+
!and therefore set to 0 by default.
506+
507+
real(kind=RKIND),parameter:: &
508+
shalwater_depth = 0!constant shallow water depth needed to run the shallow water roughness scheme.
509+
510+
real(kind=RKIND),dimension(:,:),allocatable:: &
511+
waterdepth_p, &!depth of water needed to run the shallow water roughness scheme.
512+
lakedepth_p, &!depth of lakes needed to run the lake model physics.
513+
lakemask_p !mask needed to detect the location of lakes to run the lake model physics.
514+
493515
!... arrays only in mynn surface layer scheme (module_sf_mynn.F):
494516
real(kind=RKIND),dimension(:,:),allocatable:: &
495517
ch_p, &!surface exchange coeff for heat [m/s]

src/core_atmosphere/physics/physics_mmm/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ dummy:
88
OBJS = \
99
bl_gwdo.o \
1010
bl_ysu.o \
11-
cu_ntiedtke.o
11+
cu_ntiedtke.o \
12+
sf_sfclayrev.o
1213

1314
physics_mmm: $(OBJS)
1415
ar -ru ./../libphys.a $(OBJS)

0 commit comments

Comments
 (0)