From 581f5a6b7675e142a1c7f8f8d1d22e8a6164cad1 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Sat, 26 Jun 2021 13:13:05 -0600 Subject: [PATCH 1/2] Bugfix in Thompson MP, pass correct timestep to core routine --- physics/mp_thompson.F90 | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 57505429f..1eb2506ae 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -468,6 +468,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & !> - Also, hydrometeor variables are mass or number mixing ratio !> - either kg of species per kg of dry air, or per kg of (dry + vapor). +#if 0 + if (istep==1) then +#endif ! DH* - do this only if istep == 1? Would be ok if it was ! guaranteed that nothing else in the same subcycle group ! was using these arrays, but it is somewhat dangerous. @@ -489,6 +492,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if end if ! *DH +#if 0 + endif +#endif !> - Density of air in kg m-3 rho = con_eps*prsl/(con_rd*tgrs*(qv+con_eps)) @@ -566,7 +572,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & if (do_effective_radii) then call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & nc=nc, nwfa=nwfa, nifa=nifa, nwfa2d=nwfa2d, nifa2d=nifa2d, & - tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtp, dt_inner=dt_inner, & + tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & rainnc=rain_mp, rainncv=delta_rain_mp, & snownc=snow_mp, snowncv=delta_snow_mp, & icenc=ice_mp, icencv=delta_ice_mp, & @@ -587,7 +593,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & else call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & nc=nc, nwfa=nwfa, nifa=nifa, nwfa2d=nwfa2d, nifa2d=nifa2d, & - tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtp, dt_inner=dt_inner, & + tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & rainnc=rain_mp, rainncv=delta_rain_mp, & snownc=snow_mp, snowncv=delta_snow_mp, & icenc=ice_mp, icencv=delta_ice_mp, & @@ -608,7 +614,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & else if (do_effective_radii) then call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & - tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtp, dt_inner=dt_inner, & + tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & rainnc=rain_mp, rainncv=delta_rain_mp, & snownc=snow_mp, snowncv=delta_snow_mp, & icenc=ice_mp, icencv=delta_ice_mp, & @@ -628,7 +634,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & first_time_step=first_time_step, errmsg=errmsg, errflg=errflg) else call mp_gt_driver(qv=qv, qc=qc, qr=qr, qi=qi, qs=qs, qg=qg, ni=ni, nr=nr, & - tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtp, dt_inner=dt_inner, & + tt=tgrs, p=prsl, w=w, dz=dz, dt_in=dtstep, dt_inner=dt_inner, & rainnc=rain_mp, rainncv=delta_rain_mp, & snownc=snow_mp, snowncv=delta_snow_mp, & icenc=ice_mp, icencv=delta_ice_mp, & @@ -653,6 +659,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ! guaranteed that nothing else in the same subcycle group ! was using these arrays, but it is somewhat dangerous. +#if 0 + if(istep==nsteps) then +#endif !> - Convert water vapor mixing ratio back to specific humidity spechum = qv/(1.0_kind_phys+qv) @@ -672,7 +681,9 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if end if ! *DH - +#if 0 + endif +#endif !> - Convert rainfall deltas from mm to m (on physics timestep); add to inout variables ! "rain" in Thompson MP refers to precipitation (total of liquid rainfall+snow+graupel+ice) prcp = prcp + max(0.0, delta_rain_mp/1000.0_kind_phys) From b498507041682c5cbe150f186450db4402d2b196 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 28 Jun 2021 07:10:01 -0600 Subject: [PATCH 2/2] Remove test code from physics/mp_thompson.F90 --- physics/mp_thompson.F90 | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/physics/mp_thompson.F90 b/physics/mp_thompson.F90 index 1eb2506ae..2115615d5 100644 --- a/physics/mp_thompson.F90 +++ b/physics/mp_thompson.F90 @@ -468,9 +468,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & !> - Also, hydrometeor variables are mass or number mixing ratio !> - either kg of species per kg of dry air, or per kg of (dry + vapor). -#if 0 - if (istep==1) then -#endif ! DH* - do this only if istep == 1? Would be ok if it was ! guaranteed that nothing else in the same subcycle group ! was using these arrays, but it is somewhat dangerous. @@ -492,9 +489,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if end if ! *DH -#if 0 - endif -#endif !> - Density of air in kg m-3 rho = con_eps*prsl/(con_rd*tgrs*(qv+con_eps)) @@ -659,9 +653,6 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & ! guaranteed that nothing else in the same subcycle group ! was using these arrays, but it is somewhat dangerous. -#if 0 - if(istep==nsteps) then -#endif !> - Convert water vapor mixing ratio back to specific humidity spechum = qv/(1.0_kind_phys+qv) @@ -681,9 +672,7 @@ subroutine mp_thompson_run(ncol, nlev, con_g, con_rd, & end if end if ! *DH -#if 0 - endif -#endif + !> - Convert rainfall deltas from mm to m (on physics timestep); add to inout variables ! "rain" in Thompson MP refers to precipitation (total of liquid rainfall+snow+graupel+ice) prcp = prcp + max(0.0, delta_rain_mp/1000.0_kind_phys)