Skip to content

Commit

Permalink
Use US%Pa_to_RL2_T2 to rescale pressures
Browse files Browse the repository at this point in the history
  Use the new combined unit scaling factor US%Pa_to_RL2_T2 to rescale input
pressure fields and US%Pa_to_RLZ_T2 to rescale input wind stresses in various
places in the MOM6 code, including in the solo_driver and FMS_cap drivers.
Analogous changes could also be made to the mct and nuopc surface forcing files,
but have been omitted for now.  All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Mar 14, 2023
1 parent 3b70880 commit e25c4cd
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 35 deletions.
34 changes: 16 additions & 18 deletions config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,14 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,
if (associated(IOB%p)) then
if (CS%max_p_surf >= 0.0) then
do j=js,je ; do i=is,ie
fluxes%p_surf_full(i,j) = G%mask2dT(i,j) * US%kg_m3_to_R*US%m_s_to_L_T**2*IOB%p(i-i0,j-j0)
fluxes%p_surf_full(i,j) = G%mask2dT(i,j) * US%Pa_to_RL2_T2*IOB%p(i-i0,j-j0)
fluxes%p_surf(i,j) = MIN(fluxes%p_surf_full(i,j),CS%max_p_surf)
if (CS%check_no_land_fluxes) &
call check_mask_val_consistency(IOB%p(i-i0,j-j0), G%mask2dT(i,j), i, j, 'p', G)
enddo ; enddo
else
do j=js,je ; do i=is,ie
fluxes%p_surf_full(i,j) = G%mask2dT(i,j) * US%kg_m3_to_R*US%m_s_to_L_T**2*IOB%p(i-i0,j-j0)
fluxes%p_surf_full(i,j) = G%mask2dT(i,j) * US%Pa_to_RL2_T2*IOB%p(i-i0,j-j0)
fluxes%p_surf(i,j) = fluxes%p_surf_full(i,j)
if (CS%check_no_land_fluxes) &
call check_mask_val_consistency(IOB%p(i-i0,j-j0), G%mask2dT(i,j), i, j, 'p', G)
Expand Down Expand Up @@ -755,12 +755,12 @@ subroutine convert_IOB_to_forces(IOB, forces, index_bounds, Time, G, US, CS, dt_
if (associated(IOB%p)) then
if (CS%max_p_surf >= 0.0) then
do j=js,je ; do i=is,ie
forces%p_surf_full(i,j) = G%mask2dT(i,j) * US%kg_m3_to_R*US%m_s_to_L_T**2*IOB%p(i-i0,j-j0)
forces%p_surf_full(i,j) = G%mask2dT(i,j) * US%Pa_to_RL2_T2*IOB%p(i-i0,j-j0)
forces%p_surf(i,j) = MIN(forces%p_surf_full(i,j),CS%max_p_surf)
enddo ; enddo
else
do j=js,je ; do i=is,ie
forces%p_surf_full(i,j) = G%mask2dT(i,j) * US%kg_m3_to_R*US%m_s_to_L_T**2*IOB%p(i-i0,j-j0)
forces%p_surf_full(i,j) = G%mask2dT(i,j) * US%Pa_to_RL2_T2*IOB%p(i-i0,j-j0)
forces%p_surf(i,j) = forces%p_surf_full(i,j)
enddo ; enddo
endif
Expand Down Expand Up @@ -911,7 +911,6 @@ subroutine extract_IOB_stresses(IOB, index_bounds, Time, G, US, CS, taux, tauy,
real :: Irho0 ! Inverse of the mean density rescaled to [Z L-1 R-1 ~> m3 kg-1]
real :: taux2, tauy2 ! squared wind stresses [R2 Z2 L2 T-4 ~> Pa2]
real :: tau_mag ! magnitude of the wind stress [R Z L T-2 ~> Pa]
real :: Pa_conversion ! A unit conversion factor from Pa to the internal wind stress units [R Z L T-2 Pa-1 ~> 1]
real :: stress_conversion ! A unit conversion factor from Pa times any stress multiplier [R Z L T-2 Pa-1 ~> 1]

logical :: do_ustar, do_gustless
Expand All @@ -925,8 +924,7 @@ subroutine extract_IOB_stresses(IOB, index_bounds, Time, G, US, CS, taux, tauy,
i0 = is - index_bounds(1) ; j0 = js - index_bounds(3)

IRho0 = US%L_to_Z / CS%Rho0
Pa_conversion = US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z
stress_conversion = Pa_conversion * CS%wind_stress_multiplier
stress_conversion = US%Pa_to_RLZ_T2 * CS%wind_stress_multiplier

do_ustar = present(ustar) ; do_gustless = present(gustless_ustar)

Expand Down Expand Up @@ -1037,15 +1035,15 @@ subroutine extract_IOB_stresses(IOB, index_bounds, Time, G, US, CS, taux, tauy,
(G%mask2dBu(I,J-1) + G%mask2dBu(I-1,J))) > 0.0)) ) &
gustiness = CS%gust(i,j)
endif
ustar(i,j) = sqrt(gustiness*IRho0 + IRho0*Pa_conversion*IOB%stress_mag(i-i0,j-j0))
ustar(i,j) = sqrt(gustiness*IRho0 + IRho0*US%Pa_to_RLZ_T2*IOB%stress_mag(i-i0,j-j0))
enddo ; enddo ; endif
if (CS%answer_date < 20190101) then
if (do_gustless) then ; do j=js,je ; do i=is,ie
gustless_ustar(i,j) = sqrt(Pa_conversion*US%L_to_Z*IOB%stress_mag(i-i0,j-j0) / CS%Rho0)
gustless_ustar(i,j) = sqrt(US%Pa_to_RLZ_T2*US%L_to_Z*IOB%stress_mag(i-i0,j-j0) / CS%Rho0)
enddo ; enddo ; endif
else
if (do_gustless) then ; do j=js,je ; do i=is,ie
gustless_ustar(i,j) = sqrt(IRho0 * Pa_conversion*IOB%stress_mag(i-i0,j-j0))
gustless_ustar(i,j) = sqrt(IRho0 * US%Pa_to_RLZ_T2*IOB%stress_mag(i-i0,j-j0))
enddo ; enddo ; endif
endif
elseif (wind_stagger == BGRID_NE) then
Expand Down Expand Up @@ -1174,17 +1172,17 @@ subroutine apply_force_adjustments(G, US, CS, Time, forces)
real :: rDlon ! The magnitude of the change in longitude [degrees_E] and then its inverse [degrees_E-1]
real :: cosA, sinA ! The cosine and sine of the angle between the grid and true north [nondim]
real :: zonal_tau, merid_tau ! True zonal and meridional wind stresses [R Z L T-2 ~> Pa]
real :: Pa_conversion ! A unit conversion factor from Pa to the internal units [R Z L T-2 Pa-1 ~> 1]
logical :: overrode_x, overrode_y

