Skip to content

Commit

Permalink
+Replace SZK_(G) with SZK_(GV)
Browse files Browse the repository at this point in the history
  Use the vertical extent from the verticalGrid_type argument GV instead of the
extent from the ocean_grid_type argument G to specify the vertical extent of
arrays in memory in array declarations.  There 18 subroutines where new
vertical_grid_type arguqments were needed, and some comments were corrected.  All
answers are bitwise identical, but there are new (non-optional) arguments to 18
subroutines.
  • Loading branch information
Hallberg-NOAA committed Dec 2, 2020
1 parent 8d9cecd commit 9b33343
Show file tree
Hide file tree
Showing 92 changed files with 1,677 additions and 1,690 deletions.
26 changes: 10 additions & 16 deletions config_src/unit_drivers/MOM_sum_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ program MOM_main
use MOM_coms, only : EFP_type, operator(+), operator(-), assignment(=), EFP_to_real, real_to_EFP
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
use MOM_cpu_clock, only : CLOCK_COMPONENT
! use MOM_diag_mediator, only : diag_mediator_end, diag_mediator_init
! use MOM_diag_mediator, only : diag_mediator_close_registration
use MOM_domains, only : MOM_domains_init, MOM_infra_init, MOM_infra_end
use MOM_error_handler, only : MOM_error, MOM_mesg, WARNING, FATAL, is_root_pe
use MOM_error_handler, only : MOM_set_verbosity
Expand All @@ -39,11 +37,10 @@ program MOM_main

type(param_file_type) :: param_file ! The structure indicating the file(s)
! containing all run-time parameters.
real :: max_depth
real :: max_depth ! The maximum ocean depth [m]
integer :: verbosity
integer :: num_sums
integer :: n, i, j, is, ie, js, je, nz
integer :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
integer :: n, i, j, is, ie, js, je, isd, ied, jsd, jed

integer :: unit, io_status, ierr
logical :: unit_in_use
Expand All @@ -55,8 +52,8 @@ program MOM_main
!-----------------------------------------------------------------------

character(len=4), parameter :: vers_num = 'v2.0'
! This include declares and sets the variable "version".
#include "version_variable.h"
! This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "MOM_main (MOM_sum_driver)" ! This module's name.
character(len=200) :: mesg

Expand Down Expand Up @@ -85,9 +82,8 @@ program MOM_main
! call diag_mediator_init(param_file)
call MOM_grid_init(grid, param_file)

is = grid%isc ; ie = grid%iec ; js = grid%jsc ; je = grid%jec ; nz = grid%ke
is = grid%isc ; ie = grid%iec ; js = grid%jsc ; je = grid%jec
isd = grid%isd ; ied = grid%ied ; jsd = grid%jsd ; jed = grid%jed
IsdB = grid%IsdB ; IedB = grid%IedB ; JsdB = grid%JsdB ; JedB = grid%JedB

! Read all relevant parameters and write them to the model log.
call log_version(param_file, "MOM", version, "")
Expand Down Expand Up @@ -165,27 +161,25 @@ program MOM_main

contains

!> This subroutine sets up the benchmark test case topography for debugging
subroutine benchmark_init_topog_local(D, G, param_file, max_depth)
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
real, dimension(SZI_(G),SZJ_(G)), intent(out) :: D !< The ocean bottom depth in m
type(param_file_type), intent(in) :: param_file !< A structure to parse for run-time parameters
real, intent(in) :: max_depth !< The maximum ocean depth in m
real, intent(in) :: max_depth !< The maximum ocean depth [m]

! This subroutine sets up the benchmark test case topography
real :: min_depth ! The minimum ocean depth in m.
real :: PI ! 3.1415926... calculated as 4*atan(1)
real :: D0 ! A constant to make the maximum !
! basin depth MAXIMUM_DEPTH. !
real :: x, y
! This include declares and sets the variable "version".
#include "version_variable.h"
character(len=40) :: mdl = "benchmark_initialize_topography" ! This subroutine's name.
! This include declares and sets the variable "version".
# include "version_variable.h"
character(len=40) :: mdl = "benchmark_init_topog_local" ! This subroutine's name.
integer :: i, j, is, ie, js, je, isd, ied, jsd, jed
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec
isd = G%isd ; ied = G%ied ; jsd = G%jsd ; jed = G%jed

