Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into answer_date
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallward authored Aug 4, 2022
2 parents 1a019a4 + 2192db9 commit bd60977
Show file tree
Hide file tree
Showing 12 changed files with 73 additions and 66 deletions.
10 changes: 5 additions & 5 deletions config_src/drivers/FMS_cap/MOM_surface_forcing_gfdl.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
call get_param(param_file, mdl, "FLUXCONST_SALT", CS%Flux_const_salt, &
"The constant that relates the restoring surface salt fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
fail_if_missing=.false.,default=unscaled_fluxconst, units="m day-1", scale=US%m_to_Z*US%T_to_s)
fail_if_missing=.false., default=unscaled_fluxconst, units="m day-1", scale=US%m_to_Z*US%T_to_s)
! Finish converting CS%Flux_const from m day-1 to [Z T-1 ~> m s-1].
CS%Flux_const = CS%Flux_const / 86400.0
CS%Flux_const_salt = CS%Flux_const_salt / 86400.0
Expand Down Expand Up @@ -1440,11 +1440,11 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
call get_param(param_file, mdl, "FLUXCONST", CS%Flux_const, &
"The constant that relates the restoring surface fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
default=0.0, units="m day-1", scale=US%m_to_Z*US%T_to_s,unscaled=unscaled_fluxconst)
default=0.0, units="m day-1", scale=US%m_to_Z*US%T_to_s, unscaled=unscaled_fluxconst)
call get_param(param_file, mdl, "FLUXCONST_TEMP", CS%Flux_const_temp, &
"The constant that relates the restoring surface temperature fluxes to the relative "//&
"surface anomalies (akin to a piston velocity). Note the non-MKS units.", &
fail_if_missing=.false.,default=unscaled_fluxconst, units="m day-1", scale=US%m_to_Z*US%T_to_s)
fail_if_missing=.false., default=unscaled_fluxconst, units="m day-1", scale=US%m_to_Z*US%T_to_s)
! Convert CS%Flux_const from m day-1 to m s-1.
CS%Flux_const = CS%Flux_const / 86400.0
CS%Flux_const_temp = CS%Flux_const_temp / 86400.0
Expand Down Expand Up @@ -1529,7 +1529,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
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 "//&
"variable gustiness.")
"variable gustiness.", fail_if_missing=.true.)

call safe_alloc_ptr(CS%gust,isd,ied,jsd,jed)
gust_file = trim(CS%inputdir) // trim(gust_file)
Expand Down Expand Up @@ -1568,7 +1568,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, wind_stagger)
if (CS%rigid_sea_ice) then
call get_param(param_file, mdl, "G_EARTH", CS%g_Earth, &
"The gravitational acceleration of the Earth.", &
units="m s-2", default = 9.80, scale=US%Z_to_m*US%m_s_to_L_T**2)
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, "SEA_ICE_MEAN_DENSITY", CS%density_sea_ice, &
"A typical density of sea ice, used with the kinematic "//&
"viscosity, when USE_RIGID_SEA_ICE is true.", &
Expand Down
19 changes: 12 additions & 7 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,11 @@ subroutine ALE_register_diags(Time, G, GV, US, diag, CS)
type(diag_ctrl), target, intent(in) :: diag !< Diagnostics control structure
type(ALE_CS), pointer :: CS !< Module control structure

! Local variables
character(len=48) :: thickness_units

CS%diag => diag
thickness_units = get_thickness_units(GV)

! These diagnostics of the state variables before ALE are useful for
! debugging the ALE code.
Expand All @@ -335,7 +339,7 @@ subroutine ALE_register_diags(Time, G, GV, US, diag, CS)
CS%id_v_preale = register_diag_field('ocean_model', 'v_preale', diag%axesCvL, Time, &
'Meridional velocity before remapping', 'm s-1', conversion=US%L_T_to_m_s)
CS%id_h_preale = register_diag_field('ocean_model', 'h_preale', diag%axesTL, Time, &
'Layer Thickness before remapping', get_thickness_units(GV), conversion=GV%H_to_MKS, &
'Layer Thickness before remapping', thickness_units, conversion=GV%H_to_MKS, &
v_extensive=.true.)
CS%id_T_preale = register_diag_field('ocean_model', 'T_preale', diag%axesTL, Time, &
'Temperature before remapping', 'degC', conversion=US%C_to_degC)
Expand All @@ -344,14 +348,15 @@ subroutine ALE_register_diags(Time, G, GV, US, diag, CS)
CS%id_e_preale = register_diag_field('ocean_model', 'e_preale', diag%axesTi, Time, &
'Interface Heights before remapping', 'm', conversion=US%Z_to_m)

