Skip to content

Commit

Permalink
Merge pull request #1268 from Hallberg-NOAA/ke_from_GV
Browse files Browse the repository at this point in the history
+Use verticalGrid_type to specify vertical extents
  • Loading branch information
adcroft authored Jan 6, 2021
2 parents d819ccf + 2fd4596 commit e68d31a
Show file tree
Hide file tree
Showing 131 changed files with 4,685 additions and 4,668 deletions.
66 changes: 33 additions & 33 deletions config_src/coupled_driver/ocean_model_MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,9 @@ subroutine initialize_ocean_public_type(input_domain, Ocean_sfc, diag, maskmap,
call mpp_get_layout(input_domain,layout)
call mpp_get_global_domain(input_domain, xsize=xsz, ysize=ysz)
if (PRESENT(maskmap)) then
call mpp_define_domains((/1,xsz,1,ysz/),layout,Ocean_sfc%Domain, maskmap=maskmap)
call mpp_define_domains((/1,xsz,1,ysz/),layout,Ocean_sfc%Domain, maskmap=maskmap)
else
call mpp_define_domains((/1,xsz,1,ysz/),layout,Ocean_sfc%Domain)
call mpp_define_domains((/1,xsz,1,ysz/),layout,Ocean_sfc%Domain)
endif
call mpp_get_compute_domain(Ocean_sfc%Domain, isc, iec, jsc, jec)

Expand Down Expand Up @@ -1059,40 +1059,40 @@ subroutine ocean_model_data2D_get(OS, Ocean, name, array2D, isc, jsc)


select case(name)
case('area')
array2D(isc:,jsc:) = OS%US%L_to_m**2*OS%grid%areaT(g_isc:g_iec,g_jsc:g_jec)
case('mask')
array2D(isc:,jsc:) = OS%grid%mask2dT(g_isc:g_iec,g_jsc:g_jec)
case('area')
array2D(isc:,jsc:) = OS%US%L_to_m**2*OS%grid%areaT(g_isc:g_iec,g_jsc:g_jec)
case('mask')
array2D(isc:,jsc:) = OS%grid%mask2dT(g_isc:g_iec,g_jsc:g_jec)
!OR same result
! do j=g_jsc,g_jec ; do i=g_isc,g_iec
! array2D(isc+i-g_isc,jsc+j-g_jsc) = OS%grid%mask2dT(i,j)
! enddo ; enddo
case('t_surf')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('t_pme')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('t_runoff')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('t_calving')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('btfHeat')
array2D(isc:,jsc:) = 0
case('cos_rot')
array2D(isc:,jsc:) = OS%grid%cos_rot(g_isc:g_iec,g_jsc:g_jec) ! =1
case('sin_rot')
array2D(isc:,jsc:) = OS%grid%sin_rot(g_isc:g_iec,g_jsc:g_jec) ! =0
case('s_surf')
array2D(isc:,jsc:) = Ocean%s_surf(isc:,jsc:)
case('sea_lev')
array2D(isc:,jsc:) = Ocean%sea_lev(isc:,jsc:)
case('frazil')
array2D(isc:,jsc:) = Ocean%frazil(isc:,jsc:)
case('melt_pot')
array2D(isc:,jsc:) = Ocean%melt_potential(isc:,jsc:)
case('obld')
array2D(isc:,jsc:) = Ocean%OBLD(isc:,jsc:)
case default
call MOM_error(FATAL,'get_ocean_grid_data2D: unknown argument name='//name)
case('t_surf')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('t_pme')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('t_runoff')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('t_calving')
array2D(isc:,jsc:) = Ocean%t_surf(isc:,jsc:)-CELSIUS_KELVIN_OFFSET
case('btfHeat')
array2D(isc:,jsc:) = 0
case('cos_rot')
array2D(isc:,jsc:) = OS%grid%cos_rot(g_isc:g_iec,g_jsc:g_jec) ! =1
case('sin_rot')
array2D(isc:,jsc:) = OS%grid%sin_rot(g_isc:g_iec,g_jsc:g_jec) ! =0
case('s_surf')
array2D(isc:,jsc:) = Ocean%s_surf(isc:,jsc:)
case('sea_lev')
array2D(isc:,jsc:) = Ocean%sea_lev(isc:,jsc:)
case('frazil')
array2D(isc:,jsc:) = Ocean%frazil(isc:,jsc:)
case('melt_pot')
array2D(isc:,jsc:) = Ocean%melt_potential(isc:,jsc:)
case('obld')
array2D(isc:,jsc:) = Ocean%OBLD(isc:,jsc:)
case default
call MOM_error(FATAL,'get_ocean_grid_data2D: unknown argument name='//name)
end select

end subroutine ocean_model_data2D_get
Expand Down Expand Up @@ -1209,7 +1209,7 @@ subroutine ocean_model_get_UV_surf(OS, Ocean, name, array2D, isc, jsc)
0.5*(sfc_state%v(i+i0,J+j0)+sfc_state%v(i+i0+1,J+j0))
enddo ; enddo
case default
call MOM_error(FATAL,'ocean_model_get_UV_surf: unknown argument name='//name)
call MOM_error(FATAL,'ocean_model_get_UV_surf: unknown argument name='//name)
end select

end subroutine ocean_model_get_UV_surf
Expand Down
2 changes: 1 addition & 1 deletion config_src/solo_driver/MESO_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ subroutine MESO_surface_forcing_init(Time, G, US, param_file, diag, CS)
call get_param(param_file, mdl, "INPUTDIR", CS%inputdir, default=".")
CS%inputdir = slasher(CS%inputdir)

endif
endif

end subroutine MESO_surface_forcing_init

Expand Down
10 changes: 5 additions & 5 deletions config_src/solo_driver/MOM_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,7 @@ subroutine buoyancy_forcing_from_data_override(sfc_state, fluxes, day, dt, G, US

! note the sign convention
do j=js,je ; do i=is,ie
fluxes%sens(i,j) = -US%W_m2_to_QRZ_T * fluxes%sens(i,j) ! Normal convention is positive into the ocean
fluxes%sens(i,j) = -US%W_m2_to_QRZ_T * fluxes%sens(i,j) ! Normal convention is positive into the ocean
! but sensible is normally a positive quantity in the files
enddo ; enddo

Expand Down Expand Up @@ -1271,11 +1271,11 @@ subroutine buoyancy_forcing_from_data_override(sfc_state, fluxes, day, dt, G, US

! Read the SST and SSS fields for damping.
if (CS%restorebuoy) then !#CTRL# .or. associated(CS%ctrl_forcing_CSp)) then
call data_override('OCN', 'SST_restore', CS%T_restore(:,:), day, &
is_in=is_in, ie_in=ie_in, js_in=js_in, je_in=je_in)
call data_override('OCN', 'SST_restore', CS%T_restore(:,:), day, &
is_in=is_in, ie_in=ie_in, js_in=js_in, je_in=je_in)

call data_override('OCN', 'SSS_restore', CS%S_restore(:,:), day, &
is_in=is_in, ie_in=ie_in, js_in=js_in, je_in=je_in)
call data_override('OCN', 'SSS_restore', CS%S_restore(:,:), day, &
is_in=is_in, ie_in=ie_in, js_in=js_in, je_in=je_in)

endif

Expand Down
2 changes: 1 addition & 1 deletion config_src/solo_driver/user_surface_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ subroutine USER_wind_forcing(sfc_state, forces, day, G, US, CS)
! is always positive.
if (associated(forces%ustar)) then ; do j=js,je ; do i=is,ie
! This expression can be changed if desired, but need not be.
forces%ustar(i,j) = G%mask2dT(i,j) * sqrt((CS%gust_const + &
forces%ustar(i,j) = G%mask2dT(i,j) * sqrt((CS%gust_const + &
sqrt(0.5*(forces%taux(I-1,j)**2 + forces%taux(I,j)**2) + &
0.5*(forces%tauy(i,J-1)**2 + forces%tauy(i,J)**2))) * (US%L_to_Z/CS%Rho0))
enddo ; enddo ; endif
Expand Down
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/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ subroutine ALE_main( G, GV, US, h, u, v, tv, Reg, CS, OBC, dt, frac_shelf_h)
! Build new grid. The new grid is stored in h_new. The old grid is h.
! Both are needed for the subsequent remapping of variables.
if (ice_shelf) then
call regridding_main( CS%remapCS, CS%regridCS, G, GV, h, tv, h_new, dzRegrid, frac_shelf_h)
call regridding_main( CS%remapCS, CS%regridCS, G, GV, h, tv, h_new, dzRegrid, frac_shelf_h)
else
call regridding_main( CS%remapCS, CS%regridCS, G, GV, h, tv, h_new, dzRegrid)
call regridding_main( CS%remapCS, CS%regridCS, G, GV, h, tv, h_new, dzRegrid)
endif

call check_grid( G, GV, h, 0. )
Expand Down Expand Up @@ -480,7 +480,7 @@ subroutine ALE_offline_inputs(CS, G, GV, h, tv, Reg, uhtr, vhtr, Kd, debug, OBC)
dzRegrid(:,:,:) = 0.0
h_new(:,:,:) = 0.0

if (debug) call MOM_tracer_chkinv("Before ALE_offline_inputs", G, h, Reg%Tr, Reg%ntr)
if (debug) call MOM_tracer_chkinv("Before ALE_offline_inputs", G, GV, h, Reg%Tr, Reg%ntr)

! Build new grid from the Zstar state onto the requested vertical coordinate. The new grid is stored
! in h_new. The old grid is h. Both are needed for the subsequent remapping of variables. Convective
Expand Down Expand Up @@ -523,7 +523,7 @@ subroutine ALE_offline_inputs(CS, G, GV, h, tv, Reg, uhtr, vhtr, Kd, debug, OBC)
call ALE_remap_scalar(CS%remapCS, G, GV, nk, h, tv%T, h_new, tv%T, answers_2018=CS%answers_2018)
call ALE_remap_scalar(CS%remapCS, G, GV, nk, h, tv%S, h_new, tv%S, answers_2018=CS%answers_2018)

if (debug) call MOM_tracer_chkinv("After ALE_offline_inputs", G, h_new, Reg%Tr, Reg%ntr)
if (debug) call MOM_tracer_chkinv("After ALE_offline_inputs", G, GV, h_new, Reg%Tr, Reg%ntr)

! Copy over the new layer thicknesses
do k = 1,nk ; do j = jsc-1,jec+1 ; do i = isc-1,iec+1
Expand Down Expand Up @@ -633,9 +633,9 @@ subroutine ALE_build_grid( G, GV, regridCS, remapCS, h, tv, debug, frac_shelf_h
! Build new grid. The new grid is stored in h_new. The old grid is h.
! Both are needed for the subsequent remapping of variables.
if (use_ice_shelf) then
call regridding_main( remapCS, regridCS, G, GV, h, tv, h_new, dzRegrid, frac_shelf_h )
call regridding_main( remapCS, regridCS, G, GV, h, tv, h_new, dzRegrid, frac_shelf_h )
else
call regridding_main( remapCS, regridCS, G, GV, h, tv, h_new, dzRegrid )
call regridding_main( remapCS, regridCS, G, GV, h, tv, h_new, dzRegrid )
endif

! Override old grid with new one. The new grid 'h_new' is built in
Expand Down
4 changes: 2 additions & 2 deletions src/ALE/PLM_functions.F90
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ real elemental pure function PLM_extrapolate_slope(h_l, h_c, h_neglect, u_l, u_c
real :: hl, hc ! Left and central cell thicknesses [units of grid thickness]

! Avoid division by zero for vanished cells
hl = h_l + h_neglect
hc = h_c + h_neglect
hl = h_l + h_neglect
hc = h_c + h_neglect

! The h2 scheme is used to compute the left edge value
left_edge = (u_l*hc + u_c*hl) / (hl + hc)
Expand Down
2 changes: 1 addition & 1 deletion src/ALE/regrid_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module regrid_interp
!! a third-order PPM ih4 scheme). In these cases, we resort to the simplest
!! continuous linear scheme (P1M h2).
subroutine regridding_set_ppolys(CS, densities, n0, h0, ppoly0_E, ppoly0_S, &
ppoly0_coefs, degree, h_neglect, h_neglect_edge)
ppoly0_coefs, degree, h_neglect, h_neglect_edge)
type(interp_CS_type), intent(in) :: CS !< Interpolation control structure
integer, intent(in) :: n0 !< Number of cells on source grid
real, dimension(n0), intent(in) :: densities !< Actual cell densities [A]
Expand Down
Loading

0 comments on commit e68d31a

Please sign in to comment.