Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into gl90-param
Browse files Browse the repository at this point in the history
  • Loading branch information
NoraLoose committed Dec 13, 2022
2 parents d659a4e + 490bfca commit e253c9b
Show file tree
Hide file tree
Showing 33 changed files with 587 additions and 476 deletions.
258 changes: 151 additions & 107 deletions ac/makedep

Large diffs are not rendered by default.

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
6 changes: 4 additions & 2 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4614,15 +4614,17 @@ subroutine barotropic_init(u, v, h, eta, Time, G, GV, US, param_file, diag, CS,
"gravity waves) to 1 (for a backward Euler treatment). "//&
"In practice, BEBT must be greater than about 0.05.", &
units="nondim", default=0.1)
! Note that dtbt_input is not rescaled because it has different units for
! positive [s] and negative [nondim] values.
call get_param(param_file, mdl, "DTBT", dtbt_input, &
"The barotropic time step, in s. DTBT is only used with "//&
"the split explicit time stepping. To set the time step "//&
"automatically based the maximum stable value use 0, or "//&
"a negative value gives the fraction of the stable value. "//&
"Setting DTBT to 0 is the same as setting it to -0.98. "//&
"The value of DTBT that will actually be used is an "//&
"integer fraction of DT, rounding down.", units="s or nondim",&
default = -0.98)
"integer fraction of DT, rounding down.", &
units="s or nondim", default=-0.98)
call get_param(param_file, mdl, "BT_USE_OLD_CORIOLIS_BRACKET_BUG", &
CS%use_old_coriolis_bracket_bug , &
"If True, use an order of operations that is not bitwise "//&
Expand Down
49 changes: 27 additions & 22 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 All @@ -146,8 +146,12 @@ module MOM_grid
gridLonB => NULL() !< The longitude of B points for the purpose of labeling the output axes.
!! On many grids this is the same as geoLonBu.
character(len=40) :: &
! Except on a Cartesian grid, these are usually some variant of "degrees".
x_axis_units, & !< The units that are used in labeling the x coordinate axes.
y_axis_units !< The units that are used in labeling the y coordinate axes.
y_axis_units, & !< The units that are used in labeling the y coordinate axes.
! These are internally generated names, including "m", "km", "deg_E" and "deg_N".
x_ax_unit_short, & !< A short description of the x-axis units for documenting parameter units
y_ax_unit_short !< A short description of the y-axis units for documenting parameter units

real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: &
bathyT !< Ocean bottom depth at tracer points, in depth units [Z ~> m].
Expand Down Expand Up @@ -181,8 +185,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 +225,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 +242,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 +482,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 +493,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/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5590,7 +5590,7 @@ end subroutine remap_OBC_fields
!> Adjust interface heights to fit the bathymetry and diagnose layer thickness.
!!
!! If the bottom most interface is below the topography then the bottom-most
!! layers are contracted to GV%Angstrom_m.
!! layers are contracted to GV%Angstrom_Z.
!! If the bottom most interface is above the topography then the entire column
!! is dilated (expanded) to fill the void.
!! @remark{There is a (hard-wired) "tolerance" parameter such that the
Expand Down
2 changes: 2 additions & 0 deletions src/core/MOM_transcribe_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ subroutine copy_dyngrid_to_MOM_grid(dG, oG, US)

! Copy various scalar variables and strings.
oG%x_axis_units = dG%x_axis_units ; oG%y_axis_units = dG%y_axis_units
oG%x_ax_unit_short = dG%x_ax_unit_short ; oG%y_ax_unit_short = dG%y_ax_unit_short
oG%areaT_global = dG%areaT_global ; oG%IareaT_global = dG%IareaT_global
oG%south_lat = dG%south_lat ; oG%west_lon = dG%west_lon
oG%len_lat = dG%len_lat ; oG%len_lon = dG%len_lon
Expand Down Expand Up @@ -291,6 +292,7 @@ subroutine copy_MOM_grid_to_dyngrid(oG, dG, US)

! Copy various scalar variables and strings.
dG%x_axis_units = oG%x_axis_units ; dG%y_axis_units = oG%y_axis_units
dG%x_ax_unit_short = oG%x_ax_unit_short ; dG%y_ax_unit_short = oG%y_ax_unit_short
dG%areaT_global = oG%areaT_global ; dG%IareaT_global = oG%IareaT_global
dG%south_lat = oG%south_lat ; dG%west_lon = oG%west_lon
dG%len_lat = oG%len_lat ; dG%len_lon = oG%len_lon
Expand Down
10 changes: 5 additions & 5 deletions src/core/MOM_verticalGrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ subroutine verticalGridInit( param_file, GV, US )
units="kg m-3", default=1035.0, scale=US%kg_m3_to_R)
call get_param(param_file, mdl, "BOUSSINESQ", GV%Boussinesq, &
"If true, make the Boussinesq approximation.", default=.true.)
call get_param(param_file, mdl, "ANGSTROM", GV%Angstrom_m, &
call get_param(param_file, mdl, "ANGSTROM", GV%Angstrom_Z, &
"The minimum layer thickness, usually one-Angstrom.", &
units="m", default=1.0e-10)
units="m", default=1.0e-10, scale=US%m_to_Z)
call get_param(param_file, mdl, "H_RESCALE_POWER", H_power, &
"An integer power of 2 that is used to rescale the model's "//&
"intenal units of thickness. Valid values range from -300 to 300.", &
Expand Down Expand Up @@ -156,21 +156,21 @@ subroutine verticalGridInit( param_file, GV, US )
GV%H_to_kg_m2 = US%R_to_kg_m3*GV%Rho0 * GV%H_to_m
GV%kg_m2_to_H = 1.0 / GV%H_to_kg_m2
GV%m_to_H = 1.0 / GV%H_to_m
GV%Angstrom_H = GV%m_to_H * GV%Angstrom_m
GV%Angstrom_H = GV%m_to_H * US%Z_to_m*GV%Angstrom_Z
GV%H_to_MKS = GV%H_to_m
else
GV%kg_m2_to_H = 1.0 / GV%H_to_kg_m2
GV%m_to_H = US%R_to_kg_m3*GV%Rho0 * GV%kg_m2_to_H
GV%H_to_m = GV%H_to_kg_m2 / (US%R_to_kg_m3*GV%Rho0)
GV%Angstrom_H = GV%Angstrom_m*1000.0*GV%kg_m2_to_H
GV%Angstrom_H = US%Z_to_m*GV%Angstrom_Z * 1000.0*GV%kg_m2_to_H
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 = 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
GV%Angstrom_Z = US%m_to_Z * GV%Angstrom_m
GV%Angstrom_m = US%Z_to_m * GV%Angstrom_Z

GV%H_to_RZ = GV%H_to_kg_m2 * US%kg_m3_to_R * US%m_to_Z
GV%RZ_to_H = GV%kg_m2_to_H * US%R_to_kg_m3 * US%Z_to_m
Expand Down
Loading

0 comments on commit e253c9b

Please sign in to comment.