isc = G%isc; iec = G%iec ; jsc = G%jsc; jec = G%jec
Pa_conversion = US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z

tempx_at_h(:,:) = 0.0 ; tempy_at_h(:,:) = 0.0
! Either reads data or leaves contents unchanged
overrode_x = .false. ; overrode_y = .false.
call data_override(G%Domain, 'taux_adj', tempx_at_h(isc:iec,jsc:jec), Time, override=overrode_x, scale=Pa_conversion)
call data_override(G%Domain, 'tauy_adj', tempy_at_h(isc:iec,jsc:jec), Time, override=overrode_y, scale=Pa_conversion)
call data_override(G%Domain, 'taux_adj', tempx_at_h(isc:iec,jsc:jec), Time, &
override=overrode_x, scale=US%Pa_to_RLZ_T2)
call data_override(G%Domain, 'tauy_adj', tempy_at_h(isc:iec,jsc:jec), Time, &
override=overrode_y, scale=US%Pa_to_RLZ_T2)

if (overrode_x .or. overrode_y) then
if (.not. (overrode_x .and. overrode_y)) call MOM_error(FATAL,"apply_flux_adjustments: "//&
Expand Down Expand Up @@ -1314,7 +1312,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
"limit the water that can be frozen out of the ocean and "//&
"the ice-ocean heat fluxes are treated explicitly. No "//&
"limit is applied if a negative value is used.", &
units="Pa", default=-1.0, scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=-1.0, scale=US%Pa_to_RL2_T2)
call get_param(param_file, mdl, "RESTORE_SALINITY", CS%restore_salt, &
"If true, the coupled driver will add a globally-balanced "//&
"fresh-water flux that drives sea-surface salinity "//&
Expand Down Expand Up @@ -1532,8 +1530,8 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
"If true, use a 2-dimensional gustiness supplied from "//&
"an input file", default=.false.)
call get_param(param_file, mdl, "GUST_CONST", CS%gust_const, &
"The background gustiness in the winds.", &
units="Pa", default=0.0, scale=US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z)
"The background gustiness in the winds.", &
units="Pa", default=0.0, scale=US%Pa_to_RLZ_T2)
if (CS%read_gust_2d) then
call get_param(param_file, mdl, "GUST_2D_FILE", gust_file, &
"The file in which the wind gustiness is found in "//&
Expand All @@ -1544,7 +1542,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
! NOTE: There are certain cases where FMS is unable to read this file, so
! we use read_netCDF_data in place of MOM_read_data.
call read_netCDF_data(gust_file, 'gustiness', CS%gust, G%Domain, &
rescale=US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z) ! units in file should be Pa
rescale=US%Pa_to_RLZ_T2) ! units in file should be [Pa]
endif
call get_param(param_file, mdl, "DEFAULT_ANSWER_DATE", default_answer_date, &
"This sets the default value for the various _ANSWER_DATE parameters.", &
Expand Down
2 changes: 1 addition & 1 deletion config_src/drivers/solo_driver/MESO_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ subroutine MESO_surface_forcing_init(Time, G, US, param_file, diag, CS)
units="kg m-3", default=1035.0, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "GUST_CONST", CS%gust_const, &
"The background gustiness in the winds.", units="Pa", default=0.0, &
scale=US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z)
scale=US%Pa_to_RLZ_T2)

