Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Add 11 units arguments to get_param calls #258

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config_src/drivers/mct_cap/mom_surface_forcing_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
call get_param(param_file, mdl, "WIND_STRESS_MULTIPLIER", CS%wind_stress_multiplier, &
"A factor multiplying the wind-stress given to the ocean by the "//&
"coupler. This is used for testing and should be =1.0 for any "//&
"production runs.", default=1.0)
"production runs.", units="nondim", default=1.0)

if (restore_salt) then
call get_param(param_file, mdl, "FLUXCONST", CS%Flux_const, &
Expand Down
2 changes: 1 addition & 1 deletion config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
call get_param(param_file, mdl, "WIND_STRESS_MULTIPLIER", CS%wind_stress_multiplier, &
"A factor multiplying the wind-stress given to the ocean by the "//&
"coupler. This is used for testing and should be =1.0 for any "//&
"production runs.", default=1.0)
"production runs.", units="nondim", default=1.0)

call get_param(param_file, mdl, "USE_CFC_CAP", CS%use_CFC, &
default=.false., do_not_log=.true.)
Expand Down
4 changes: 2 additions & 2 deletions src/ALE/MOM_hybgen_regrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ subroutine init_hybgen_regrid(CS, GV, US, param_file)
call get_param(param_file, mdl, "HYBGEN_REMAP_MIN_ZSTAR_DILATE", CS%min_dilate, &
"The maximum amount of dilation that is permitted when converting target "//&
"coordinates from z to z* [nondim]. This limit applies when drying occurs.", &
default=0.5)
units="nondim", default=0.5)
call get_param(param_file, mdl, "HYBGEN_REMAP_MAX_ZSTAR_DILATE", CS%max_dilate, &
"The maximum amount of dilation that is permitted when converting target "//&
"coordinates from z to z* [nondim]. This limit applies when drying occurs.", &
default=2.0)
units="nondim", default=2.0)

CS%onem = 1.0 * GV%m_to_H

Expand Down
43 changes: 22 additions & 21 deletions src/core/MOM_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,24 @@ module MOM_grid

real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: &
mask2dT, & !< 0 for land points and 1 for ocean points on the h-grid [nondim].
geoLatT, & !< The geographic latitude at q points in degrees of latitude or m.
geoLonT, & !< The geographic longitude at q points in degrees of longitude or m.
geoLatT, & !< The geographic latitude at q points [degrees_N] or [km] or [m].
geoLonT, & !< The geographic longitude at q points [degrees_E] or [km] or [m].
dxT, & !< dxT is delta x at h points [L ~> m].
IdxT, & !< 1/dxT [L-1 ~> m-1].
dyT, & !< dyT is delta y at h points [L ~> m].
IdyT, & !< IdyT is 1/dyT [L-1 ~> m-1].
areaT, & !< The area of an h-cell [L2 ~> m2].
IareaT, & !< 1/areaT [L-2 ~> m-2].
sin_rot, & !< The sine of the angular rotation between the local model grid's northward
!! and the true northward directions.
!! and the true northward directions [nondim].
cos_rot !< The cosine of the angular rotation between the local model grid's northward
!! and the true northward directions.
!! and the true northward directions [nondim].

real ALLOCABLE_, dimension(NIMEMB_PTR_,NJMEM_) :: &
mask2dCu, & !< 0 for boundary points and 1 for ocean points on the u grid [nondim].
OBCmaskCu, & !< 0 for boundary or OBC points and 1 for ocean points on the u grid [nondim].
geoLatCu, & !< The geographic latitude at u points in degrees of latitude or m.
geoLonCu, & !< The geographic longitude at u points in degrees of longitude or m.
geoLatCu, & !< The geographic latitude at u points [degrees_N] or [km] or [m]
geoLonCu, & !< The geographic longitude at u points [degrees_E] or [km] or [m].
dxCu, & !< dxCu is delta x at u points [L ~> m].
IdxCu, & !< 1/dxCu [L-1 ~> m-1].
dyCu, & !< dyCu is delta y at u points [L ~> m].
Expand All @@ -104,8 +104,8 @@ module MOM_grid
real ALLOCABLE_, dimension(NIMEM_,NJMEMB_PTR_) :: &
mask2dCv, & !< 0 for boundary points and 1 for ocean points on the v grid [nondim].
OBCmaskCv, & !< 0 for boundary or OBC points and 1 for ocean points on the v grid [nondim].
geoLatCv, & !< The geographic latitude at v points in degrees of latitude or m.
geoLonCv, & !< The geographic longitude at v points in degrees of longitude or m.
geoLatCv, & !< The geographic latitude at v points [degrees_N] or [km] or [m]
geoLonCv, & !< The geographic longitude at v points [degrees_E] or [km] or [m].
dxCv, & !< dxCv is delta x at v points [L ~> m].
IdxCv, & !< 1/dxCv [L-1 ~> m-1].
dyCv, & !< dyCv is delta y at v points [L ~> m].
Expand All @@ -126,8 +126,8 @@ module MOM_grid