call MOM_mesg(" benchmark_initialization.F90, benchmark_initialize_topography: setting topography", 5)

call log_version(param_file, mdl, version)
call get_param(param_file, mdl, "MINIMUM_DEPTH", min_depth, &
"The minimum depth of the ocean.", units="m", default=0.0)
Expand Down
12 changes: 6 additions & 6 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,7 @@ subroutine step_MOM_tracer_dyn(CS, G, GV, US, h, Time_local)
type(ocean_grid_type), intent(inout) :: G !< ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< ocean vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(in) :: h !< layer thicknesses after the transports [H ~> m or kg m-2]
type(time_type), intent(in) :: Time_local !< The model time at the end
!! of the time step.
Expand Down Expand Up @@ -1214,11 +1214,11 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
type(ocean_grid_type), intent(inout) :: G !< ocean grid structure
type(verticalGrid_type), intent(inout) :: GV !< ocean vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), &
intent(inout) :: u !< zonal velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), &
intent(inout) :: v !< meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(inout) :: h !< layer thickness [H ~> m or kg m-2]
type(thermo_var_ptrs), intent(inout) :: tv !< A structure pointing to various thermodynamic variables
type(forcing), intent(inout) :: fluxes !< pointers to forcing fields
Expand Down Expand Up @@ -1247,7 +1247,7 @@ subroutine step_MOM_thermo(CS, G, GV, US, u, v, h, tv, fluxes, dtdia, &
call enable_averages(dtdia, Time_end_thermo, CS%diag)

if (associated(CS%odaCS)) then
call apply_oda_tracer_increments(US%T_to_s*dtdia,G,tv,h,CS%odaCS)
call apply_oda_tracer_increments(US%T_to_s*dtdia, G, GV, tv, h, CS%odaCS)
endif

if (associated(fluxes%p_surf) .or. associated(fluxes%p_surf_full)) then
Expand Down Expand Up @@ -2800,7 +2800,7 @@ subroutine finish_MOM_initialization(Time, dirs, CS, restart_CSp)
if (CS%write_IC) then
allocate(restart_CSp_tmp)
restart_CSp_tmp = restart_CSp
allocate(z_interface(SZI_(G),SZJ_(G),SZK_(G)+1))
allocate(z_interface(SZI_(G),SZJ_(G),SZK_(GV)+1))
call find_eta(CS%h, CS%tv, G, GV, US, z_interface, eta_to_m=1.0)
call register_restart_field(z_interface, "eta", .true., restart_CSp_tmp, &
"Interface heights", "meter", z_grid='i')
Expand Down
38 changes: 19 additions & 19 deletions src/core/MOM_CoriolisAdv.F90
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,23 @@ module MOM_CoriolisAdv

!> Calculates the Coriolis and momentum advection contributions to the acceleration.
subroutine CorAdCalc(u, v, h, uh, vh, CAu, CAv, OBC, AD, G, GV, US, CS)
type(ocean_grid_type), intent(in) :: G !< Ocen grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u !< Zonal velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v !< Meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(in) :: h !< Layer thickness [H ~> m or kg m-2]
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: uh !< Zonal transport u*h*dy
!! [H L2 T-1 ~> m3 s-1 or kg s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: vh !< Meridional transport v*h*dx
!! [H L2 T-1 ~> m3 s-1 or kg s-1]
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(out) :: CAu !< Zonal acceleration due to Coriolis
type(ocean_grid_type), intent(in) :: G !< Ocen grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), intent(in) :: u !< Zonal velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), intent(in) :: v !< Meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer thickness [H ~> m or kg m-2]
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), intent(in) :: uh !< Zonal transport u*h*dy
!! [H L2 T-1 ~> m3 s-1 or kg s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), intent(in) :: vh !< Meridional transport v*h*dx
!! [H L2 T-1 ~> m3 s-1 or kg s-1]
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), intent(out) :: CAu !< Zonal acceleration due to Coriolis
!! and momentum advection [L T-2 ~> m s-2].
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(out) :: CAv !< Meridional acceleration due to Coriolis
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), intent(out) :: CAv !< Meridional acceleration due to Coriolis
!! and momentum advection [L T-2 ~> m s-2].
type(ocean_OBC_type), pointer :: OBC !< Open boundary control structure
type(accel_diag_ptrs), intent(inout) :: AD !< Storage for acceleration diagnostics
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(CoriolisAdv_CS), pointer :: CS !< Control structure for MOM_CoriolisAdv
type(ocean_OBC_type), pointer :: OBC !< Open boundary control structure
type(accel_diag_ptrs), intent(inout) :: AD !< Storage for acceleration diagnostics
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(CoriolisAdv_CS), pointer :: CS !< Control structure for MOM_CoriolisAdv

