Skip to content

Commit

Permalink
Makes mp_zero_out affect only the 'moist' array. New separate flags …
Browse files Browse the repository at this point in the history
…for scalar/chem/tracer (#2010)

TYPE:  bug fix

KEYWORDS: mp_zero_out

SOURCE: Ted Mansell (NOAA)

DESCRIPTION OF CHANGES:
This fixes the side-effect of mp_zero_out being applied not only to the moist array, but also to the scalar/chem/tracer arrays using the same threshold. This behavior would be unexpected from the documentation (readme) which indicated that only mixing ratios were affected.  This PR restricts mp_zero_out to the moist array and adds a separate mp_zero_out_all flag to apply it to all the arrays in the off chance that somebody needs to replicate the previous behavior.

ISSUE: Addresses #2007

LIST OF MODIFIED FILES: 
M  Registry/Registry.EM_COMMON 
M  dyn_em/solve_em.F 
M  run/README.namelist
M  wrftladj/solve_em_ad.F
M  wrftladj/solve_em_tl.F

TESTS CONDUCTED: 
The Jenkins tests have passed.

RELEASE NOTE: The behavior of the  mp_zero_out flag was changed affect only the 'moist' array, whereas previously it also caused the scalar/chem/tracer arrays to also be set to zero for values below threshold. Now there is a separate flag (mp_zero_out_all) if one wishes to reproduce the old behavior.
  • Loading branch information
MicroTed committed Feb 28, 2024
1 parent e2da0f6 commit e1ebb10
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions Registry/Registry.EM_COMMON
Original file line number Diff line number Diff line change
Expand Up @@ -2551,6 +2551,7 @@ rconfig logical slucm_distributed_drag namelist,physics 1 .fals
rconfig integer distributed_ahe_opt namelist,physics 1 0 rh "distributed_ahe_opt" "AHE handling: 0= no AHE, 1=add to first level temperature tendency, 2=add to surface sensible heat flux" ""
rconfig integer num_soil_cat namelist,physics 1 16 - "num_soil_cat" "" ""
rconfig integer mp_zero_out namelist,physics 1 0 - "mp_zero_out" "microphysics fields set to zero 0=no action taken, 1=all fields but Qv, 2=all fields including Qv" "flag"
rconfig integer mp_zero_out_all namelist,physics 1 0 - "mp_zero_out_all" "1= if mp_zero_out>0, then reproduce old behavior of also applying to scalar/chem/tracer" "flag"
rconfig real mp_zero_out_thresh namelist,physics 1 1.e-8 - "mp_zero_out_thresh" "minimum threshold for non-Qv moist fields, below are set to zero" "kg/kg"
rconfig real seaice_threshold namelist,physics 1 100 h "seaice_threshold" "tsk below which which water points are set to sea ice for slab scheme" "K"
rconfig logical bmj_rad_feedback namelist,physics max_domains .false. - "if true include radiative effects of bmj clouds" ""
Expand Down
10 changes: 9 additions & 1 deletion dyn_em/solve_em.F
Original file line number Diff line number Diff line change
Expand Up @@ -4006,13 +4006,15 @@ END SUBROUTINE CMAQ_DRIVER
jts = max(grid%j_start(ij),jds)
jte = min(grid%j_end(ij),jde-1)
IF ( config_flags%mp_zero_out > 0 ) THEN
CALL microphysics_zero_outb ( &
moist , num_moist , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
IF ( config_flags%mp_zero_out_all > 0 ) THEN
CALL microphysics_zero_outb ( &
scalar , num_scalar , config_flags , &
ids, ide, jds, jde, kds, kde, &
Expand All @@ -4021,7 +4023,7 @@ END SUBROUTINE CMAQ_DRIVER
k_start , k_end )
CALL microphysics_zero_outb ( &
chem , num_chem , config_flags , &
chem , num_chem , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
Expand All @@ -4032,6 +4034,8 @@ END SUBROUTINE CMAQ_DRIVER
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
ENDIF
ENDIF
IF ( config_flags%periodic_x ) THEN
its = max(grid%i_start(ij),ids)
Expand All @@ -4043,13 +4047,15 @@ END SUBROUTINE CMAQ_DRIVER
jts = max(grid%j_start(ij),jds+sz)
jte = min(grid%j_end(ij),jde-1-sz)
IF ( config_flags%mp_zero_out > 0 ) THEN
CALL microphysics_zero_outa ( &
moist , num_moist , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
IF ( config_flags%mp_zero_out_all > 0 ) THEN
CALL microphysics_zero_outa ( &
scalar , num_scalar , config_flags , &
ids, ide, jds, jde, kds, kde, &
Expand All @@ -4070,6 +4076,8 @@ END SUBROUTINE CMAQ_DRIVER
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
ENDIF
ENDIF
CALL moist_physics_finish_em( grid%t_2, grid%t_1, t0, grid%muts, th_phy, &
grid%h_diabatic, dtm, &
Expand Down
6 changes: 4 additions & 2 deletions run/README.namelist
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,13 @@ Namelist variables for controlling the adaptive time step option:

mp_zero_out = 0, ! no action taken, no adjustment to any moist field
= 1, ! except for Qv, all other moist arrays are set to zero
if they fall below a critical value
if they fall below a critical value ('moist' array only)
= 2, ! Qv is .GE. 0, all other moist arrays are set to zero
if they fall below a critical value
if they fall below a critical value ('moist' array only)
mp_zero_out_thresh = 1.e-8 ! critical value for moist array threshold, below which
moist arrays (except for Qv) are set to zero (kg/kg)
mp_zero_out_all = 0, ! if =1 and mp_zero_out>0, then reproduce old behavior and
apply threshold to scalar, chem, and tracer arrays

gsfcgce_hail = 0 ! for running gsfcgce microphysics with graupel
= 1 ! for running gsfcgce microphysics with hail
Expand Down
8 changes: 8 additions & 0 deletions wrftladj/solve_em_ad.F
Original file line number Diff line number Diff line change
Expand Up @@ -4015,13 +4015,15 @@ SUBROUTINE solve_em_ad ( grid , config_flags &
jts = max(grid%j_start(ij),jds)
jte = min(grid%j_end(ij),jde-1)
IF ( config_flags%mp_zero_out > 0 ) THEN
CALL microphysics_zero_outb ( &
moist , num_moist , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
IF ( config_flags%mp_zero_out_all > 0 ) THEN
CALL microphysics_zero_outb ( &
scalar , num_scalar , config_flags , &
ids, ide, jds, jde, kds, kde, &
Expand All @@ -4042,6 +4044,8 @@ SUBROUTINE solve_em_ad ( grid , config_flags &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
ENDIF
ENDIF
IF ( config_flags%periodic_x ) THEN
its = max(grid%i_start(ij),ids)
Expand All @@ -4054,13 +4058,15 @@ SUBROUTINE solve_em_ad ( grid , config_flags &
jte = min(grid%j_end(ij),jde-1-sz)
CALL PUSHREAL8ARRAY ( moist, (ime-ims+1)*(kme-kms+1)*(jme-jms+1)*num_moist )
IF ( config_flags%mp_zero_out > 0 ) THEN
CALL microphysics_zero_outa ( &
moist , num_moist , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
IF ( config_flags%mp_zero_out_all > 0 ) THEN
CALL microphysics_zero_outa ( &
scalar , num_scalar , config_flags , &
ids, ide, jds, jde, kds, kde, &
Expand All @@ -4081,6 +4087,8 @@ SUBROUTINE solve_em_ad ( grid , config_flags &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
ENDIF
ENDIF
CALL PUSHREAL8ARRAY ( grid%t_2, (ime-ims+1)*(kme-kms+1)*(jme-jms+1) )
CALL PUSHREAL8ARRAY ( grid%h_diabatic, (ime-ims+1)*(kme-kms+1)*(jme-jms+1) )
Expand Down
8 changes: 8 additions & 0 deletions wrftladj/solve_em_tl.F
Original file line number Diff line number Diff line change
Expand Up @@ -3654,13 +3654,15 @@ SUBROUTINE solve_em_tl ( grid , config_flags &
jts = max(grid%j_start(ij),jds)
jte = min(grid%j_end(ij),jde-1)

IF ( config_flags%mp_zero_out > 0 ) THEN
CALL g_microphysics_zero_outb ( &
moist , g_moist, num_moist , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )

IF ( config_flags%mp_zero_out_all > 0 ) THEN
CALL g_microphysics_zero_outb ( &
scalar , g_scalar, num_scalar , config_flags , &
ids, ide, jds, jde, kds, kde, &
Expand All @@ -3682,6 +3684,8 @@ SUBROUTINE solve_em_tl ( grid , config_flags &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
ENDIF
ENDIF

IF ( config_flags%periodic_x ) THEN
its = max(grid%i_start(ij),ids)
Expand All @@ -3693,13 +3697,15 @@ SUBROUTINE solve_em_tl ( grid , config_flags &
jts = max(grid%j_start(ij),jds+sz)
jte = min(grid%j_end(ij),jde-1-sz)

IF ( config_flags%mp_zero_out > 0 ) THEN
CALL g_microphysics_zero_outa ( &
moist , g_moist, num_moist , config_flags , &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )

IF ( config_flags%mp_zero_out_all > 0 ) THEN
CALL g_microphysics_zero_outa ( &
scalar ,g_scalar, num_scalar , config_flags , &
ids, ide, jds, jde, kds, kde, &
Expand All @@ -3721,6 +3727,8 @@ SUBROUTINE solve_em_tl ( grid , config_flags &
ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, &
k_start , k_end )
ENDIF
ENDIF

CALL g_moist_physics_finish_em( grid%t_2, grid%g_t_2, grid%t_1, &
t0, grid%muts, &
Expand Down

0 comments on commit e1ebb10

Please sign in to comment.