CS%id_dzRegrid = register_diag_field('ocean_model','dzRegrid',diag%axesTi,Time, &
CS%id_dzRegrid = register_diag_field('ocean_model', 'dzRegrid', diag%axesTi, Time, &
'Change in interface height due to ALE regridding', 'm', conversion=GV%H_to_m)
cs%id_vert_remap_h = register_diag_field('ocean_model', 'vert_remap_h', &
diag%axestl, time, 'layer thicknesses after ALE regridding and remapping', &
'm', conversion=GV%H_to_m, v_extensive=.true.)
cs%id_vert_remap_h_tendency = register_diag_field('ocean_model','vert_remap_h_tendency',diag%axestl,time, &
cs%id_vert_remap_h = register_diag_field('ocean_model', 'vert_remap_h', diag%axestl, Time, &
'layer thicknesses after ALE regridding and remapping', &
thickness_units, conversion=GV%H_to_MKS, v_extensive=.true.)
cs%id_vert_remap_h_tendency = register_diag_field('ocean_model', &
'vert_remap_h_tendency', diag%axestl, Time, &
'Layer thicknesses tendency due to ALE regridding and remapping', &
'm s-1', conversion=GV%H_to_m*US%s_to_T, v_extensive=.true.)
trim(thickness_units)//" s-1", conversion=GV%H_to_MKS*US%s_to_T, v_extensive=.true.)

end subroutine ALE_register_diags

Expand Down
25 changes: 12 additions & 13 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module MOM_diagnostics
use MOM_unit_scaling, only : unit_scale_type
use MOM_variables, only : thermo_var_ptrs, ocean_internal_state, p3d
use MOM_variables, only : accel_diag_ptrs, cont_diag_ptrs, surface
use MOM_verticalGrid, only : verticalGrid_type, get_thickness_units
use MOM_verticalGrid, only : verticalGrid_type, get_thickness_units, get_flux_units
use MOM_wave_speed, only : wave_speed, wave_speed_CS, wave_speed_init

implicit none ; private
Expand Down Expand Up @@ -1613,11 +1613,9 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag

call get_param(param_file, mdl, "SPLIT", split, default=.true., do_not_log=.true.)

if (GV%Boussinesq) then
thickness_units = "m" ; flux_units = "m3 s-1" ; convert_H = GV%H_to_m
else
thickness_units = "kg m-2" ; flux_units = "kg s-1" ; convert_H = GV%H_to_kg_m2
endif
thickness_units = get_thickness_units(GV)
flux_units = get_flux_units(GV)
convert_H = GV%H_to_MKS

CS%id_masscello = register_diag_field('ocean_model', 'masscello', diag%axesTL,&
Time, 'Mass per unit area of liquid ocean grid cell', 'kg m-2', & !### , conversion=GV%H_to_kg_m2, &
Expand All @@ -1627,11 +1625,11 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
diag, 'Mass of liquid ocean', 'kg', standard_name='sea_water_mass')

CS%id_thkcello = register_diag_field('ocean_model', 'thkcello', diag%axesTL, Time, &
long_name = 'Cell Thickness', standard_name='cell_thickness', &
long_name='Cell Thickness', standard_name='cell_thickness', &
units='m', conversion=US%Z_to_m, v_extensive=.true.)
CS%id_h_pre_sync = register_diag_field('ocean_model', 'h_pre_sync', diag%axesTL, Time, &
long_name = 'Cell thickness from the previous timestep', &
units='m', conversion=GV%H_to_m, v_extensive=.true.)
long_name='Cell thickness from the previous timestep', &
units=thickness_units, conversion=GV%H_to_MKS, v_extensive=.true.)

! Note that CS%id_volcello would normally be registered here but because it is a "cell measure" and
! must be registered first. We earlier stored the handle of volcello but need it here for posting
Expand Down Expand Up @@ -1968,10 +1966,11 @@ subroutine register_transport_diags(Time, G, GV, US, IDs, diag)
character(len=48) :: thickness_units, accum_flux_units

thickness_units = get_thickness_units(GV)
H_convert = GV%H_to_MKS
if (GV%Boussinesq) then
H_convert = GV%H_to_m ; accum_flux_units = "m3"
accum_flux_units = "m3"
else
H_convert = GV%H_to_kg_m2 ; accum_flux_units = "kg"
accum_flux_units = "kg"
endif

! Diagnostics related to tracer and mass transport
Expand Down Expand Up @@ -1999,10 +1998,10 @@ subroutine register_transport_diags(Time, G, GV, US, IDs, diag)
standard_name='ocean_mass_y_transport_vertical_sum', x_cell_method='sum')
IDs%id_dynamics_h = register_diag_field('ocean_model','dynamics_h', &
diag%axesTl, Time, 'Layer thicknesses prior to horizontal dynamics', &
'm', v_extensive=.true., conversion=GV%H_to_m)
thickness_units, conversion=GV%H_to_MKS, v_extensive=.true.)
IDs%id_dynamics_h_tendency = register_diag_field('ocean_model','dynamics_h_tendency', &
diag%axesTl, Time, 'Change in layer thicknesses due to horizontal dynamics', &
'm s-1', v_extensive=.true., conversion=GV%H_to_m*US%s_to_T)
trim(thickness_units)//" s-1", conversion=GV%H_to_MKS*US%s_to_T, v_extensive=.true.)

