Skip to content

Commit

Permalink
Merge pull request #8 from Hallberg-NOAA/rescaled_Rad_Earth
Browse files Browse the repository at this point in the history
+Add G%Rad_Earth_L and related code simplification
  • Loading branch information
marshallward authored Nov 27, 2021
2 parents 4a7ab45 + dc4e707 commit 470ed7b
Show file tree
Hide file tree
Showing 14 changed files with 165 additions and 158 deletions.
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
9 changes: 5 additions & 4 deletions src/core/MOM_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ module MOM_grid
! 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 :: len_lat = 0. !< The latitudinal (or y-coord) extent of physical domain
real :: len_lon = 0. !< The longitudinal (or x-coord) extent of physical domain
real :: Rad_Earth = 6.378e6 !< The radius of the planet [m].
real :: max_depth !< The maximum depth of the ocean in depth units [Z ~> 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]
real :: Rad_Earth_L !< The radius of the planet in rescaled units [L ~> m]
real :: max_depth !< The maximum depth of the ocean in depth units [Z ~> m]
end type ocean_grid_type

contains
Expand Down
6 changes: 4 additions & 2 deletions src/core/MOM_transcribe_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ subroutine copy_dyngrid_to_MOM_grid(dG, oG, US)
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
oG%Rad_Earth = dG%Rad_Earth ; oG%max_depth = dG%max_depth
oG%Rad_Earth = dG%Rad_Earth ; oG%Rad_Earth_L = dG%Rad_Earth_L
oG%max_depth = dG%max_depth

! Update the halos in case the dynamic grid has smaller halos than the ocean grid.
call pass_var(oG%areaT, oG%Domain)
Expand Down Expand Up @@ -272,7 +273,8 @@ subroutine copy_MOM_grid_to_dyngrid(oG, dG, US)
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
dG%Rad_Earth = oG%Rad_Earth ; dG%max_depth = oG%max_depth
dG%Rad_Earth = oG%Rad_Earth ; dG%Rad_Earth_L = oG%Rad_Earth_L
dG%max_depth = oG%max_depth

! Update the halos in case the dynamic grid has smaller halos than the ocean grid.
call pass_var(dG%areaT, dG%Domain)
Expand Down
4 changes: 2 additions & 2 deletions src/diagnostics/MOM_sum_output.F90
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@ subroutine write_energy(u, v, h, tv, day, n, G, GV, US, CS, tracer_CSp, dt_forci
Temp_int, Salt_int ! Layer and cell integrated heat and salt [J] and [g Salt].
real :: HL2_to_kg ! A conversion factor from a thickness-volume to mass [kg H-1 L-2 ~> kg m-3 or 1]
real :: KE_scale_factor ! The combination of unit rescaling factors in the kinetic energy
! calculation [kg T2 H-1 L-2 s-2 ~> kg m-3 or nondim]
! calculation [kg T2 H-1 L-2 s-2 ~> kg m-3 or 1]
real :: PE_scale_factor ! The combination of unit rescaling factors in the potential energy
! calculation [kg T2 R-1 Z-1 L-2 s-2 ~> nondim]
! calculation [kg T2 R-1 Z-1 L-2 s-2 ~> 1]
integer :: num_nc_fields ! The number of fields that will actually go into
! the NetCDF file.
integer :: i, j, k, is, ie, js, je, ns, nz, m, Isq, Ieq, Jsq, Jeq, isr, ier, jsr, jer
Expand Down
14 changes: 6 additions & 8 deletions src/framework/MOM_dyn_horgrid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ module MOM_dyn_horgrid
! 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 :: len_lat = 0. !< The latitudinal (or y-coord) extent of physical domain
real :: len_lon = 0. !< The longitudinal (or x-coord) extent of physical domain
real :: Rad_Earth = 6.378e6 !< The radius of the planet [m].
real :: max_depth !< The maximum depth of the ocean [Z ~> 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]
real :: Rad_Earth_L !< The radius of the planet in rescaled units [L ~> m]
real :: max_depth !< The maximum depth of the ocean [Z ~> m]
end type dyn_horgrid_type

contains
Expand Down Expand Up @@ -361,6 +362,7 @@ subroutine rotate_dyn_horgrid(G_in, G, US, turns)
G%areaT_global = G_in%areaT_global
G%IareaT_global = G_in%IareaT_global
G%Rad_Earth = G_in%Rad_Earth
G%Rad_Earth_L = G_in%Rad_Earth_L
G%max_depth = G_in%max_depth

call set_derived_dyn_horgrid(G, US)
Expand Down Expand Up @@ -406,12 +408,8 @@ subroutine set_derived_dyn_horgrid(G, US)
type(unit_scale_type), optional, intent(in) :: US !< A dimensional unit scaling type
! Various inverse grid spacings and derived areas are calculated within this
! subroutine.
real :: m_to_L ! A unit conversion factor [L m-1 ~> nondim]
real :: L_to_m ! A unit conversion factor [L m-1 ~> nondim]
integer :: i, j, isd, ied, jsd, jed
integer :: IsdB, IedB, JsdB, JedB
m_to_L = 1.0 ; if (present(US)) m_to_L = US%m_to_L
L_to_m = 1.0 ; if (present(US)) L_to_m = US%L_to_m

isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed
IsdB = G%IsdB ; IedB = G%IedB ; JsdB = G%JsdB ; JedB = G%JedB
Expand Down
Loading

0 comments on commit 470ed7b

Please sign in to comment.