Skip to content

Commit 5bc4ece

Browse files
committed
Fix user_defined physical constants not updated outside of masterproc
1 parent 8d71300 commit 5bc4ece

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/data/physconst.F90

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,17 @@ subroutine physconst_readnl(nlfile)
205205
newtmelt = user_defined_tmelt /= shr_const_tkfrz .and. user_defined_tmelt /= UNSET_NAMELIST
206206
newomega = user_defined_omega /= shr_const_omega .and. user_defined_omega /= UNSET_NAMELIST
207207

208+
! Populate the new constants into module after mpi_bcast
209+
gravit = user_defined_gravit
210+
sday = user_defined_sday
211+
mwh2o = user_defined_mwh2o
212+
cpwv = user_defined_cpwv
213+
mwdry = user_defined_mwdry
214+
cpair = user_defined_cpair
215+
rearth = user_defined_rearth
216+
tmelt = user_defined_tmelt
217+
omega = user_defined_omega
218+
208219
if (newg .or. newsday .or. newmwh2o .or. newcpwv .or. newmwdry .or. &
209220
newrearth .or. newtmelt .or. newomega) then
210221
if (masterproc) then
@@ -214,52 +225,44 @@ subroutine physconst_readnl(nlfile)
214225
write(iulog, *) bline
215226
write(iulog, *) '*** Physical Constant Old Value New Value ***'
216227
if (newg) then
217-
gravit = user_defined_gravit
218228
field = 'GRAVIT'
219229
write(iulog, 2000) field, shr_const_g, gravit
220230
end if
221231
if (newsday) then
222-
sday = user_defined_sday
223232
field = 'SDAY'
224233
write(iulog, 2000) field, shr_const_sday, sday
225234
end if
226235
if (newmwh2o) then
227-
mwh2o = user_defined_mwh2o
228236
field = 'MWH20'
229237
write(iulog, 2000) field, shr_const_mwwv, mwh2o
230238
end if
231239
if (newcpwv) then
232-
cpwv = user_defined_cpwv
233240
field = 'CPWV'
234241
write(iulog, 2000) field, shr_const_cpwv, cpwv
235242
end if
236243
if (newmwdry) then
237-
mwdry = user_defined_mwdry
238244
field = 'MWDRY'
239245
write(iulog, 2000) field, shr_const_mwdair, mwdry
240246
end if
241247
if (newcpair) then
242-
cpair = user_defined_cpair
243248
field = 'CPAIR'
244249
write(iulog, 2000) field, shr_const_cpdair, cpair
245250
end if
246251
if (newrearth) then
247-
rearth = user_defined_rearth
248252
field = 'REARTH'
249253
write(iulog, 2000) field, shr_const_rearth, rearth
250254
end if
251255
if (newtmelt) then
252-
tmelt = user_defined_tmelt
253256
field = 'TMELT'
254257
write(iulog, 2000) field, shr_const_tkfrz, tmelt
255258
end if
256259
if (newomega) then
257-
omega = user_defined_omega
258260
field = 'OMEGA'
259261
write(iulog, 2000) field, shr_const_omega, omega
260262
end if
261263
write(iulog,*) banner
262264
end if
265+
263266
rga = 1._kind_phys / gravit
264267
rearth_recip = 1._kind_phys / rearth
265268
if (.not. newomega) then

0 commit comments

Comments
 (0)