From 5bc4ecee319e90bfaf05de1b98724b854b1bcf89 Mon Sep 17 00:00:00 2001 From: Haipeng Lin Date: Mon, 26 Aug 2024 11:29:12 -0400 Subject: [PATCH] Fix user_defined physical constants not updated outside of masterproc --- src/data/physconst.F90 | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/data/physconst.F90 b/src/data/physconst.F90 index 1c424e0d..d681fb0f 100644 --- a/src/data/physconst.F90 +++ b/src/data/physconst.F90 @@ -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 @@ -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