Skip to content

Commit 3e447db

Browse files
Fixed a bug introduced in WRF v4.3 that affects chem_opts = 201 (MOZART_MOSAIC_4BIN_KPP) and 202 (MOZART_MOSAIC_4BIN_AQ_KPP). (wrf-model#1813)
Fixed a bug for chem_opt = 201, 202. TYPE: bug fix KEYWORDS: MOZART_MOSAIC_4BIN, mozart_pH_diag, bug fix SOURCE: Internal DESCRIPTION OF CHANGES: Problem: Users will experience a stalled simulation upon writing history files. This was caused by the pH diagnostics added in v4.3 (wrf-model#1342) not being activated with the namelist option mozart_ph_diag = 1. Solution: Add as optional arguments only filled if the namelist is activated. LIST OF MODIFIED FILES: list of changed files (use git diff --name-status master to get formatted list) M chem/aerosol_driver.F M chem/cloudchem_driver.F M chem/module_mosaic_cloudchem.F M chem/module_mosaic_driver.F M chem/module_mosaic_therm.F TESTS CONDUCTED: Yes, the fix remedies the problem. The Jenkins tests have passed. RELEASE NOTE: This PR addresses a bug introduced in WRF v4.3 that affects users using chem_opts = 201 (MOZART_MOSAIC_4BIN_KPP) and 202 (MOZART_MOSAIC_4BIN_AQ_KPP).
1 parent 1243d08 commit 3e447db

5 files changed

+16
-8
lines changed

chem/aerosol_driver.F

+1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ SUBROUTINE aerosols_driver (id,curr_secs,ktau,dtstep,ktauc, &
195195

196196
! output of aerosol pH from MOSAIC 4-bin
197197
REAL, DIMENSION( ims:ime , kms:kme , jms:jme ) , &
198+
OPTIONAL, &
198199
INTENT(OUT ) :: &
199200
ph_aer01, ph_aer02, ph_aer03, ph_aer04
200201
!

chem/cloudchem_driver.F

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ SUBROUTINE cloudchem_driver( &
171171
INTENT(INOUT ) :: gas_aqfrac
172172

173173
REAL, DIMENSION( ims:ime, kms:kme, jms:jme ), &
174+
OPTIONAL, &
174175
INTENT(OUT) :: ph_cw ! ph_cw - pH of cloud water
175176

176177
! LOCAL VAR

chem/module_mosaic_cloudchem.F

+6-4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ subroutine mosaic_cloudchem_driver( &
108108
! gas_aqfrac - fraction (0-1) of gas that is dissolved in cloud water
109109

110110
real, intent(out), &
111+
OPTIONAL, &
111112
dimension( ims:ime, kms:kme, jms:jme ) :: &
112113
ph_cw
113114

@@ -148,7 +149,7 @@ subroutine mosaic_cloudchem_driver( &
148149
end if
149150
! following line turns aqueous radical chem off unconditionally
150151
iradical_onoff = 0
151-
152+
if ( config_flags%mozart_ph_diag .eq. 1 ) then
152153
! Initialize pH of CW ph_cw to a FillValue value
153154
do jt = jts, jte
154155
do kt = kts, kte
@@ -157,7 +158,7 @@ subroutine mosaic_cloudchem_driver( &
157158
end do
158159
end do
159160
end do
160-
161+
end if
161162
do 3920 jt = jts, jte
162163
do 3910 it = its, ite
163164

@@ -214,9 +215,10 @@ subroutine mosaic_cloudchem_driver( &
214215
num_moist, num_chem, moist, chem, &
215216
t_phy, p_phy, rho_phy )
216217

217-
gas_aqfrac(it,kt,jt,:) = gas_aqfrac_box(:)
218+
gas_aqfrac(it,kt,jt,:) = gas_aqfrac_box(:)
219+
if ( config_flags%mozart_ph_diag .eq. 1 ) then
218220
ph_cw(it,kt,jt) = ph_aq_box
219-
221+
end if
220222
3800 continue
221223

222224
3910 continue

chem/module_mosaic_driver.F

+3-1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ subroutine mosaic_aerchem_driver( &
237237
! (ug/kg for mass species, #/kg for number species)
238238

239239
real, intent(out), &
240+
optional, &
240241
dimension( ims:ime, kms:kme, jms:jme ) :: &
241242
ph_aer01, ph_aer02, ph_aer03, ph_aer04
242243

@@ -456,7 +457,8 @@ subroutine mosaic_aerchem_driver( &
456457
call aerchemistry( it, jt, kclm_calcbgn, kclm_calcend, &
457458
dtchem, idiagaa_dum, vbs_nbin, &
458459
ph_aer01(it,kms:kme,jt), ph_aer02(it,kms:kme,jt), &
459-
ph_aer03(it,kms:kme,jt), ph_aer04(it,kms:kme,jt), kms,kme )
460+
ph_aer03(it,kms:kme,jt), ph_aer04(it,kms:kme,jt), &
461+
kms,kme,config_flags%mozart_ph_diag )
460462

461463
! note units for aerosol is now ug/m3
462464

chem/module_mosaic_therm.F

+5-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module module_mosaic_therm
9292
!-----------------------------------------------------------------------
9393
subroutine aerchemistry( iclm, jclm, kclm_calcbgn, kclm_calcend, &
9494
dtchem_sngl, idiagaa,vbs_nbin, &
95-
ph_aer1, ph_aer2, ph_aer3, ph_aer4,kms,kme )
95+
ph_aer1, ph_aer2, ph_aer3, ph_aer4,kms,kme,do_ph )
9696

9797
use module_data_mosaic_asect
9898
use module_data_mosaic_other
@@ -107,7 +107,8 @@ subroutine aerchemistry( iclm, jclm, kclm_calcbgn, kclm_calcend, &
107107
integer iclm, jclm, kclm_calcbgn, kclm_calcend, idiagaa,vbs_nbin(1)
108108
real dtchem_sngl
109109
integer kms, kme
110-
real, intent(out), dimension(kms:kme) :: &
110+
integer, intent(in) :: do_ph
111+
real, optional, intent(out), dimension(kms:kme) :: &
111112
ph_aer1, ph_aer2, ph_aer3, ph_aer4 ! pH of the aerosols
112113
! local variables
113114
real(kind=8) :: dtchem
@@ -157,11 +158,12 @@ subroutine aerchemistry( iclm, jclm, kclm_calcbgn, kclm_calcend, &
157158
call specialoutaa( iclm, jclm, k, m, 'befor_movesect' )
158159
call move_sections( 1, iclm, jclm, k, m)
159160
call specialoutaa( iclm, jclm, k, m, 'after_movesect' )
160-
161+
if ( do_ph .eq. 1 ) then
161162
ph_aer1(k) = mc(1,1)
162163
ph_aer2(k) = mc(1,2)
163164
ph_aer3(k) = mc(1,3)
164165
ph_aer4(k) = mc(1,4)
166+
end if
165167

166168
100 continue ! k levels
167169

0 commit comments

Comments
 (0)