call get_param(param_file, mdl, "RESTOREBUOY", CS%restorebuoy, &
"If true, the buoyancy fluxes drive the model back "//&
Expand Down
4 changes: 2 additions & 2 deletions config_src/drivers/solo_driver/user_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ subroutine USER_wind_forcing(sfc_state, forces, day, G, US, CS)
! calculation of ustar - otherwise the lower bound would be Isq.
do j=js,je ; do I=is-1,Ieq
! Change this to the desired expression.
forces%taux(I,j) = G%mask2dCu(I,j) * 0.0*US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z
forces%taux(I,j) = G%mask2dCu(I,j) * 0.0*US%Pa_to_RLZ_T2
enddo ; enddo
do J=js-1,Jeq ; do i=is,ie
forces%tauy(i,J) = G%mask2dCv(i,J) * 0.0 ! Change this to the desired expression.
Expand Down Expand Up @@ -271,7 +271,7 @@ subroutine USER_surface_forcing_init(Time, G, US, param_file, diag, CS)
units="kg m-3", default=1035.0, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "GUST_CONST", CS%gust_const, &
"The background gustiness in the winds.", &
units="Pa", default=0.0, scale=US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z)
units="Pa", default=0.0, scale=US%Pa_to_RLZ_T2)

call get_param(param_file, mdl, "RESTOREBUOY", CS%restorebuoy, &
"If true, the buoyancy fluxes drive the model back "//&
Expand Down
2 changes: 1 addition & 1 deletion src/ALE/MOM_hybgen_regrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ subroutine init_hybgen_regrid(CS, GV, US, param_file)
"The pressure that is used for calculating the coordinate "//&
"density. (1 Pa = 1e4 dbar, so 2e7 is commonly used.) "//&
"This is only used if USE_EOS and ENABLE_THERMODYNAMICS are true.", &
units="Pa", default=2.0e7, scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=2.0e7, scale=US%Pa_to_RL2_T2)

