Skip to content

Commit

Permalink
Eliminated the use of GV%mks_g_Earth
Browse files Browse the repository at this point in the history
  Eliminated the use GV%mks_g_Earth throughout the MOM6 code.  This variable is
being retained and is still set to avoid breaking any user code that might be
using it.  All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Apr 20, 2020
1 parent 3a817ef commit 37d30b5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/core/MOM_verticalGrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ subroutine verticalGridInit( param_file, GV, US )
! Read all relevant parameters and write them to the model log.
call log_version(param_file, mdl, version, &
"Parameters providing information about the vertical grid.")
call get_param(param_file, mdl, "G_EARTH", GV%mks_g_Earth, &
call get_param(param_file, mdl, "G_EARTH", GV%g_Earth, &
"The gravitational acceleration of the Earth.", &
units="m s-2", default = 9.80)
units="m s-2", default = 9.80, scale=US%Z_to_m*US%m_s_to_L_T**2)
call get_param(param_file, mdl, "RHO_0", GV%Rho0, &
"The mean ocean density used with BOUSSINESQ true to "//&
"calculate accelerations and the mass for conservation "//&
Expand Down Expand Up @@ -127,7 +127,7 @@ subroutine verticalGridInit( param_file, GV, US )
"units of thickness into m.", units="m H-1", default=1.0)
GV%H_to_m = GV%H_to_m * H_rescale_factor
endif
GV%g_Earth = US%m_to_L**2*US%Z_to_m*US%T_to_s**2 * GV%mks_g_Earth
GV%mks_g_Earth = US%L_T_to_m_s**2*US%m_to_Z * GV%g_Earth
#ifdef STATIC_MEMORY_
! Here NK_ is a macro, while nk is a variable.
call get_param(param_file, mdl, "NK", nk, &
Expand Down Expand Up @@ -156,7 +156,7 @@ subroutine verticalGridInit( param_file, GV, US )
GV%H_to_MKS = GV%H_to_kg_m2
endif
GV%H_subroundoff = 1e-20 * max(GV%Angstrom_H,GV%m_to_H*1e-17)
GV%H_to_Pa = GV%mks_g_Earth * GV%H_to_kg_m2
GV%H_to_Pa = US%L_T_to_m_s**2*US%m_to_Z * GV%g_Earth * GV%H_to_kg_m2

GV%H_to_Z = GV%H_to_m * US%m_to_Z
GV%Z_to_H = US%Z_to_m * GV%m_to_H
Expand Down
16 changes: 8 additions & 8 deletions src/initialization/MOM_coord_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ subroutine set_coord_from_gprime(Rlay, g_prime, GV, US, param_file)

call get_param(param_file, mdl, "GFS" , g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)
call get_param(param_file, mdl, "GINT", g_int, &
"The reduced gravity across internal interfaces.", &
units="m s-2", fail_if_missing=.true., scale=US%m_s_to_L_T**2*US%Z_to_m)
Expand Down Expand Up @@ -176,7 +176,7 @@ subroutine set_coord_from_layer_density(Rlay, g_prime, GV, US, param_file)

call get_param(param_file, mdl, "GFS", g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)
call get_param(param_file, mdl, "LIGHTEST_DENSITY", Rlay_Ref, &
"The reference potential density used for layer 1.", &
units="kg m-3", default=US%R_to_kg_m3*GV%Rho0, scale=US%kg_m3_to_R)
Expand Down Expand Up @@ -228,7 +228,7 @@ subroutine set_coord_from_TS_ref(Rlay, g_prime, GV, US, param_file, eqn_of_state
"The initial salinities.", units="PSU", default=35.0)
call get_param(param_file, mdl, "GFS", g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)
call get_param(param_file, mdl, "GINT", g_int, &
"The reduced gravity across internal interfaces.", &
units="m s-2", fail_if_missing=.true., scale=US%m_s_to_L_T**2*US%Z_to_m)
Expand Down Expand Up @@ -274,7 +274,7 @@ subroutine set_coord_from_TS_profile(Rlay, g_prime, GV, US, param_file, eqn_of_s

call get_param(param_file, mdl, "GFS", g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)
call get_param(param_file, mdl, "COORD_FILE", coord_file, &
"The file from which the coordinate temperatures and "//&
"salinities are read.", fail_if_missing=.true.)
Expand Down Expand Up @@ -355,7 +355,7 @@ subroutine set_coord_from_TS_range(Rlay, g_prime, GV, US, param_file, eqn_of_sta

call get_param(param_file, mdl, "GFS", g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)

k_light = GV%nk_rho_varies + 1

Expand Down Expand Up @@ -402,7 +402,7 @@ subroutine set_coord_from_file(Rlay, g_prime, GV, US, param_file)

call get_param(param_file, mdl, "GFS", g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)
call get_param(param_file, mdl, "INPUTDIR", inputdir, default=".")
inputdir = slasher(inputdir)
call get_param(param_file, mdl, "COORD_FILE", coord_file, &
Expand Down Expand Up @@ -458,7 +458,7 @@ subroutine set_coord_linear(Rlay, g_prime, GV, US, param_file)
units="kg m-3", default=2.0, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "GFS", g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)

! This following sets the target layer densities such that a the
! surface interface has density Rlay_ref and the bottom
Expand Down Expand Up @@ -496,7 +496,7 @@ subroutine set_coord_to_none(Rlay, g_prime, GV, US, param_file)

call get_param(param_file, mdl, "GFS" , g_fs, &
"The reduced gravity at the free surface.", units="m s-2", &
default=GV%mks_g_Earth, scale=US%m_s_to_L_T**2*US%Z_to_m)
default=GV%g_Earth*US%L_T_to_m_s**2*US%m_to_Z, scale=US%m_s_to_L_T**2*US%Z_to_m)

g_prime(1) = g_fs
do k=2,nz ; g_prime(k) = 0. ; enddo
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_CVMix_KPP.F90
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ subroutine KPP_compute_BLD(CS, G, GV, US, h, Temp, Salt, u, v, EOS, uStar, buoyF
#endif

! some constants
GoRho = GV%mks_g_Earth / GV%Rho0
GoRho = US%L_T_to_m_s**2*US%m_to_Z * GV%g_Earth / GV%Rho0
buoy_scale = US%L_to_m**2*US%s_to_T**3

! loop over horizontal points on processor
Expand Down
14 changes: 8 additions & 6 deletions src/user/MOM_wave_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ subroutine get_StokesSL_LiFoxKemper(ustar, hbl, GV, US, UStokes_SL, LA)
!
! peak frequency (PM, Bouws, 1998)
tmp = 2.0 * PI * u19p5_to_u10 * u10
fp = 0.877 * GV%mks_g_Earth / tmp
fp = 0.877 * US%L_T_to_m_s**2*US%m_to_Z * GV%g_Earth / tmp
!
! mean frequency
fm = fm_into_fp * fp
Expand Down Expand Up @@ -1168,23 +1168,25 @@ subroutine DHH85_mid(GV, US, zpt, UStokes)
real :: ann, Bnn, Snn, Cnn, Dnn
real :: omega_peak, omega, u10, WA, domega
real :: omega_min, omega_max, wavespec, Stokes
real :: g_Earth ! Gravitational acceleration [m s-2]
integer :: Nomega, OI

WA = WaveAge
u10 = WaveWind
g_Earth = US%L_T_to_m_s**2*US%m_to_Z * GV%g_Earth

!/
omega_min = 0.1 ! Hz
! Cut off at 30cm for now...
omega_max = 10. ! ~sqrt(0.2*GV%mks_g_Earth*2*pi/0.3)
omega_max = 10. ! ~sqrt(0.2*g_Earth*2*pi/0.3)
NOmega = 1000
domega = (omega_max-omega_min)/real(NOmega)

!
if (WaveAgePeakFreq) then
omega_peak = GV%mks_g_Earth / (WA * u10)
omega_peak = g_Earth / (WA * u10)
else
omega_peak = 2. * pi * 0.13 * GV%mks_g_Earth / U10
omega_peak = 2. * pi * 0.13 * g_Earth / U10
endif
!/
Ann = 0.006 * WaveAge**(-0.55)
Expand All @@ -1200,11 +1202,11 @@ subroutine DHH85_mid(GV, US, zpt, UStokes)
do oi = 1,nomega-1
Dnn = exp ( -0.5 * (omega-omega_peak)**2 / (Snn**2 * omega_peak**2) )
! wavespec units = m2s
wavespec = (Ann * GV%mks_g_Earth**2 / (omega_peak*omega**4 ) ) * &
wavespec = (Ann * g_Earth**2 / (omega_peak*omega**4 ) ) * &
exp(-bnn*(omega_peak/omega)**4)*Cnn**Dnn
! Stokes units m (multiply by frequency range for units of m/s)
Stokes = 2.0 * wavespec * omega**3 * &
exp( 2.0 * omega**2 * US%Z_to_m*zpt / GV%mks_g_Earth) / GV%mks_g_Earth
exp( 2.0 * omega**2 * US%Z_to_m*zpt / g_Earth) / g_Earth
UStokes = UStokes + Stokes*domega
omega = omega + domega
enddo
Expand Down

0 comments on commit 37d30b5

Please sign in to comment.