Skip to content

Commit

Permalink
Fix user_defined physical constants not updated outside of masterproc
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmielin committed Aug 26, 2024
1 parent 8d71300 commit 5bc4ece
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/data/physconst.F90
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ subroutine physconst_readnl(nlfile)
newtmelt = user_defined_tmelt /= shr_const_tkfrz .and. user_defined_tmelt /= UNSET_NAMELIST
newomega = user_defined_omega /= shr_const_omega .and. user_defined_omega /= UNSET_NAMELIST

! Populate the new constants into module after mpi_bcast
gravit = user_defined_gravit
sday = user_defined_sday
mwh2o = user_defined_mwh2o
cpwv = user_defined_cpwv
mwdry = user_defined_mwdry
cpair = user_defined_cpair
rearth = user_defined_rearth
tmelt = user_defined_tmelt
omega = user_defined_omega

if (newg .or. newsday .or. newmwh2o .or. newcpwv .or. newmwdry .or. &
newrearth .or. newtmelt .or. newomega) then
if (masterproc) then
Expand All @@ -214,52 +225,44 @@ subroutine physconst_readnl(nlfile)
write(iulog, *) bline
write(iulog, *) '*** Physical Constant Old Value New Value ***'
if (newg) then
gravit = user_defined_gravit
field = 'GRAVIT'
write(iulog, 2000) field, shr_const_g, gravit
end if
if (newsday) then
sday = user_defined_sday
field = 'SDAY'
write(iulog, 2000) field, shr_const_sday, sday
end if
if (newmwh2o) then
mwh2o = user_defined_mwh2o
field = 'MWH20'
write(iulog, 2000) field, shr_const_mwwv, mwh2o
end if
if (newcpwv) then
cpwv = user_defined_cpwv
field = 'CPWV'
write(iulog, 2000) field, shr_const_cpwv, cpwv
end if
if (newmwdry) then
mwdry = user_defined_mwdry
field = 'MWDRY'
write(iulog, 2000) field, shr_const_mwdair, mwdry
end if
if (newcpair) then
cpair = user_defined_cpair
field = 'CPAIR'
write(iulog, 2000) field, shr_const_cpdair, cpair
end if
if (newrearth) then
rearth = user_defined_rearth
field = 'REARTH'
write(iulog, 2000) field, shr_const_rearth, rearth
end if
if (newtmelt) then
tmelt = user_defined_tmelt
field = 'TMELT'
write(iulog, 2000) field, shr_const_tkfrz, tmelt
end if
if (newomega) then
omega = user_defined_omega
field = 'OMEGA'
write(iulog, 2000) field, shr_const_omega, omega
end if
write(iulog,*) banner
end if

rga = 1._kind_phys / gravit
rearth_recip = 1._kind_phys / rearth
if (.not. newomega) then
Expand Down

0 comments on commit 5bc4ece

Please sign in to comment.