call get_param(param_file, mdl, "HYBGEN_MIN_THICKNESS", CS%min_thickness, &
"The minimum layer thickness allowed when regridding with Hybgen.", &
Expand Down
6 changes: 3 additions & 3 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
endif

! ensure CS%ref_pressure is rescaled properly
CS%ref_pressure = (US%kg_m3_to_R * US%m_s_to_L_T**2) * CS%ref_pressure
CS%ref_pressure = US%Pa_to_RL2_T2 * CS%ref_pressure

if (allocated(rho_target)) then
call set_target_densities(CS, US%kg_m3_to_R*rho_target)
Expand All @@ -556,13 +556,13 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
"The pressure that is used for calculating the coordinate "//&
"density. (1 Pa = 1e4 dbar, so 2e7 is commonly used.) "//&
"This is only used if USE_EOS and ENABLE_THERMODYNAMICS are true.", &
units="Pa", default=2.0e7, scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=2.0e7, scale=US%Pa_to_RL2_T2)
else
call get_param(param_file, mdl, create_coord_param(param_prefix, "P_REF", param_suffix), P_Ref, &
"The pressure that is used for calculating the diagnostic coordinate "//&
"density. (1 Pa = 1e4 dbar, so 2e7 is commonly used.) "//&
"This is only used for the RHO coordinate.", &
units="Pa", default=2.0e7, scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=2.0e7, scale=US%Pa_to_RL2_T2)
endif
call get_param(param_file, mdl, create_coord_param(param_prefix, "REGRID_COMPRESSIBILITY_FRACTION", param_suffix), &
tmpReal, &
Expand Down
4 changes: 2 additions & 2 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &

! This is here in case these values are used inappropriately.
use_frazil = .false. ; bound_salinity = .false.
CS%tv%P_Ref = 2.0e7*US%kg_m3_to_R*US%m_s_to_L_T**2
CS%tv%P_Ref = 2.0e7*US%Pa_to_RL2_T2
if (use_temperature) then
call get_param(param_file, "MOM", "FRAZIL", use_frazil, &
"If true, water freezes if it gets too cold, and the "//&
Expand Down Expand Up @@ -2234,7 +2234,7 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &
"The pressure that is used for calculating the coordinate "//&
"density. (1 Pa = 1e4 dbar, so 2e7 is commonly used.) "//&
"This is only used if USE_EOS and ENABLE_THERMODYNAMICS are true.", &
units="Pa", default=2.0e7, scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=2.0e7, scale=US%Pa_to_RL2_T2)

if (bulkmixedlayer) then
call get_param(param_file, "MOM", "NKML", nkml, &
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_PressureForce_FV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ subroutine PressureForce_FV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_
p(i,j,1) = p_atm(i,j)
enddo ; enddo
else
! oneatm = 101325.0 * US%kg_m3_to_R * US%m_s_to_L_T**2 ! 1 atm scaled to [R L2 T-2 ~> Pa]
! oneatm = 101325.0 * US%Pa_to_RL2_T2 ! 1 atm scaled to [R L2 T-2 ~> Pa]
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
p(i,j,1) = 0.0 ! or oneatm
Expand Down
2 changes: 1 addition & 1 deletion src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ subroutine calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, p_surf, &
if (CS%id_rhopot0 > 0) call post_data(CS%id_rhopot0, Rcv, CS%diag)
endif
if (CS%id_rhopot2 > 0) then
pressure_1d(:) = 2.0e7*US%kg_m3_to_R*US%m_s_to_L_T**2 ! 2000 dbars
pressure_1d(:) = 2.0e7*US%Pa_to_RL2_T2 ! 2000 dbars
!$OMP parallel do default(shared)
do k=1,nz ; do j=js,je
call calculate_density(tv%T(:,j,k), tv%S(:,j,k), pressure_1d, Rcv(:,j,k), &
Expand Down
2 changes: 1 addition & 1 deletion src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ subroutine trim_for_ice(PF, G, GV, US, ALE_CSp, tv, h, just_read)
if (just_read) return ! All run-time parameters have been read, so return.

call MOM_read_data(filename, p_surf_var, p_surf, G%Domain, &
scale=scale_factor*US%kg_m3_to_R*US%m_s_to_L_T**2)
scale=scale_factor*US%Pa_to_RL2_T2)

if (use_remapping) then
allocate(remap_CS)
Expand Down
2 changes: 1 addition & 1 deletion src/tracer/MOM_neutral_diffusion.F90
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ logical function neutral_diffusion_init(Time, G, GV, US, param_file, diag, EOS,
call get_param(param_file, mdl, "NDIFF_REF_PRES", CS%ref_pres, &
"The reference pressure (Pa) used for the derivatives of "//&
"the equation of state. If negative (default), local pressure is used.", &
units="Pa", default=-1., scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=-1., scale=US%Pa_to_RL2_T2)
call get_param(param_file, mdl, "NDIFF_INTERIOR_ONLY", CS%interior_only, &
"If true, only applies neutral diffusion in the ocean interior."//&
"That is, the algorithm will exclude the surface and bottom"//&
Expand Down
6 changes: 3 additions & 3 deletions src/user/Idealized_Hurricane.F90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ subroutine idealized_hurricane_wind_init(Time, G, US, param_file, CS)

! Local variables
real :: dP ! The pressure difference across the hurricane [R L2 T-2 ~> Pa]
real :: C
real :: C ! A temporary variable [nondim]
integer :: default_answer_date ! The default setting for the various ANSWER_DATE flags.
logical :: default_2018_answers ! The default setting for the various 2018_ANSWERS flags.
logical :: answers_2018 ! If true, use expressions driving the idealized hurricane test
Expand Down Expand Up @@ -132,10 +132,10 @@ subroutine idealized_hurricane_wind_init(Time, G, US, param_file, CS)
units='kg/m3', default=1.2, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "IDL_HURR_AMBIENT_PRESSURE", CS%pressure_ambient, &
"Ambient pressure used in the idealized hurricane wind profile.", &
units='Pa', default=101200., scale=US%m_s_to_L_T**2*US%kg_m3_to_R)
units='Pa', default=101200., scale=US%Pa_to_RL2_T2)
call get_param(param_file, mdl, "IDL_HURR_CENTRAL_PRESSURE", CS%pressure_central, &
"Central pressure used in the idealized hurricane wind profile.", &
units='Pa', default=96800., scale=US%m_s_to_L_T**2*US%kg_m3_to_R)
units='Pa', default=96800., scale=US%Pa_to_RL2_T2)
call get_param(param_file, mdl, "IDL_HURR_RAD_MAX_WIND", &
CS%rad_max_wind, "Radius of maximum winds used in the "//&
"idealized hurricane wind profile.", &
Expand Down
2 changes: 1 addition & 1 deletion src/user/dumbbell_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ subroutine dumbbell_surface_forcing_init(Time, G, US, param_file, diag, CS)
units="kg m-3", default=1035.0, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "DUMBBELL_SLP_AMP", CS%slp_amplitude, &
"Amplitude of SLP forcing in reservoirs.", &
units="Pa", default=10000.0, scale=US%kg_m3_to_R*US%m_s_to_L_T**2)
units="Pa", default=10000.0, scale=US%Pa_to_RL2_T2)
call get_param(param_file, mdl, "DUMBBELL_SLP_PERIOD", CS%slp_period, &
"Periodicity of SLP forcing in reservoirs.", &
units="days", default=1.0)
Expand Down

0 comments on commit e25c4cd

Please sign in to comment.