@@ -263,9 +263,9 @@ subroutine zm_convr( pcols, ncol, pver, pverp, is_first_step, delt, &
263263 !- ---------------------------------------------------------------------------
264264 ! Allocate and/or Initialize microphysics state/tend derived types
265265 if (zm_param% zm_microp) then
266- call zm_microp_st_alloc(loc_microp_st, ncol , pver)
267- call zm_microp_st_ini(loc_microp_st, ncol , pver)
268- call zm_microp_st_ini(microp_st, ncol , pver)
266+ call zm_microp_st_alloc(loc_microp_st, pcols , pver)
267+ call zm_microp_st_ini(loc_microp_st, pcols , pver)
268+ call zm_microp_st_ini(microp_st, pcols , pver)
269269 loc_microp_st% lambdadpcu = (mucon + 1._r8 )/ dcon
270270 loc_microp_st% mudpcu = mucon
271271 end if
@@ -378,7 +378,11 @@ subroutine zm_convr( pcols, ncol, pver, pverp, is_first_step, delt, &
378378 end if
379379 end do
380380
381- if (lengath.eq. 0 ) return
381+ if (lengath.eq. 0 ) then
382+ ! Deallocate local microphysics arrays before returning
383+ if (zm_param% zm_microp) call zm_microp_st_dealloc(loc_microp_st)
384+ return
385+ end if
382386
383387 do ii= 1 ,lengath
384388 ideep(ii)= gather_index(ii)
@@ -475,7 +479,7 @@ subroutine zm_convr( pcols, ncol, pver, pverp, is_first_step, delt, &
475479 !- ---------------------------------------------------------------------------
476480 ! obtain cloud properties.
477481
478- call cldprp(zm_const, pcols, ncol, pver, pverp, &
482+ call cldprp(pcols, ncol, pver, pverp, &
479483 qg ,tg ,ug ,vg ,pg , &
480484 zg ,sg ,mu ,eu ,du , &
481485 md ,ed ,sd ,qd ,mc , &
@@ -487,7 +491,6 @@ subroutine zm_convr( pcols, ncol, pver, pverp, is_first_step, delt, &
487491 landfracg, tpertg, &
488492 aero ,loc_microp_st ) ! < added for ZM micro
489493
490-
491494 !- ---------------------------------------------------------------------------
492495 ! convert detrainment from units of "1/m" to "1/mb".
493496
@@ -508,7 +511,7 @@ subroutine zm_convr( pcols, ncol, pver, pverp, is_first_step, delt, &
508511
509512 !- ---------------------------------------------------------------------------
510513
511- call closure(zm_const, pcols, ncol, pver, pverp, &
514+ call closure(pcols, ncol, pver, pverp, &
512515 qg ,tg ,pg ,zg ,sg , &
513516 tpg ,qs ,qu ,su ,mc , &
514517 du ,mu ,md ,qd ,sd , &
@@ -576,7 +579,7 @@ subroutine zm_convr( pcols, ncol, pver, pverp, is_first_step, delt, &
576579 !- ---------------------------------------------------------------------------
577580 ! compute temperature and moisture changes due to convection.
578581
579- call q1q2_pjr(zm_const, pcols, ncol, pver, pverp, &
582+ call q1q2_pjr(pcols, ncol, pver, pverp, &
580583 dqdt ,dsdt ,qg ,qs ,qu , &
581584 su ,du ,qhat ,shat ,dp , &
582585 mu ,md ,sd ,qd ,qlg , &
@@ -912,7 +915,7 @@ end subroutine zm_conv_evap
912915
913916! ===================================================================================================
914917
915- subroutine cldprp (zm_const , pcols , ncol , pver , pverp , &
918+ subroutine cldprp (pcols , ncol , pver , pverp , &
916919 q ,t ,u ,v ,p , &
917920 z ,s ,mu ,eu ,du , &
918921 md ,ed ,sd ,qd ,mc , &
@@ -951,7 +954,6 @@ subroutine cldprp(zm_const, pcols, ncol, pver, pverp, &
951954!
952955! Input arguments
953956!
954- type (zm_const_t), intent (in ) :: zm_const ! derived type to hold ZM constants
955957 integer , intent (in ) :: pcols ! maximum number of columns
956958 integer , intent (in ) :: ncol ! actual number of columns
957959 integer , intent (in ) :: pver ! number of mid-point vertical levels
@@ -1580,9 +1582,11 @@ subroutine cldprp(zm_const, pcols, ncol, pver, pverp, &
15801582 end do
15811583
15821584#ifndef SCREAM_CONFIG_IS_CMAKE
1583- call zm_mphy( su, qu, mu, du, eu, loc_microp_st% cmel, loc_microp_st% cmei, &
1584- zf, p, t, q, eps0, jb, jt, jlcl, msg, il2g, &
1585- zm_const% grav, zm_const% cpair, zm_const% rdair, aero, gamhat, &
1585+ call zm_mphy( pcols, il2g, msg, &
1586+ zm_const% grav, zm_const% cpair, zm_const% rdair, &
1587+ zm_param% auto_fac, zm_param% accr_fac, zm_param% micro_dcs, &
1588+ jb, jt, jlcl, su, qu, mu, du, eu, zf, p, t, q, gamhat, eps0, &
1589+ loc_microp_st% cmel, loc_microp_st% cmei, aero, &
15861590 loc_microp_st% qliq, loc_microp_st% qice, loc_microp_st% qnl, loc_microp_st% qni, &
15871591 loc_microp_st% qcde, loc_microp_st% qide, loc_microp_st% ncde, loc_microp_st% nide, &
15881592 rprd, loc_microp_st% sprd, tmp_frz, loc_microp_st% wu, &
@@ -1604,8 +1608,7 @@ subroutine cldprp(zm_const, pcols, ncol, pver, pverp, &
16041608 loc_microp_st% accsirn, loc_microp_st% accgln, loc_microp_st% accgrn, loc_microp_st% accilm, &
16051609 loc_microp_st% acciln, loc_microp_st% fallrm, loc_microp_st% fallsm, loc_microp_st% fallgm, &
16061610 loc_microp_st% fallrn, loc_microp_st% fallsn, loc_microp_st% fallgn, loc_microp_st% fhmrm, &
1607- loc_microp_st% dsfm, loc_microp_st% dsfn, &
1608- zm_param% auto_fac, zm_param% accr_fac, zm_param% micro_dcs)
1611+ loc_microp_st% dsfm, loc_microp_st% dsfn )
16091612#endif
16101613
16111614 do k = pver,msg + 2 ,- 1
@@ -1863,7 +1866,7 @@ end subroutine cldprp
18631866
18641867! ===================================================================================================
18651868
1866- subroutine closure (zm_const , pcols , ncol , pver , pverp , &
1869+ subroutine closure (pcols , ncol , pver , pverp , &
18671870 q ,t ,p ,z ,s , &
18681871 tp ,qs ,qu ,su ,mc , &
18691872 du ,mu ,md ,qd ,sd , &
@@ -1895,7 +1898,6 @@ subroutine closure(zm_const, pcols, ncol, pver, pverp, &
18951898!
18961899!- ----------------------------Arguments---------------------------------
18971900!
1898- type (zm_const_t), intent (in ) :: zm_const ! derived type to hold ZM constants
18991901 integer , intent (in ) :: pcols ! maximum number of columns
19001902 integer , intent (in ) :: ncol ! actual number of columns
19011903 integer , intent (in ) :: pver ! number of mid-point vertical levels
@@ -2078,7 +2080,7 @@ end subroutine closure
20782080
20792081! ===================================================================================================
20802082
2081- subroutine q1q2_pjr (zm_const , pcols , ncol , pver , pverp , &
2083+ subroutine q1q2_pjr (pcols , ncol , pver , pverp , &
20822084 dqdt ,dsdt ,q ,qs ,qu , &
20832085 su ,du ,qhat ,shat ,dp , &
20842086 mu ,md ,sd ,qd ,ql , &
@@ -2091,7 +2093,6 @@ subroutine q1q2_pjr(zm_const, pcols, ncol, pver, pverp, &
20912093 implicit none
20922094 !- ---------------------------------------------------------------------------
20932095 ! Arguments
2094- type (zm_const_t), intent (in ) :: zm_const ! derived type to hold ZM constants
20952096 integer , intent (in ) :: pcols ! maximum number of columns
20962097 integer , intent (in ) :: ncol ! actual number of columns
20972098 integer , intent (in ) :: pver ! number of mid-point vertical levels
0 commit comments