Skip to content

Commit

Permalink
Merge branch 'dev/gfdl' into PointAccel_scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallward committed Nov 28, 2021
2 parents afecce4 + 2a82bbd commit 0d5fc03
Show file tree
Hide file tree
Showing 55 changed files with 549 additions and 254 deletions.
10 changes: 5 additions & 5 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1275,8 +1275,8 @@ subroutine build_rho_grid( G, GV, US, h, tv, dzInterface, remapCS, CS, frac_shel
!! [H ~> m or kg m-2]
type(remapping_CS), intent(in) :: remapCS !< The remapping control structure
type(regridding_CS), intent(in) :: CS !< Regridding control structure
real, dimension(SZI_(G),SZJ_(G)), optional, intent(in) :: frac_shelf_h !< Fractional
!! ice shelf coverage [nodim]
real, dimension(SZI_(G),SZJ_(G)), optional, intent(in) :: frac_shelf_h !< Fractional ice
!! shelf coverage [nondim]
! Local variables
integer :: nz
integer :: i, j, k
Expand Down Expand Up @@ -1412,14 +1412,14 @@ subroutine build_grid_HyCOM1( G, GV, US, h, tv, h_new, dzInterface, CS, frac_she
type(regridding_CS), intent(in) :: CS !< Regridding control structure
real, dimension(SZI_(G),SZJ_(G),CS%nk), intent(inout) :: h_new !< New layer thicknesses [H ~> m or kg m-2]
real, dimension(SZI_(G),SZJ_(G),CS%nk+1), intent(inout) :: dzInterface !< Changes in interface position
real, dimension(SZI_(G),SZJ_(G)), optional, intent(in) :: frac_shelf_h !< Fractional
!! ice shelf coverage [nodim]
real, dimension(SZI_(G),SZJ_(G)), optional, intent(in) :: frac_shelf_h !< Fractional ice shelf
!! coverage [nondim]

! Local variables
real, dimension(SZK_(GV)+1) :: z_col ! Source interface positions relative to the surface [H ~> m or kg m-2]
real, dimension(CS%nk+1) :: z_col_new ! New interface positions relative to the surface [H ~> m or kg m-2]
real, dimension(SZK_(GV)+1) :: dz_col ! The realized change in z_col [H ~> m or kg m-2]
real, dimension(SZK_(GV)) :: p_col ! Layer center pressure [Pa]
real, dimension(SZK_(GV)) :: p_col ! Layer center pressure [R L2 T-2 ~> Pa]
integer :: i, j, k, nki
real :: depth, nominalDepth
real :: h_neglect, h_neglect_edge
Expand Down
3 changes: 2 additions & 1 deletion src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,8 @@ subroutine initialize_MOM(Time, Time_init, param_file, dirs, CS, restart_CSp, &

integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
integer :: IsdB, IedB, JsdB, JedB
real :: dtbt ! The barotropic timestep [s]
real :: dtbt ! If negative, this specifies the barotropic timestep as a fraction
! of the maximum stable value [nondim].

real, allocatable, dimension(:,:) :: eta ! free surface height or column mass [H ~> m or kg m-2]
real, allocatable, dimension(:,:) :: area_shelf_in ! area occupied by ice shelf [L2 ~> m2]
Expand Down
5 changes: 5 additions & 0 deletions src/core/MOM_CoriolisAdv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module MOM_CoriolisAdv

!> Control structure for mom_coriolisadv
type, public :: CoriolisAdv_CS ; private
logical :: initialized = .false. !< True if this control structure has been initialized.
integer :: Coriolis_Scheme !< Selects the discretization for the Coriolis terms.
!! Valid values are:
!! - SADOURNY75_ENERGY - Sadourny, 1975
Expand Down Expand Up @@ -245,6 +246,9 @@ subroutine CorAdCalc(u, v, h, uh, vh, CAu, CAv, OBC, AD, G, GV, US, CS)
! v(is-1:ie+2,js-1:je+1), u(is-1:ie+1,js-1:je+2), h(is-1:ie+2,js-1:je+2),
! uh(is-1,ie,js:je+1) and vh(is:ie+1,js-1:je).

if (.not.CS%initialized) call MOM_error(FATAL, &
"MOM_CoriolisAdv: Module must be initialized before it is used.")

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB ; nz = GV%ke
vol_neglect = GV%H_subroundoff * (1e-4 * US%m_to_L)**2
Expand Down Expand Up @@ -1123,6 +1127,7 @@ subroutine CoriolisAdv_init(Time, G, GV, US, param_file, diag, AD, CS)
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed ; nz = GV%ke
IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB

CS%initialized = .true.
CS%diag => diag ; CS%Time => Time

! Read all relevant parameters and write them to the model log.
Expand Down
8 changes: 8 additions & 0 deletions src/core/MOM_PressureForce_FV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ module MOM_PressureForce_FV

!> Finite volume pressure gradient control structure
type, public :: PressureForce_FV_CS ; private
logical :: initialized = .false. !< True if this control structure has been initialized.
logical :: tides !< If true, apply tidal momentum forcing.
real :: Rho0 !< The density used in the Boussinesq
!! approximation [R ~> kg m-3].
Expand Down Expand Up @@ -163,6 +164,9 @@ subroutine PressureForce_FV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB
EOSdom(1) = Isq - (G%isd-1) ; EOSdom(2) = G%iec+1 - (G%isd-1)

if (.not.CS%initialized) call MOM_error(FATAL, &
"MOM_PressureForce_FV_nonBouss: Module must be initialized before it is used.")

if (CS%Stanley_T2_det_coeff>=0.) call MOM_error(FATAL, &
"MOM_PressureForce_FV_nonBouss: The Stanley parameterization is not yet"//&
"implemented in non-Boussinesq mode.")
Expand Down Expand Up @@ -497,6 +501,9 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB
EOSdom(1) = Isq - (G%isd-1) ; EOSdom(2) = G%iec+1 - (G%isd-1)

if (.not.CS%initialized) call MOM_error(FATAL, &
"MOM_PressureForce_FV_Bouss: Module must be initialized before it is used.")

use_p_atm = associated(p_atm)
use_EOS = associated(tv%eqn_of_state)
do i=Isq,Ieq+1 ; p0(i) = 0.0 ; enddo
Expand Down Expand Up @@ -809,6 +816,7 @@ subroutine PressureForce_FV_init(Time, G, GV, US, param_file, diag, CS, tides_CS
character(len=40) :: mdl ! This module's name.
logical :: use_ALE

CS%initialized = .true.
CS%diag => diag ; CS%Time => Time
if (present(tides_CSp)) &
CS%tides_CSp => tides_CSp
Expand Down
8 changes: 8 additions & 0 deletions src/core/MOM_PressureForce_Montgomery.F90
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module MOM_PressureForce_Mont

!> Control structure for the Montgomery potential form of pressure gradient
type, public :: PressureForce_Mont_CS ; private
logical :: initialized = .false. !< True if this control structure has been initialized.
logical :: tides !< If true, apply tidal momentum forcing.
real :: Rho0 !< The density used in the Boussinesq
!! approximation [R ~> kg m-3].
Expand Down Expand Up @@ -137,6 +138,9 @@ subroutine PressureForce_Mont_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, p_atm, pb
is_split = present(pbce)
use_EOS = associated(tv%eqn_of_state)

if (.not.CS%initialized) call MOM_error(FATAL, &
"MOM_PressureForce_Mont: Module must be initialized before it is used.")

if (use_EOS) then
if (query_compressible(tv%eqn_of_state)) call MOM_error(FATAL, &
"PressureForce_Mont_nonBouss: The Montgomery form of the pressure force "//&
Expand Down Expand Up @@ -422,6 +426,9 @@ subroutine PressureForce_Mont_Bouss(h, tv, PFu, PFv, G, GV, US, CS, p_atm, pbce,
is_split = present(pbce)
use_EOS = associated(tv%eqn_of_state)

if (.not.CS%initialized) call MOM_error(FATAL, &
"MOM_PressureForce_Mont: Module must be initialized before it is used.")

if (use_EOS) then
if (query_compressible(tv%eqn_of_state)) call MOM_error(FATAL, &
"PressureForce_Mont_Bouss: The Montgomery form of the pressure force "//&
Expand Down Expand Up @@ -829,6 +836,7 @@ subroutine PressureForce_Mont_init(Time, G, GV, US, param_file, diag, CS, tides_
# include "version_variable.h"
character(len=40) :: mdl ! This module's name.

CS%initialized = .true.
CS%diag => diag ; CS%Time => Time
if (present(tides_CSp)) &
CS%tides_CSp => tides_CSp
Expand Down
44 changes: 27 additions & 17 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ module MOM_barotropic
logical :: integral_bt_cont !< If true, use the time-integrated velocity over the barotropic steps
!! to determine the integrated transports used to update the continuity
!! equation. Otherwise the transports are the sum of the transports
!! based on ]a series of instantaneous velocities and the BT_CONT_TYPE
!! based on a series of instantaneous velocities and the BT_CONT_TYPE
!! for transports. This is only valid if a BT_CONT_TYPE is used.
logical :: Nonlinear_continuity !< If true, the barotropic continuity equation
!! uses the full ocean thickness for transport.
Expand Down Expand Up @@ -338,9 +338,9 @@ module MOM_barotropic
!! the time-integrated barotropic velocity [L ~> m], beyond which the marginal
!! open face area is FA_u_EE. uBT_EE must be non-positive.
real :: uh_crvW !< The curvature of face area with velocity for flow from the west [H T2 L-1 ~> s2 or kg s2 m-3]
!! or [H L-1 ~> 1 or kg m-3] with INTEGRAL_BT_CONTINUITY.
!! or [H L-1 ~> nondim or kg m-3] with INTEGRAL_BT_CONTINUITY.
real :: uh_crvE !< The curvature of face area with velocity for flow from the east [H T2 L-1 ~> s2 or kg s2 m-3]
!! or [H L-1 ~> 1 or kg m-3] with INTEGRAL_BT_CONTINUITY.
!! or [H L-1 ~> nondim or kg m-3] with INTEGRAL_BT_CONTINUITY.
real :: uh_WW !< The zonal transport when ubt=ubt_WW [H L2 T-1 ~> m3 s-1 or kg s-1], or the equivalent
!! time-integrated transport with INTEGRAL_BT_CONTINUITY [H L2 ~> m3 or kg].
real :: uh_EE !< The zonal transport when ubt=ubt_EE [H L2 T-1 ~> m3 s-1 or kg s-1], or the equivalent
Expand All @@ -364,9 +364,9 @@ module MOM_barotropic
!! the time-integrated barotropic velocity [L ~> m], beyond which the marginal
!! open face area is FA_v_NN. vBT_NN must be non-positive.
real :: vh_crvS !< The curvature of face area with velocity for flow from the south [H T2 L-1 ~> s2 or kg s2 m-3]
!! or [H L-1 ~> 1 or kg m-3] with INTEGRAL_BT_CONTINUITY.
!! or [H L-1 ~> nondim or kg m-3] with INTEGRAL_BT_CONTINUITY.
real :: vh_crvN !< The curvature of face area with velocity for flow from the north [H T2 L-1 ~> s2 or kg s2 m-3]
!! or [H L-1 ~> 1 or kg m-3] with INTEGRAL_BT_CONTINUITY.
!! or [H L-1 ~> nondim or kg m-3] with INTEGRAL_BT_CONTINUITY.
real :: vh_SS !< The meridional transport when vbt=vbt_SS [H L2 T-1 ~> m3 s-1 or kg s-1], or the equivalent
!! time-integrated transport with INTEGRAL_BT_CONTINUITY [H L2 ~> m3 or kg].
real :: vh_NN !< The meridional transport when vbt=vbt_NN [H L2 T-1 ~> m3 s-1 or kg s-1], or the equivalent
Expand Down Expand Up @@ -622,24 +622,23 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
vhbt_prev, vhbt_sum_prev, & ! Previous transports stored for OBCs [L2 H T-1 ~> m3 s-1]
vbt_int_prev, & ! Previous value of time-integrated velocity stored for OBCs [L ~> m]
vhbt_int_prev ! Previous value of time-integrated transport stored for OBCs [L2 H ~> m3]
real :: mass_to_Z ! The depth unit conversion divided by the mean density (Rho0) [Z m-1 R-1 ~> m3 kg-1] !### R-1
real :: mass_accel_to_Z ! The inverse of the mean density (Rho0) [R-1 ~> m3 kg-1].
real :: visc_rem ! A work variable that may equal visc_rem_[uv]. Nondim.
real :: mass_to_Z ! The inverse of the the mean density (Rho0) [R-1 ~> m3 kg-1]
real :: visc_rem ! A work variable that may equal visc_rem_[uv] [nondim]
real :: vel_prev ! The previous velocity [L T-1 ~> m s-1].
real :: dtbt ! The barotropic time step [T ~> s].
real :: bebt ! A copy of CS%bebt [nondim].
real :: be_proj ! The fractional amount by which velocities are projected
! when project_velocity is true. For now be_proj is set
! when project_velocity is true [nondim]. For now be_proj is set
! to equal bebt, as they have similar roles and meanings.
real :: Idt ! The inverse of dt [T-1 ~> s-1].
real :: det_de ! The partial derivative due to self-attraction and loading
! of the reference geopotential with the sea surface height.
! of the reference geopotential with the sea surface height [nondim].
! This is typically ~0.09 or less.
real :: dgeo_de ! The constant of proportionality between geopotential and
! sea surface height. It is a nondimensional number of
! sea surface height [nondim]. It is a nondimensional number of
! order 1. For stability, this may be made larger
! than the physical problem would suggest.
real :: Instep ! The inverse of the number of barotropic time steps to take.
real :: Instep ! The inverse of the number of barotropic time steps to take [nondim].
real :: wt_end ! The weighting of the final value of eta_PF [nondim]
integer :: nstep ! The number of barotropic time steps to take.
type(time_type) :: &
Expand Down Expand Up @@ -694,6 +693,9 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
integer :: ioff, joff
integer :: l_seg

if (.not.CS%module_is_initialized) call MOM_error(FATAL, &
"btstep: Module MOM_barotropic must be initialized before it is used.")

if (.not.CS%split) return
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
Isq = G%IscB ; Ieq = G%IecB ; Jsq = G%JscB ; Jeq = G%JecB
Expand Down Expand Up @@ -769,8 +771,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
Idtbt = 1.0 / dtbt
bebt = CS%bebt
be_proj = CS%bebt
mass_accel_to_Z = 1.0 / GV%Rho0
mass_to_Z = US%m_to_Z / GV%Rho0 !### THis should be the same as mass_accel_to_Z.
mass_to_Z = 1.0 / GV%Rho0

!--- setup the weight when computing vbt_trans and ubt_trans
if (project_velocity) then
Expand Down Expand Up @@ -1240,7 +1241,7 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif
endif

BT_force_u(I,j) = forces%taux(I,j) * mass_accel_to_Z * CS%IDatu(I,j)*visc_rem_u(I,j,1)
BT_force_u(I,j) = forces%taux(I,j) * mass_to_Z * CS%IDatu(I,j)*visc_rem_u(I,j,1)
else
BT_force_u(I,j) = 0.0
endif ; enddo ; enddo
Expand All @@ -1266,11 +1267,11 @@ subroutine btstep(U_in, V_in, eta_in, dt, bc_accel_u, bc_accel_v, forces, pbce,
endif
endif

BT_force_v(i,J) = forces%tauy(i,J) * mass_accel_to_Z * CS%IDatv(i,J)*visc_rem_v(i,J,1)
BT_force_v(i,J) = forces%tauy(i,J) * mass_to_Z * CS%IDatv(i,J)*visc_rem_v(i,J,1)
else
BT_force_v(i,J) = 0.0
endif ; enddo ; enddo
if (associated(taux_bot) .and. associated(tauy_bot)) then
if (associated(taux_bot) .and. associated(tauy_bot)) then
!$OMP parallel do default(shared)
do j=js,je ; do I=is-1,ie ; if (G%mask2dCu(I,j) > 0.0) then
BT_force_u(I,j) = BT_force_u(I,j) - taux_bot(I,j) * mass_to_Z * CS%IDatu(I,j)
Expand Down Expand Up @@ -2764,6 +2765,9 @@ subroutine set_dtbt(G, GV, US, CS, eta, pbce, BT_cont, gtot_est, SSH_add)
character(len=200) :: mesg
integer :: i, j, k, is, ie, js, je, nz

if (.not.CS%module_is_initialized) call MOM_error(FATAL, &
"set_dtbt: Module MOM_barotropic must be initialized before it is used.")

if (.not.CS%split) return
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
MS%isdw = G%isd ; MS%iedw = G%ied ; MS%jsdw = G%jsd ; MS%jedw = G%jed
Expand Down Expand Up @@ -3298,6 +3302,9 @@ subroutine btcalc(h, G, GV, CS, h_u, h_v, may_use_default, OBC)

! This section interpolates thicknesses onto u & v grid points with the
! second order accurate estimate h = 2*(h+ * h-)/(h+ + h-).
if (.not.CS%module_is_initialized) call MOM_error(FATAL, &
"btcalc: Module MOM_barotropic must be initialized before it is used.")

if (.not.CS%split) return

use_default = .false.
Expand Down Expand Up @@ -4186,6 +4193,9 @@ subroutine bt_mass_source(h, eta, set_cor, G, GV, CS)
! thicknesses [H ~> m or kg m-2].
integer :: is, ie, js, je, nz, i, j, k

if (.not.CS%module_is_initialized) call MOM_error(FATAL, "bt_mass_source: "// &
"Module MOM_barotropic must be initialized before it is used.")

if (.not.CS%split) return

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_checksum_packages.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ subroutine MOM_state_chksum_3arg(mesg, u, v, h, G, GV, US, haloshift, symmetric)
integer, optional, intent(in) :: haloshift !< The width of halos to check (default 0).
logical, optional, intent(in) :: symmetric !< If true, do checksums on the fully
!! symmetric computational domain.
real :: L_T_to_m_s ! A rescaling factor for velocities [m T s-1 L-1 ~> nondim] or [nondim]
real :: L_T_to_m_s ! A rescaling factor for velocities [m T s-1 L-1 ~> 1] or [1]
integer :: hs
logical :: sym

Expand Down
6 changes: 6 additions & 0 deletions src/core/MOM_continuity_PPM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module MOM_continuity_PPM

!> Control structure for mom_continuity_ppm
type, public :: continuity_PPM_CS ; private
logical :: initialized = .false. !< True if this control structure has been initialized.
type(diag_ctrl), pointer :: diag !< Diagnostics control structure.
logical :: upwind_1st !< If true, use a first-order upwind scheme.
logical :: monotonic !< If true, use the Colella & Woodward monotonic
Expand Down Expand Up @@ -134,6 +135,9 @@ subroutine continuity_PPM(u, v, hin, h, uh, vh, dt, G, GV, US, CS, OBC, uhbt, vh

h_min = GV%Angstrom_H

if (.not.CS%initialized) call MOM_error(FATAL, &
"MOM_continuity_PPM: Module must be initialized before it is used.")

x_first = (MOD(G%first_direction,2) == 0)

if (present(visc_rem_u) .neqv. present(visc_rem_v)) call MOM_error(FATAL, &
Expand Down Expand Up @@ -2202,6 +2206,8 @@ subroutine continuity_PPM_init(Time, G, GV, US, param_file, diag, CS)
real :: tol_eta_m ! An unscaled version of tol_eta [m].
character(len=40) :: mdl = "MOM_continuity_PPM" ! This module's name.

CS%initialized = .true.

! Read all relevant parameters and write them to the model log.
call log_version(param_file, mdl, version, "")
call get_param(param_file, mdl, "MONOTONIC_CONTINUITY", CS%monotonic, &
Expand Down
4 changes: 2 additions & 2 deletions src/core/MOM_density_integrals.F90
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ subroutine int_density_dz_generic_ppm(k, tv, T_t, T_b, S_t, S_b, e, &
!! subtracted out to reduce the magnitude of each of the integrals.
real, intent(in) :: rho_0 !< A density [R ~> kg m-3] or [kg m-3], that is used to calculate
!! the pressure (as p~=-z*rho_0*G_e) used in the equation of state.
real, intent(in) :: G_e !< The Earth's gravitational acceleration [m s-2]
real, intent(in) :: G_e !< The Earth's gravitational acceleration [L2 Z-1 T-2 ~> m s-2]
real, intent(in) :: dz_subroundoff !< A minuscule thickness change [Z ~> m]
real, dimension(SZI_(HI),SZJ_(HI)), &
intent(in) :: bathyT !< The depth of the bathymetry [Z ~> m]
Expand Down Expand Up @@ -1457,7 +1457,7 @@ subroutine int_spec_vol_dp_generic_plm(T_t, T_b, S_t, S_b, p_t, p_b, alpha_ref,
real :: wt_t(5), wt_b(5) ! Weights of top and bottom values at quadrature points [nondim]
real :: T_top, T_bot, S_top, S_bot, P_top, P_bot

real :: alpha_anom ! The depth averaged specific density anomaly [m3 kg-1]
real :: alpha_anom ! The depth averaged specific density anomaly [R-1 ~> m3 kg-1] or [m3 kg-1]
real :: dp ! The pressure change through a layer [R L2 T-2 ~> Pa]
real :: dp_90(2:4) ! The pressure change through a layer divided by 90 [R L2 T-2 ~> Pa]
real :: hWght ! A pressure-thickness below topography [R L2 T-2 ~> Pa]
Expand Down
Loading

0 comments on commit 0d5fc03

Please sign in to comment.