end subroutine register_transport_diags

Expand Down
18 changes: 9 additions & 9 deletions src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1087,11 +1087,11 @@ subroutine depress_surface(h, G, GV, US, param_file, tv, just_read, z_top_shelf)

call get_param(param_file, mdl, "INPUTDIR", inputdir, default=".")
inputdir = slasher(inputdir)
call get_param(param_file, mdl, "SURFACE_HEIGHT_IC_FILE", eta_srf_file,&
call get_param(param_file, mdl, "SURFACE_HEIGHT_IC_FILE", eta_srf_file, &
"The initial condition file for the surface height.", &
fail_if_missing=.not.just_read, do_not_log=just_read)
call get_param(param_file, mdl, "SURFACE_HEIGHT_IC_VAR", eta_srf_var, &
"The initial condition variable for the surface height.",&
"The initial condition variable for the surface height.", &
default="SSH", do_not_log=just_read)
filename = trim(inputdir)//trim(eta_srf_file)
if (.not.just_read) &
Expand Down Expand Up @@ -1285,7 +1285,7 @@ subroutine calc_sfc_displacement(PF, G, GV, US, mass_shelf, tv, h)

call get_param(PF, mdl, "ICE_SHELF_INITIALIZATION_Z_TOLERANCE", tol, &
"A initialization tolerance for the calculation of the static "// &
"ice shelf displacement (m) using initial temperature and salinity profile.",&
"ice shelf displacement (m) using initial temperature and salinity profile.", &
default=0.001, units="m", scale=US%m_to_Z)
max_iter = 1e3
call MOM_mesg("Started calculating initial interface position under ice shelf ")
Expand Down Expand Up @@ -1971,13 +1971,13 @@ subroutine initialize_sponges_file(G, GV, US, use_temperature, tv, u, v, depth_t
"The name of the inverse damping rate variable in "//&
"SPONGE_UV_DAMPING_FILE for the velocities.", default=Idamp_var)
endif
call get_param(param_file, mdl, "USE_REGRIDDING", use_ALE, do_not_log=.true.)
call get_param(param_file, mdl, "USE_REGRIDDING", use_ALE, default=.false., do_not_log=.true.)

!### NEW_SPONGES should be obsoleted properly, rather than merely deprecated, at which
! point only the else branch of the new_sponge_param block would be retained.
call get_param(param_file, mdl, "NEW_SPONGES", new_sponge_param, &
"Set True if using the newer sponging code which "//&
"performs on-the-fly regridding in lat-lon-time.",&
"performs on-the-fly regridding in lat-lon-time"//&
"of sponge restoring data.", default=.false., do_not_log=.true.)
if (new_sponge_param) then
call get_param(param_file, mdl, "INTERPOLATE_SPONGE_TIME_SPACE", time_space_interp_sponge, &
Expand Down Expand Up @@ -2252,7 +2252,7 @@ subroutine initialize_oda_incupd_file(G, GV, US, use_temperature, tv, h, u, v, p
default=.false.)
endif
call get_param(param_file, mdl, "ODA_INCUPD_RESET_NCOUNT", reset_ncount, &
"If True, reinitialize number of updates already done, ncount.",&
"If True, reinitialize number of updates already done, ncount.", &
default=.true.)
if (.not.oda_inc .and. .not.reset_ncount) &
call MOM_error(FATAL, " initialize_oda_incupd: restarting during update "// &
Expand Down Expand Up @@ -2280,7 +2280,7 @@ subroutine initialize_oda_incupd_file(G, GV, US, use_temperature, tv, h, u, v, p
"The name of the meridional vel. inc. variable in "//&
"ODA_INCUPD_FILE.", default="v_inc")

! call get_param(param_file, mdl, "USE_REGRIDDING", use_ALE, do_not_log=.true.)
! call get_param(param_file, mdl, "USE_REGRIDDING", use_ALE, default=.false., do_not_log=.true.)

! Read in incremental update for tracers
filename = trim(inputdir)//trim(inc_file)
Expand Down Expand Up @@ -2523,7 +2523,7 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, depth_tot, G, GV, US, PF, just
if (.not.just_read) call callTree_enter(trim(mdl)//"(), MOM_state_initialization.F90")
if (.not.just_read) call log_version(PF, mdl, version, "")

inputdir = "." ; call get_param(PF, mdl, "INPUTDIR", inputdir)
call get_param(PF, mdl, "INPUTDIR", inputdir, default=".")
inputdir = slasher(inputdir)

eos => tv%eqn_of_state
Expand Down Expand Up @@ -2562,7 +2562,7 @@ subroutine MOM_temp_salt_initialize_from_Z(h, tv, depth_tot, G, GV, US, PF, just
"is True.", default="PPM_IH4", do_not_log=just_read)
call get_param(PF, mdl, "Z_INIT_REMAP_GENERAL", remap_general, &
"If false, only initializes to z* coordinates. "//&
"If true, allows initialization directly to general coordinates.",&
"If true, allows initialization directly to general coordinates.", &
default=.false., do_not_log=just_read)
call get_param(PF, mdl, "Z_INIT_REMAP_FULL_COLUMN", remap_full_column, &
"If false, only reconstructs profiles for valid data points. "//&
Expand Down
13 changes: 7 additions & 6 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3253,8 +3253,9 @@ subroutine diabatic_driver_init(Time, G, GV, US, param_file, useALEalgorithm, di
! available only for ALE algorithm.
! diagnostics for tendencies of temp and heat due to frazil
CS%id_diabatic_diff_h = register_diag_field('ocean_model', 'diabatic_diff_h', diag%axesTL, Time, &
long_name='Cell thickness used during diabatic diffusion', &
units='m', conversion=GV%H_to_m, v_extensive=.true.)
'Cell thickness used during diabatic diffusion', &
thickness_units, conversion=GV%H_to_MKS, v_extensive=.true.)

if (CS%useALEalgorithm) then
CS%id_diabatic_diff_temp_tend = register_diag_field('ocean_model', &
'diabatic_diff_temp_tendency', diag%axesTL, Time, &
Expand Down Expand Up @@ -3326,12 +3327,12 @@ subroutine diabatic_driver_init(Time, G, GV, US, param_file, useALEalgorithm, di
! available only for ALE algorithm.
! diagnostics for tendencies of temp and heat due to frazil
CS%id_boundary_forcing_h = register_diag_field('ocean_model', 'boundary_forcing_h', diag%axesTL, Time, &
long_name='Cell thickness after applying boundary forcing', &
units='m', conversion=GV%H_to_m, v_extensive=.true.)
'Cell thickness after applying boundary forcing', &
thickness_units, conversion=GV%H_to_MKS, v_extensive=.true.)
CS%id_boundary_forcing_h_tendency = register_diag_field('ocean_model', &
'boundary_forcing_h_tendency', diag%axesTL, Time, &
'Cell thickness tendency due to boundary forcing', &
'm s-1', conversion=GV%H_to_m*US%s_to_T, v_extensive=.true.)
trim(thickness_units)//" s-1", conversion=GV%H_to_MKS*US%s_to_T, v_extensive=.true.)
if (CS%id_boundary_forcing_h_tendency > 0) then
CS%boundary_forcing_tendency_diag = .true.
endif
Expand Down Expand Up @@ -3388,7 +3389,7 @@ subroutine diabatic_driver_init(Time, G, GV, US, param_file, useALEalgorithm, di
! diagnostics for tendencies of temp and heat due to frazil
CS%id_frazil_h = register_diag_field('ocean_model', 'frazil_h', diag%axesTL, Time, &
long_name='Cell Thickness', standard_name='cell_thickness', &
units='m', conversion=GV%H_to_m, v_extensive=.true.)
units=thickness_units, conversion=GV%H_to_MKS, v_extensive=.true.)

! diagnostic for tendency of temp due to frazil
CS%id_frazil_temp_tend = register_diag_field('ocean_model',&
Expand Down
4 changes: 2 additions & 2 deletions src/tracer/MOM_offline_main.F90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module MOM_offline_main
use MOM_tracer_registry, only : tracer_registry_type, MOM_tracer_chksum, MOM_tracer_chkinv
use MOM_unit_scaling, only : unit_scale_type
use MOM_variables, only : thermo_var_ptrs
use MOM_verticalGrid, only : verticalGrid_type
use MOM_verticalGrid, only : verticalGrid_type, get_thickness_units

implicit none ; private

Expand Down Expand Up @@ -1160,7 +1160,7 @@ subroutine register_diags_offline_transport(Time, diag, CS, GV, US)
'at the end of the offline timestep', 'm', conversion=GV%H_to_m)
CS%id_h_redist = register_diag_field('ocean_model','h_redist', diag%axesTL, Time, &
'Layer thicknesses before redistribution of mass fluxes', &
'm', conversion=GV%H_to_m)
get_thickness_units(GV), conversion=GV%H_to_MKS)

! Regridded/remapped input fields
CS%id_uhtr_regrid = register_diag_field('ocean_model', 'uhtr_regrid', diag%axesCuL, Time, &
Expand Down
18 changes: 9 additions & 9 deletions src/user/BFB_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ subroutine BFB_initialize_sponges_southonly(G, GV, US, use_temperature, tv, dept
real :: Idamp(SZI_(G),SZJ_(G)) ! The sponge damping rate [T-1 ~> s-1]
real :: H0(SZK_(GV)) ! Resting layer thicknesses in depth units [Z ~> m].
real :: min_depth ! The minimum ocean depth in depth units [Z ~> m].
real :: slat, wlon, lenlat, lenlon, nlat
real :: slat ! The southern latitude of the domain [degrees_N]
real :: wlon ! The western longitude of the domain [degrees_E]
real :: lenlat ! The latitudinal length of the domain [degrees_N]
real :: lenlon ! The longitudinal length of the domain [degrees_E]
real :: nlat ! The northern latitude of the domain [degrees_N]
real :: max_damping ! The maximum damping rate [T-1 ~> s-1]
character(len=40) :: mdl = "BFB_initialize_sponges_southonly" ! This subroutine's name.
integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
Expand All @@ -112,14 +116,10 @@ subroutine BFB_initialize_sponges_southonly(G, GV, US, use_temperature, tv, dept
call get_param(param_file, mdl, "MINIMUM_DEPTH", min_depth, &
"The minimum depth of the ocean.", units="m", default=0.0, scale=US%m_to_Z)

call get_param(param_file, mdl, "SOUTHLAT", slat, &
"The southern latitude of the domain.", units="degrees")
call get_param(param_file, mdl, "LENLAT", lenlat, &
"The latitudinal length of the domain.", units="degrees")
call get_param(param_file, mdl, "WESTLON", wlon, &
"The western longitude of the domain.", units="degrees", default=0.0)
call get_param(param_file, mdl, "LENLON", lenlon, &
"The longitudinal length of the domain.", units="degrees")
slat = G%south_lat
lenlat = G%len_lat
wlon = G%west_lon
lenlon = G%len_lon
nlat = slat + lenlat
do k=1,nz ; H0(k) = -G%max_depth * real(k-1) / real(nz) ; enddo

Expand Down
2 changes: 1 addition & 1 deletion src/user/DOME2d_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ subroutine DOME2d_initialize_sponges(G, GV, US, tv, depth_tot, param_file, use_A
call get_param(param_file, mdl, "DOME2D_SHELF_DEPTH", dome2d_depth_bay, &
default=0.2, do_not_log=.true.)
call get_param(param_file, mdl, "S_REF", S_ref, default=35.0, scale=US%ppt_to_S)
call get_param(param_file, mdl, "T_REF", T_ref, scale=US%degC_to_C)
call get_param(param_file, mdl, "T_REF", T_ref, scale=US%degC_to_C, fail_if_missing=.false.)
call get_param(param_file, mdl, "S_RANGE", S_range, default=2.0, scale=US%ppt_to_S)
call get_param(param_file, mdl, "T_RANGE", T_range, default=0.0, scale=US%degC_to_C)

Expand Down
Loading

0 comments on commit bd60977

Please sign in to comment.