real ALLOCABLE_, dimension(NIMEMB_PTR_,NJMEMB_PTR_) :: &
mask2dBu, & !< 0 for boundary points and 1 for ocean points on the q grid [nondim].
geoLatBu, & !< The geographic latitude at q points in degrees of latitude or m.
geoLonBu, & !< The geographic longitude at q points in degrees of longitude or m.
geoLatBu, & !< The geographic latitude at q points [degrees_N] or [km] or [m]
geoLonBu, & !< The geographic longitude at q points [degrees_E] or [km] or [m].
dxBu, & !< dxBu is delta x at q points [L ~> m].
IdxBu, & !< 1/dxBu [L-1 ~> m-1].
dyBu, & !< dyBu is delta y at q points [L ~> m].
Expand Down Expand Up @@ -181,8 +181,8 @@ module MOM_grid

! These parameters are run-time parameters that are used during some
! initialization routines (but not all)
real :: south_lat !< The latitude (or y-coordinate) of the first v-line
real :: west_lon !< The longitude (or x-coordinate) of the first u-line
real :: south_lat !< The latitude (or y-coordinate) of the first v-line [degrees_N] or [km] or [m]
real :: west_lon !< The longitude (or x-coordinate) of the first u-line [degrees_E] or [km] or [m]
real :: len_lat !< The latitudinal (or y-coord) extent of physical domain
real :: len_lon !< The longitudinal (or x-coord) extent of physical domain
real :: Rad_Earth !< The radius of the planet [m]
Expand Down Expand Up @@ -221,9 +221,11 @@ subroutine MOM_grid_init(G, param_file, US, HI, global_indexing, bathymetry_at_v
integer, allocatable, dimension(:) :: ibegin, iend, jbegin, jend
character(len=40) :: mod_nm = "MOM_grid" ! This module's name.

mean_SeaLev_scale = 1.0 ; if (associated(G%US)) mean_SeaLev_scale = G%US%m_to_Z

! Read all relevant parameters and write them to the model log.
call get_param(param_file, mod_nm, "REFERENCE_HEIGHT", G%Z_ref, default=0.0, do_not_log=.true.)
call get_param(param_file, mod_nm, "REFERENCE_HEIGHT", G%Z_ref, &
units="m", default=0.0, scale=mean_SeaLev_scale, do_not_log=.true.)
call log_version(param_file, mod_nm, version, &
"Parameters providing information about the lateral grid.", &
log_to_all=.true., layout=.true., all_default=(G%Z_ref==0.0))
Expand All @@ -236,7 +238,6 @@ subroutine MOM_grid_init(G, param_file, US, HI, global_indexing, bathymetry_at_v
layoutParam=.true.)
if (present(US)) then ; if (associated(US)) G%US => US ; endif

mean_SeaLev_scale = 1.0 ; if (associated(G%US)) mean_SeaLev_scale = G%US%m_to_Z
call get_param(param_file, mod_nm, "REFERENCE_HEIGHT", G%Z_ref, &
"A reference value for geometric height fields, such as bathyT.", &
units="m", default=0.0, scale=mean_SeaLev_scale)
Expand Down Expand Up @@ -477,8 +478,8 @@ end subroutine set_derived_metrics

!> Adcroft_reciprocal(x) = 1/x for |x|>0 or 0 for x=0.
function Adcroft_reciprocal(val) result(I_val)
real, intent(in) :: val !< The value being inverted.
real :: I_val !< The Adcroft reciprocal of val.
real, intent(in) :: val !< The value being inverted [A].
real :: I_val !< The Adcroft reciprocal of val [A-1].

I_val = 0.0 ; if (val /= 0.0) I_val = 1.0/val
end function Adcroft_reciprocal
Expand All @@ -488,12 +489,12 @@ logical function isPointInCell(G, i, j, x, y)
type(ocean_grid_type), intent(in) :: G !< Grid type
integer, intent(in) :: i !< i index of cell to test
integer, intent(in) :: j !< j index of cell to test
real, intent(in) :: x !< x coordinate of point
real, intent(in) :: y !< y coordinate of point
real, intent(in) :: x !< x coordinate of point [degrees_E]
real, intent(in) :: y !< y coordinate of point [degrees_N]
! Local variables
real :: xNE, xNW, xSE, xSW ! Longitudes of cell corners [degLon]
real :: yNE, yNW, ySE, ySW ! Latitudes of cell corners [degLat]
real :: l0, l1, l2, l3 ! Crossed products of differences in position [degLon degLat]
real :: xNE, xNW, xSE, xSW ! Longitudes of cell corners [degrees_E]
real :: yNE, yNW, ySE, ySW ! Latitudes of cell corners [degrees_N]
real :: l0, l1, l2, l3 ! Crossed products of differences in position [degrees_E degrees_N]
real :: p0, p1, p2, p3 ! Trinary unitary values reflecting the signs of the crossed products [nondim]
isPointInCell = .false.
xNE = G%geoLonBu(i ,j ) ; yNE = G%geoLatBu(i ,j )
Expand Down
2 changes: 1 addition & 1 deletion src/framework/MOM_diag_mediator.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3228,7 +3228,7 @@ subroutine diag_mediator_init(G, GV, US, nz, param_file, diag_cs, doc_file_dir)

call get_param(param_file, mdl, 'DIAG_MISVAL', diag_cs%missing_value, &
'Set the default missing value to use for diagnostics.', &
default=1.e20)
units="various", default=1.e20)
call get_param(param_file, mdl, 'DIAG_AS_CHKSUM', diag_cs%diag_as_chksum, &
'Instead of writing diagnostics to the diag manager, write '//&
'a text file containing the checksum (bitcount) of the array.', &
Expand Down
36 changes: 18 additions & 18 deletions src/ice_shelf/MOM_ice_shelf_dynamics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module MOM_ice_shelf_dynamics
real, pointer, dimension(:,:) :: ice_visc => NULL() !< Glen's law ice viscosity (Pa s),
!! in [R L2 T-1 ~> kg m-1 s-1].
real, pointer, dimension(:,:) :: AGlen_visc => NULL() !< Ice-stiffness parameter in Glen's law ice viscosity,
!! often in [kg-1/3 m-1/3 s-1].
!! often in [Pa-3 s-1] if n_Glen is 3.
real, pointer, dimension(:,:) :: thickness_bdry_val => NULL() !< The ice thickness at an inflowing boundary [Z ~> m].
real, pointer, dimension(:,:) :: u_bdry_val => NULL() !< The zonal ice velocity at inflowing boundaries
!! [L yr-1 ~> m yr-1]
Expand Down Expand Up @@ -149,9 +149,9 @@ module MOM_ice_shelf_dynamics
real :: min_thickness_simple_calve !< min. ice shelf thickness criteria for calving [Z ~> m].

real :: cg_tolerance !< The tolerance in the CG solver, relative to initial residual, that
!! determines when to stop the conjugate gradient iterations.
!! determines when to stop the conjugate gradient iterations [nondim].
real :: nonlinear_tolerance !< The fractional nonlinear tolerance, relative to the initial error,
!! that sets when to stop the iterative velocity solver
!! that sets when to stop the iterative velocity solver [nondim]
integer :: cg_max_iterations !< The maximum number of iterations that can be used in the CG solver
integer :: nonlin_solve_err_mode !< 1: exit vel solve based on nonlin residual
!! 2: exit based on "fixed point" metric (|u - u_last| / |u| < tol) where | | is infty-norm
Expand Down Expand Up @@ -265,7 +265,7 @@ subroutine register_ice_shelf_dyn_restarts(G, US, param_file, CS, restart_CS)
allocate( CS%t_shelf(isd:ied,jsd:jed), source=-10.0*US%degC_to_C ) ! [C ~> degC]
allocate( CS%ice_visc(isd:ied,jsd:jed), source=0.0 )
allocate( CS%AGlen_visc(isd:ied,jsd:jed), source=2.261e-25 ) ! [Pa-3 s-1]
allocate( CS%basal_traction(isd:ied,jsd:jed), source=0.0 ) ! [Pa]
allocate( CS%basal_traction(isd:ied,jsd:jed), source=0.0 ) ! [R L2 T-2 ~> Pa]
allocate( CS%C_basal_friction(isd:ied,jsd:jed), source=5.0e10 ) ! [Pa (m-1 s)^n_sliding]
allocate( CS%OD_av(isd:ied,jsd:jed), source=0.0 )
allocate( CS%ground_frac(isd:ied,jsd:jed), source=0.0 )
Expand Down Expand Up @@ -389,7 +389,7 @@ subroutine initialize_ice_shelf_dyn(param_file, Time, ISS, CS, G, US, diag, new_
"GROUNDING_LINE_INTERP_SUBGRID_N must be a positive integer if GL regularization is used")
call get_param(param_file, mdl, "ICE_SHELF_CFL_FACTOR", CS%CFL_factor, &
"A factor used to limit timestep as CFL_FACTOR * min (\Delta x / u). "//&
"This is only used with an ice-only model.", default=0.25)
"This is only used with an ice-only model.", units="nondim", default=0.25)
endif
call get_param(param_file, mdl, "RHO_0", CS%density_ocean_avg, &
"avg ocean density used in floatation cond", &
Expand All @@ -414,9 +414,9 @@ subroutine initialize_ice_shelf_dyn(param_file, Time, ISS, CS, G, US, diag, new_
call get_param(param_file, mdl, "DENSITY_ICE", CS%density_ice, &
"A typical density of ice.", units="kg m-3", default=917.0, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "CONJUGATE_GRADIENT_TOLERANCE", CS%cg_tolerance, &
"tolerance in CG solver, relative to initial residual", default=1.e-6)
"tolerance in CG solver, relative to initial residual", units="nondim", default=1.e-6)
call get_param(param_file, mdl, "ICE_NONLINEAR_TOLERANCE", CS%nonlinear_tolerance, &
"nonlin tolerance in iterative velocity solve",default=1.e-6)
"nonlin tolerance in iterative velocity solve", units="nondim", default=1.e-6)
call get_param(param_file, mdl, "CONJUGATE_GRADIENT_MAXIT", CS%cg_max_iterations, &
"max iteratiions in CG solver", default=2000)
call get_param(param_file, mdl, "THRESH_FLOAT_COL_DEPTH", CS%thresh_float_col_depth, &
Expand Down Expand Up @@ -1298,7 +1298,7 @@ subroutine ice_shelf_solve_inner(CS, ISS, G, US, u_shlf, v_shlf, taudx, taudy, H

! R,u,v,Z valid region moves in by 1

! beta_k = (Z \dot R) / (Zold \dot Rold}
! beta_k = (Z \dot R) / (Zold \dot Rold)
sum_vec(:,:) = 0.0 ; sum_vec_2(:,:) = 0.0

do j=jscq,jecq ; do i=iscq,iecq
Expand Down Expand Up @@ -2639,17 +2639,17 @@ subroutine calc_shelf_visc(CS, ISS, G, US, u_shlf, v_shlf)
(v_shlf(I-1,J) * Phi(6,2*(jq-1)+iq,i,j) + &
v_shlf(I,J-1) * Phi(4,2*(jq-1)+iq,i,j)) )
enddo ; enddo
if (trim(CS%ice_viscosity_compute)=="CONSTANT") then
CS%ice_visc(i,j) =1e15 * US%kg_m3_to_R*US%m_to_L*US%m_s_to_L_T * (G%areaT(i,j) * ISS%h_shelf(i,j))
! constant viscocity for debugging
elseif (trim(CS%ice_viscosity_compute)=="MODEL") then
CS%ice_visc(i,j) = 0.5 * Visc_coef * (G%areaT(i,j) * ISS%h_shelf(i,j)) * &
if (trim(CS%ice_viscosity_compute)=="CONSTANT") then
CS%ice_visc(i,j) = 1e15 * US%kg_m3_to_R*US%m_to_L*US%m_s_to_L_T * (G%areaT(i,j) * ISS%h_shelf(i,j))
! constant viscocity for debugging
elseif (trim(CS%ice_viscosity_compute)=="MODEL") then
CS%ice_visc(i,j) = 0.5 * Visc_coef * (G%areaT(i,j) * ISS%h_shelf(i,j)) * &
(US%s_to_T**2 * (ux**2 + vy**2 + ux*vy + 0.25*(uy+vx)**2 + eps_min**2))**((1.-n_g)/(2.*n_g))
elseif(trim(CS%ice_viscosity_compute)=="OBS") then
if (CS%AGlen_visc(i,j) >0) CS%ice_visc(i,j) =CS%AGlen_visc(i,j)*(G%areaT(i,j) * ISS%h_shelf(i,j))
! Here CS%Aglen_visc(i,j) is the ice viscocity [Pa s-1] computed from obs and read from a file
endif
endif
elseif (trim(CS%ice_viscosity_compute)=="OBS") then
if (CS%AGlen_visc(i,j) >0) CS%ice_visc(i,j) = CS%AGlen_visc(i,j)*(G%areaT(i,j) * ISS%h_shelf(i,j))
! Here CS%Aglen_visc(i,j) is the ice viscocity [Pa s-1] computed from obs and read from a file
endif
endif
enddo ; enddo
deallocate(Phi)
end subroutine calc_shelf_visc
Expand Down
2 changes: 1 addition & 1 deletion src/ocean_data_assim/MOM_oda_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ subroutine init_oda(Time, G, GV, US, diag_CS, CS)
if (CS%do_bias_adjustment) then
call get_param(PF, mdl, "TRACER_ADJUSTMENT_FACTOR", CS%bias_adjustment_multiplier, &
"A multiplicative scaling factor for the climatological tracer tendency adjustment ", &
default=1.0)
units="nondim", default=1.0)
endif
call get_param(PF, mdl, "USE_BASIN_MASK", CS%use_basin_mask, &
"If true, add a basin mask to delineate weakly connected "//&
Expand Down