Skip to content

Commit beaf411

Browse files
Merge branch 'whannah/eam/zm-bridge-02' into next (PR #7791)
ZM Bridge - Enable Running on GPUs The motivation for these changes was to enable GPU tests with EAMxx running the bridged ZM. However, the major clean-up of the ZM subroutine interfaces that facilitated this also led to more sprawling changes. In particular, many changes to the ZM microphysics routines were helpful in decoupling this capability from the primary ZM routines. Other notable changes remove support for the Hack convective adjustment scheme (not used since CAM3) fix SHOC set_grids() to prevent the variable phis from using packs A non-BFB change was introduced via the loop structure of zm_microphysics_history_convert() that corrects a previous issue in which two variable modifications could occur in the wrong order depending on conditions. This situation does not seem to occur in our normal testing (i.e. atm_developer) - but a longer 1-month test on the ne4pg2 grid with monthly output was able to show an impact. The non-BFB change only affects a few history output variables associated with the ZM microphysics, so the simulation itself is still BFB. The change can be easily reverted by fusing the two k loops in the aforementioned subroutine. [BFB] (sort of... see # 3 above) * whannah/eam/zm-bridge-02: (27 commits) add constexpr to fix build error bug fix for run-time issue in EAM fixes to restor BFB for EAM tests e remove team_policy move call for zm_microphysics_history_convert bug fix updates from PR review unod packed type for phis in SHOC add temporary explicit transpose/copy method for ZM bridge major updates for GPU support interim update to facilitate rebase update ZM bridge to output temperature tendency remove GPU clause for building zm enable host mirroring of ZM variables zm bridge - fix ol_snow and output initialization remove pcols from ZM fortran bridge move MCSP output to zm_conv_mcsp_hist move aero/micro to end of arg list move mudpcu and lambdadpcu to microp_st move frz argument to microp_st ...
2 parents 10a4263 + 0ac1476 commit beaf411

21 files changed

+2404
-2643
lines changed

components/eam/src/physics/cam/convect_shallow.F90

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ module convect_shallow
3232
convect_shallow_use_shfrc !
3333

3434
! The following namelist variable controls which shallow convection package is used.
35-
! 'Hack' = Hack shallow convection (default)
3635
! 'UW' = UW shallow convection by Sungsu Park and Christopher S. Bretherton
3736
! 'off' = No shallow convection
3837

@@ -134,7 +133,6 @@ subroutine convect_shallow_init(pref_edge, pbuf2d)
134133

135134
use cam_history, only : addfld, horiz_only, add_default
136135
use ppgrid, only : pcols, pver
137-
use hk_conv, only : mfinti
138136
use uwshcu, only : init_uwshcu
139137
use physconst, only : rair, gravit, latvap, rhoh2o, zvir, &
140138
cappa, latice, mwdry, mwh2o
@@ -196,14 +194,6 @@ subroutine convect_shallow_init(pref_edge, pbuf2d)
196194
'Cloud ice tendency - shallow convection' )
197195
call addfld( 'CMFDQR' , (/ 'lev' /) , 'A' , 'kg/kg/s', &
198196
'Q tendency - shallow convection rainout' )
199-
call addfld( 'EVAPTCM' , (/ 'lev' /) , 'A' , 'K/s', &
200-
'T tendency - Evaporation/snow prod from Hack convection' )
201-
call addfld( 'FZSNTCM' , (/ 'lev' /) , 'A' , 'K/s', &
202-
'T tendency - Rain to snow conversion from Hack convection' )
203-
call addfld( 'EVSNTCM' , (/ 'lev' /) , 'A' , 'K/s', &
204-
'T tendency - Snow to rain prod from Hack convection' )
205-
call addfld( 'EVAPQCM' , (/ 'lev' /) , 'A' , 'kg/kg/s', &
206-
'Q tendency - Evaporation from Hack convection' )
207197
call addfld( 'QC' , (/ 'lev' /) , 'A' , 'kg/kg/s', &
208198
'Q tendency - shallow convection LW export' )
209199
call addfld( 'PRECSH' , horiz_only, 'A' , 'm/s', &
@@ -229,17 +219,6 @@ subroutine convect_shallow_init(pref_edge, pbuf2d)
229219

230220
call addfld( 'FREQSH' , horiz_only , 'A' , 'fraction', &
231221
'Fractional occurance of shallow convection' )
232-
233-
call addfld( 'HKFLXPRC' , (/ 'ilev' /), 'A' , 'kg/m2/s', &
234-
'Flux of precipitation from HK convection' )
235-
call addfld( 'HKFLXSNW' , (/ 'ilev' /), 'A' , 'kg/m2/s', &
236-
'Flux of snow from HK convection' )
237-
call addfld( 'HKNTPRPD' , (/ 'lev' /) , 'A' , 'kg/kg/s', &
238-
'Net precipitation production from HK convection' )
239-
call addfld( 'HKNTSNPD' , (/ 'lev' /) , 'A' , 'kg/kg/s', &
240-
'Net snow production from HK convection' )
241-
call addfld( 'HKEIHEAT' , (/ 'lev' /) , 'A' , 'W/kg' , &
242-
'Heating by ice and evaporation in HK convection' )
243222

244223
call addfld ('ICWMRSH' , (/ 'lev' /), 'A' , 'kg/kg', &
245224
'Shallow Convection in-cloud water mixing ratio ' )
@@ -279,32 +258,6 @@ subroutine convect_shallow_init(pref_edge, pbuf2d)
279258
if( masterproc ) write(iulog,*) 'convect_shallow_init: shallow convection OFF'
280259
continue
281260

282-
case('Hack') ! Hack scheme
283-
284-
qpert_idx = pbuf_get_index('qpert')
285-
286-
if( masterproc ) write(iulog,*) 'convect_shallow_init: Hack shallow convection'
287-
! Limit shallow convection to regions below 40 mb
288-
! Note this calculation is repeated in the deep convection interface
289-
if( pref_edge(1) >= 4.e3_r8 ) then
290-
limcnv = 1
291-
else
292-
do k = 1, plev
293-
if( pref_edge(k) < 4.e3_r8 .and. pref_edge(k+1) >= 4.e3_r8 ) then
294-
limcnv = k
295-
goto 10
296-
end if
297-
end do
298-
limcnv = plevp
299-
end if
300-
10 continue
301-
302-
if( masterproc ) then
303-
write(iulog,*) 'MFINTI: Convection will be capped at intfc ', limcnv, ' which is ', pref_edge(limcnv), ' pascals'
304-
end if
305-
306-
call mfinti( rair, cpair, gravit, latvap, rhoh2o, limcnv) ! Get args from inti.F90
307-
308261
case('UW') ! Park and Bretherton shallow convection scheme
309262

310263
if( masterproc ) write(iulog,*) 'convect_shallow_init: UW shallow convection scheme (McCaa)'
@@ -413,7 +366,6 @@ subroutine convect_shallow_tend( ztodt , cmfmc , cmfmc2 , &
413366
use camsrfexch, only : cam_in_t
414367

415368
use constituents, only : pcnst, cnst_get_ind, cnst_get_type_byind
416-
use hk_conv, only : cmfmca
417369
use uwshcu, only : compute_uwshcu_inv
418370

419371
use time_manager, only : get_nstep, is_first_step
@@ -608,22 +560,6 @@ subroutine convect_shallow_tend( ztodt , cmfmc , cmfmc2 , &
608560
flxprec(:ncol,:) = 0._r8
609561
flxsnow(:ncol,:) = 0._r8
610562

611-
case('Hack') ! Hack scheme
612-
613-
lq(:) = .TRUE.
614-
call physics_ptend_init( ptend_loc, state%psetcols, 'cmfmca', ls=.true., lq=lq ) ! Initialize local ptend type
615-
616-
call pbuf_get_field(pbuf, qpert_idx, qpert)
617-
qpert(:ncol,2:pcnst) = 0._r8
618-
619-
call cmfmca( lchnk , ncol , &
620-
nstep , ztodt , state%pmid , state%pdel , &
621-
state%rpdel , state%zm , tpert , qpert , state%phis , &
622-
pblh , state%t , state%q , ptend_loc%s , ptend_loc%q , &
623-
cmfmc2 , rprdsh , cmfsl , cmflq , precc , &
624-
qc2 , cnt2 , cnb2 , icwmr , rliq2 , &
625-
state%pmiddry, state%pdeldry, state%rpdeldry )
626-
627563
case('UW') ! UW shallow convection scheme
628564

629565
! -------------------------------------- !
@@ -883,74 +819,6 @@ subroutine convect_shallow_tend( ztodt , cmfmc , cmfmc2 , &
883819
! NOT perform below 'zm_conv_evap'. !
884820
! ------------------------------------------------------------------------ !
885821

886-
if( shallow_scheme .eq. 'Hack' ) then
887-
888-
! ------------------------------------------------------------------------------- !
889-
! Determine the phase of the precipitation produced and add latent heat of fusion !
890-
! Evaporate some of the precip directly into the environment (Sundqvist) !
891-
! Allow this to use the updated state1 and a fresh ptend_loc type !
892-
! Heating and specific humidity tendencies produced !
893-
! ------------------------------------------------------------------------------- !
894-
895-
! --------------------------------- !
896-
! initialize ptend for next process !
897-
! --------------------------------- !
898-
899-
lq(1) = .TRUE.
900-
lq(2:) = .FALSE.
901-
call physics_ptend_init(ptend_loc, state1%psetcols, 'shallow_hack', ls=.true., lq=lq)
902-
903-
call pbuf_get_field(pbuf, sh_flxprc_idx, flxprec )
904-
call pbuf_get_field(pbuf, sh_flxsnw_idx, flxsnow )
905-
call pbuf_get_field(pbuf, sh_cldliq_idx, sh_cldliq )
906-
call pbuf_get_field(pbuf, sh_cldice_idx, sh_cldice )
907-
908-
sprd = 0._r8
909-
910-
!! clouds have no water... :)
911-
sh_cldliq(:ncol,:) = 0._r8
912-
sh_cldice(:ncol,:) = 0._r8
913-
914-
call zm_conv_evap( state1%ncol, state1%lchnk, &
915-
state1%t, state1%pmid, state1%pdel, state1%q(:pcols,:pver,1), &
916-
ptend_loc%s, tend_s_snwprd, tend_s_snwevmlt, &
917-
ptend_loc%q(:pcols,:pver,1), &
918-
rprdsh, cld, ztodt, &
919-
precc, snow, ntprprd, ntsnprd , flxprec, flxsnow, sprd, .true.)
920-
921-
! ------------------------------------------ !
922-
! record history variables from zm_conv_evap !
923-
! ------------------------------------------ !
924-
925-
evapcsh(:ncol,:pver) = ptend_loc%q(:ncol,:pver,1)
926-
927-
ftem(:ncol,:pver) = ptend_loc%s(:ncol,:pver) / cpair
928-
call outfld( 'EVAPTCM ' , ftem , pcols, lchnk )
929-
ftem(:ncol,:pver) = tend_s_snwprd(:ncol,:pver) / cpair
930-
call outfld( 'FZSNTCM ' , ftem , pcols, lchnk )
931-
ftem(:ncol,:pver) = tend_s_snwevmlt(:ncol,:pver) / cpair
932-
call outfld( 'EVSNTCM ' , ftem , pcols, lchnk )
933-
call outfld( 'EVAPQCM ' , ptend_loc%q(1,1,1) , pcols, lchnk )
934-
call outfld( 'PRECSH ' , precc , pcols, lchnk )
935-
call outfld( 'HKFLXPRC' , flxprec , pcols, lchnk )
936-
call outfld( 'HKFLXSNW' , flxsnow , pcols, lchnk )
937-
call outfld( 'HKNTPRPD' , ntprprd , pcols, lchnk )
938-
call outfld( 'HKNTSNPD' , ntsnprd , pcols, lchnk )
939-
call outfld( 'HKEIHEAT' , ptend_loc%s , pcols, lchnk )
940-
941-
! ---------------------------------------------------------------- !
942-
! Add tendency from this process to tend from other processes here !
943-
! ---------------------------------------------------------------- !
944-
945-
call physics_ptend_sum( ptend_loc, ptend_all, ncol )
946-
call physics_ptend_dealloc(ptend_loc)
947-
948-
! -------------------------------------------- !
949-
! Do not perform evaporation process for UW-Cu !
950-
! -------------------------------------------- !
951-
952-
end if
953-
954822
! ------------------------------------------------------------- !
955823
! Update name of parameterization tendencies to send to tphysbc !
956824
! ------------------------------------------------------------- !

components/eam/src/physics/cam/macrop_driver.F90

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,14 @@ subroutine macrop_driver_init(pbuf2d)
329329
CC_ni_idx = pbuf_get_index('CC_ni')
330330
CC_qlst_idx = pbuf_get_index('CC_qlst')
331331

332-
dlfzm_idx = pbuf_get_index('DLFZM')
333-
difzm_idx = pbuf_get_index('DIFZM')
334-
dsfzm_idx = pbuf_get_index('DSFZM', err)
335-
dnlfzm_idx = pbuf_get_index('DNLFZM', err)
336-
dnifzm_idx = pbuf_get_index('DNIFZM', err)
337-
dnsfzm_idx = pbuf_get_index('DNSFZM', err)
332+
if (zm_param%zm_microp) then
333+
dlfzm_idx = pbuf_get_index('DLFZM')
334+
difzm_idx = pbuf_get_index('DIFZM')
335+
dsfzm_idx = pbuf_get_index('DSFZM', err)
336+
dnlfzm_idx = pbuf_get_index('DNLFZM', err)
337+
dnifzm_idx = pbuf_get_index('DNIFZM', err)
338+
dnsfzm_idx = pbuf_get_index('DNSFZM', err)
339+
end if
338340

339341
if (micro_do_icesupersat) then
340342
naai_idx = pbuf_get_index('NAAI')

0 commit comments

Comments
 (0)