! Local variables
real, dimension(SZIB_(G),SZJB_(G)) :: &
Expand Down Expand Up @@ -174,7 +174,7 @@ subroutine CorAdCalc(u, v, h, uh, vh, CAu, CAv, OBC, AD, G, GV, US, CS)
min_fvq, & ! The minimum of the adjacent values of (-u) times absolute vorticity [L T-2 ~> m s-2].
max_fuq, & ! The maximum of the adjacent values of u times absolute vorticity [L T-2 ~> m s-2].
min_fuq ! The minimum of the adjacent values of u times absolute vorticity [L T-2 ~> m s-2].
real, dimension(SZIB_(G),SZJB_(G),SZK_(G)) :: &
real, dimension(SZIB_(G),SZJB_(G),SZK_(GV)) :: &
PV, & ! A diagnostic array of the potential vorticities [H-1 T-1 ~> m-1 s-1 or m2 kg-1 s-1].
RV ! A diagnostic array of the relative vorticities [T-1 ~> s-1].
real :: fv1, fv2, fu1, fu2 ! (f+rv)*v or (f+rv)*u [L T-2 ~> m s-2].
Expand Down Expand Up @@ -927,9 +927,9 @@ end subroutine CorAdCalc
subroutine gradKE(u, v, h, KE, KEx, KEy, k, OBC, G, GV, US, CS)
type(ocean_grid_type), intent(in) :: G !< Ocen grid structure
type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u !< Zonal velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v !< Meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(in) :: h !< Layer thickness [H ~> m or kg m-2]
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), intent(in) :: u !< Zonal velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), intent(in) :: v !< Meridional velocity [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer thickness [H ~> m or kg m-2]
real, dimension(SZI_(G) ,SZJ_(G) ), intent(out) :: KE !< Kinetic energy per unit mass [L2 T-2 ~> m2 s-2]
real, dimension(SZIB_(G),SZJ_(G) ), intent(out) :: KEx !< Zonal acceleration due to kinetic
!! energy gradient [L T-2 ~> m s-2]
Expand Down
8 changes: 4 additions & 4 deletions src/core/MOM_PressureForce.F90
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ subroutine PressureForce(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm, pbce, e
type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2]
type(thermo_var_ptrs), intent(in) :: tv !< A structure pointing to various thermodynamic variables
real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), &
intent(out) :: PFu !< Zonal pressure force acceleration [L T-2 ~> m s-2]
real, dimension(SZI_(G),SZJB_(G),SZK_(G)), &
real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), &
intent(out) :: PFv !< Meridional pressure force acceleration [L T-2 ~> m s-2]
type(PressureForce_CS), pointer :: CS !< Pressure force control structure
type(ALE_CS), pointer :: ALE_CSp !< ALE control structure
real, dimension(:,:), &
optional, pointer :: p_atm !< The pressure at the ice-ocean or
!! atmosphere-ocean interface [R L2 T-2 ~> Pa].
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
optional, intent(out) :: pbce !< The baroclinic pressure anomaly in each layer
!! due to eta anomalies [L2 T-2 H-1 ~> m s-2 or m4 s-2 kg-1].
real, dimension(SZI_(G),SZJ_(G)), &
Expand Down
Loading

0 comments on commit 9b33343

Please sign in to comment.