Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c23c244
(*) Add option for minmod limiter for RayTracing (#948)
raphaeldussin Aug 6, 2025
e486f50
(*) Multiple fixes for the ray tracing (#947)
raphaeldussin Aug 6, 2025
c3e4f0f
Moved hchksum() with halos to after pass_var
adcroft Aug 1, 2025
c827f33
Adjust rate of adding mass source to BT solver
adcroft Jul 11, 2025
2245499
Disable adjustment of BT mass source in corrector step
adcroft Jul 11, 2025
b8c807b
Adds limiter for time-integrated BT transports
adcroft Aug 1, 2025
921a17c
Disable adjustment of BT mass source in RK2b corrector (#6)
Hallberg-NOAA Aug 7, 2025
cfff0e7
Avoid passing unallocated array to target dummy argument
adcroft Aug 7, 2025
45140df
Remove use of uninitialized string
adcroft Aug 7, 2025
90d426f
Merge branch 'main' into dev/gfdl
marshallward Aug 21, 2025
c926d7d
+Add OBC_REVERSE_SEGMENT_ORDER
Hallberg-NOAA Jul 22, 2025
a01cc39
+Use OBCs to set masks
Hallberg-NOAA Jul 24, 2025
f21e9ea
+Optionally avoid projecting data for OBCs
Hallberg-NOAA Jul 30, 2025
4d5bcea
+Restore open_boundary_setup_vert
Hallberg-NOAA Aug 29, 2025
5851a69
+Separate OBC_for_remap and OBC_for_bug arguments
Hallberg-NOAA Aug 22, 2025
539e494
+Add chksum_OBC_segment_data
Hallberg-NOAA Aug 24, 2025
cb4703e
+Call initialize_segment_data with rotated OBCs
Hallberg-NOAA Aug 24, 2025
6254333
*Call initialize_segment_data after call_tracer_register_obc_segments
Hallberg-NOAA Aug 31, 2025
eccd5bb
Eliminate rotate_OBC_segment_data
Hallberg-NOAA Aug 31, 2025
b0fa0c0
Added the WENO schemes to reconstruct PV in MOM_CoriolisAdv (#946)
Wendazhang33 Sep 5, 2025
bbfc208
Add ALE_COORDINATE_CONFIG HYBRID_3D and HYBRID_MAP
awallcraft Jun 12, 2025
134acfc
Set the halos of new 3D arrays
awallcraft Jun 15, 2025
5ace399
Add SHALLOW_ALE_RESOLUTION
awallcraft Jun 17, 2025
076d8ff
Non-integer HYBRID_MAP values
awallcraft Aug 27, 2025
e889b6a
indent continuations, source code <= 100 chars
awallcraft Sep 6, 2025
e06aeb5
+Add RESCALE_STRONG_DRAG
Hallberg-NOAA Aug 25, 2025
8b27cb2
Add option to horizontally homogenize the Stokes drift when used via …
breichl Sep 9, 2025
7a1eee1
Fix calculation of CAv_Stokes diagnostic
Hallberg-NOAA Sep 7, 2025
83a1048
makedep: Update interpreter directive to python3
marshallward Aug 4, 2025
6ac9c74
+Correct halo update sizes and reduce halo updates (#969)
Hallberg-NOAA Sep 18, 2025
c412f0e
Correct multi-PE velocity truncation counts (#955)
Hallberg-NOAA Sep 18, 2025
1cbebf2
ANN parameterization of horizontal momentum eddy fluxes (#944)
Pperezhogin Sep 19, 2025
60a0196
Part one of thickness reservoirs
kshedstrom Jul 16, 2025
2918a9d
Better Kelvin wave results in layer mode
kshedstrom Aug 1, 2025
8c97707
Response to comments on h_reservoirs PR.
kshedstrom Aug 16, 2025
a18ffc3
Inline Harmonic Analysis
c2xu Aug 25, 2025
67c1467
Inline Harmonic Analysis
c2xu Aug 25, 2025
5df73dc
Inline Harmonic Analysis
c2xu Aug 25, 2025
f5f90a6
Inline Harmonic Analysis
c2xu Aug 25, 2025
c072c29
Inline Harmonic Analysis
c2xu Aug 26, 2025
00fde81
Inline Harmonic Analysis
c2xu Aug 26, 2025
dcae198
Bug fix in MOM_open_boundary
c2xu Aug 27, 2025
3138f84
+Use I0 format to simplify integer output
Hallberg-NOAA Aug 24, 2025
ea359dd
Vert friction: Fix index errors
marshallward Sep 22, 2025
067ed5f
Vert friction: Column loops moved in layers
marshallward Sep 22, 2025
e2b8c52
Bug fix for linear wave drag in MOM_barotropic
herrwang0 Sep 23, 2025
e8f5fa6
Suppress warning message of negative eta in land
herrwang0 Sep 23, 2025
665c760
Flip the order of acceleration and velocity chksum
herrwang0 Sep 23, 2025
39ab7d5
+Add the new parameter RESOLN_FUNCTION_OBC_BUG
Hallberg-NOAA Jun 16, 2025
e6c7952
Fixes shelfwave failure in debug mode
kshedstrom Oct 10, 2025
757b2d8
Make sure reversed segments get rotated.
kshedstrom Oct 24, 2025
6b2ec5f
Vert friction: Force FMAs in tridiag solvers
marshallward Nov 25, 2025
f5ae5cf
Merge pull request #1680 from NOAA-GFDL/gfdl-to-main-2025-09-25
marshallward Jan 12, 2026
d58eea9
Merge remote-tracking branch 'upstream/main' into merge_main_jan12
alperaltuntas Jan 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ac/makedep
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from __future__ import print_function

Expand Down
189 changes: 189 additions & 0 deletions config_src/drivers/timing_tests/time_MOM_ANN.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
program time_MOM_ANN

! This file is part of MOM6. See LICENSE.md for the license.

use MOM_ANN, only : ANN_CS
use MOM_ANN, only : ANN_allocate, ANN_apply, ANN_end
use MOM_ANN, only : ANN_apply_vector_orig, ANN_apply_vector_oi
use MOM_ANN, only : ANN_apply_array_sio
use MOM_ANN, only : ANN_random

implicit none

! Command line options
integer :: nargs ! Number of command line arguments
character(len=12) :: cmd_ln_arg !< Command line argument (if any)

! ANN parameters
integer :: nlayers ! Number of layers
integer :: nin ! Number of inputs
integer :: layer_width ! Width of hidden layers
integer :: nout ! Number of outputs
! Timing parameters
integer :: nsamp ! Number of measurements
integer :: nits ! Number of calls to time
integer :: nxy ! Spatial dimension

nlayers = 7; nin = 4; layer_width = 16; nout = 1 ! Deep network
!nlayers = 4; nin = 4; layer_width = 48; nout = 1 ! Shallow-wide network
!nlayers = 3; nin = 4; layer_width = 20; nout = 1 ! Small network

nsamp = 100
nits = 20000
!nits = 300000 ! Needed for robust measurements on small networks
nxy = 100 ! larger array
!nxy = 10 ! small array

! Optionally grab ANN and timing parameters from the command line
nargs = command_argument_count()
if (nargs==7) then
call get_command_argument(1, cmd_ln_arg)
read(cmd_ln_arg,*) nlayers
call get_command_argument(2, cmd_ln_arg)
read(cmd_ln_arg,*) nin
call get_command_argument(3, cmd_ln_arg)
read(cmd_ln_arg,*) layer_width
call get_command_argument(4, cmd_ln_arg)
read(cmd_ln_arg,*) nout
call get_command_argument(5, cmd_ln_arg)
read(cmd_ln_arg,*) nsamp
call get_command_argument(6, cmd_ln_arg)
read(cmd_ln_arg,*) nits
call get_command_argument(7, cmd_ln_arg)
read(cmd_ln_arg,*) nxy
endif

! Fastest variants on Intel Xeon W-2223 CPU @ 3.60GHz (gfortran-13.2 -O3)
! | vector(nxy=1) | nxy = 10 | nxy = 100
! ----------------------------------------------------------------------------
! Small ANN | vector_oi | array_soi | array_sio
! Shallow-wide ANN | vector_oi | array_ois | array_sio
! Deep ANN | vector_oi | array_ois | array_sio

write(*,'(a)') "{"

call time_ANN(nlayers, nin, layer_width, nout, nsamp, nits, nxy, &
0, "MOM_ANN:ANN_apply(vector)")
write(*,"(',')")
call time_ANN(nlayers, nin, layer_width, nout, nsamp, nits, nxy, &
1, "MOM_ANN:ANN_apply_vector_orig(array)")
write(*,"(',')")
call time_ANN(nlayers, nin, layer_width, nout, nsamp, nits, nxy, &
2, "MOM_ANN:ANN_apply_vector_oi(array)")
write(*,"(',')")
call time_ANN(nlayers, nin, layer_width, nout, nsamp, nits, nxy, &
12, "MOM_ANN:ANN_apply_array_sio(array)")
write(*,"()")

write(*,'(a)') "}"

contains

!> Time ANN inference.
!!
!! Times are measured over the "nits effective calls" and appropriately scaled to the
!! time per call per single vector of input features. For array inputs, the number of
!! actual calls is reduced by the size of the array. The timing measurement is repeated
!! "nsamp" times, to check the statistics of the timing measurement.
subroutine time_ANN(nlayers, nin, width, nout, nsamp, nits, nxy, impl, label)
integer, intent(in) :: nlayers !< Number of layers
integer, intent(in) :: nin !< Number of inputs
integer, intent(in) :: width !< Width of hidden layers
integer, intent(in) :: nout !< Number of outputs
integer, intent(in) :: nsamp !< Number of measurements
integer, intent(in) :: nits !< Number of calls to time
integer, intent(in) :: nxy !< Spatial dimension
integer, intent(in) :: impl !< Implementation to time
character(len=*), intent(in) :: label !< Label for YAML output
! Local variables
type(ANN_CS) :: ANN ! ANN
integer :: widths(nlayers) ! Width of each layer
real :: x_s(nin) ! Inputs (just features) [nondim]
real :: y_s(nin) ! Outputs (just features) [nondim]
real :: x_fs(nin,nxy) ! Inputs (feature, space) [nondim]
real :: y_fs(nin,nxy) ! Outputs (feature, space) [nondim]
real :: x_sf(nin,nxy) ! Inputs (space, feature) [nondim]
real :: y_sf(nin,nxy) ! Outputs (space, feature) [nondim]
integer :: iter, samp ! Loop counters
integer :: ij ! Horizontal loop index
real :: start, finish, timing ! CPU times [s]
real :: tmin, tmax, tmean, tstd ! Min, max, mean, and standard deviation, of CPU times [s]
integer :: asamp ! Actual samples of timings
integer :: aits ! Actual iterations
real :: words_per_sec ! Operations per sec estimated from parameters [# s-1]

widths(:) = width
widths(1) = nin
widths(nlayers) = nout

call ANN_random(ANN, nlayers, widths)
call random_number(x_fs)
call random_number(x_sf)


tmin = 1e9
tmax = 0.
tmean = 0.
tstd = 0.
asamp = nits ! Most cases below use this
aits = nits / nxy ! Most cases below use this

do samp = 1, nsamp
select case (impl)
case (0)
aits = nits
call cpu_time(start)
do iter = 1, nits ! Make many passes to reduce sampling error
call ANN_apply(x_s, y_s, ANN)
enddo
call cpu_time(finish)
case (1)
call cpu_time(start)
do iter = 1, aits ! Make many passes to reduce sampling error
do ij = 1, nxy
call ANN_apply_vector_orig(x_fs(:,ij), y_fs(:,ij), ANN)
enddo
enddo
call cpu_time(finish)
case (2)
call cpu_time(start)
do iter = 1, aits ! Make many passes to reduce sampling error
do ij = 1, nxy
call ANN_apply_vector_oi(x_fs(:,ij), y_fs(:,ij), ANN)
enddo
enddo
call cpu_time(finish)
case (12)
call cpu_time(start)
do iter = 1, aits ! Make many passes to reduce sampling error
call ANN_apply_array_sio(nxy, x_sf(:,:), y_sf(:,:), ANN)
enddo
call cpu_time(finish)
asamp = nsamp * aits ! Account for working on whole arrays
end select

timing = ( finish - start ) / real(nits) ! Average time per call

tmin = min( tmin, timing )
tmax = max( tmax, timing )
tmean = tmean + timing
tstd = tstd + timing**2
enddo

tmean = tmean / real(nsamp)
tstd = tstd / real(nsamp) ! convert to mean of squares
tstd = tstd - tmean**2 ! convert to variance
tstd = sqrt( tstd * real(nsamp) / real(nsamp-1) ) ! convert to standard deviation
words_per_sec = ANN%parameters / ( tmean * 1024 * 1024 )

write(*,"(2x,3a)") '"', trim(label), '": {'
write(*,"(4x,a,1pe11.4,',')") '"min": ', tmin
write(*,"(4x,a,1pe11.4,',')") '"mean":', tmean
write(*,"(4x,a,1pe11.4,',')") '"std": ', tstd
write(*,"(4x,a,i0,',')") '"n_samples": ', asamp
write(*,"(4x,a,1pe11.4,',')") '"max": ', tmax
write(*,"(4x,a,1pe11.4,'}')", advance="no") '"MBps": ', words_per_sec

end subroutine time_ANN

end program time_MOM_ANN
10 changes: 10 additions & 0 deletions config_src/drivers/unit_tests/test_MOM_ANN.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
program test_MOM_ANN

use MOM_ANN, only : ANN_unit_tests
use MOM_error_handler, only : set_skip_mpi

call set_skip_mpi(.true.) ! This unit tests is not expecting MPI to be used

if ( ANN_unit_tests(.true.) ) stop 1

end program test_MOM_ANN
55 changes: 32 additions & 23 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ module MOM_ALE
!! before the main time integration loop to initialize the regridding stuff.
!! We read the MOM_input file to register the values of different
!! regridding/remapping parameters.
subroutine ALE_init( param_file, GV, US, max_depth, CS)
subroutine ALE_init( param_file, G, GV, US, max_depth, CS)
type(param_file_type), intent(in) :: param_file !< Parameter file
type(ocean_grid_type), intent(in) :: G !< 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, intent(in) :: max_depth !< The maximum depth of the ocean [Z ~> m].
Expand Down Expand Up @@ -205,8 +206,9 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
default=.false.)

! Initialize and configure regridding
call ALE_initRegridding(GV, US, max_depth, param_file, mdl, CS%regridCS)
call regridding_preadjust_reqs(CS%regridCS, CS%do_conv_adj, CS%use_hybgen_unmix, hybgen_CS=hybgen_regridCS)
call ALE_initRegridding(G, GV, US, max_depth, param_file, mdl, CS%regridCS)
call regridding_preadjust_reqs(CS%regridCS, CS%do_conv_adj, CS%use_hybgen_unmix, &
hybgen_CS=hybgen_regridCS)

! Initialize and configure remapping that is orchestrated by ALE.
call get_param(param_file, mdl, "REMAPPING_SCHEME", string, &
Expand Down Expand Up @@ -321,12 +323,12 @@ subroutine ALE_init( param_file, GV, US, max_depth, CS)
default=-0.001, units="m", scale=GV%m_to_H)
call get_param(param_file, mdl, "REMAP_VEL_MASK_H_THIN", CS%h_vel_mask, &
"A thickness at velocity points below which near-bottom layers are zeroed out "//&
"after remapping, following practice with Hybgen remapping, or a negative value "//&
"to avoid such filtering altogether.", &
"after remapping, following practice with Hybgen remapping, "//&
"or a negative value to avoid such filtering altogether.", &
default=1.0e-6, units="m", scale=GV%m_to_H, do_not_log=(CS%BBL_h_vel_mask<=0.0))

if (CS%use_hybgen_unmix) &
call init_hybgen_unmix(CS%hybgen_unmixCS, GV, US, param_file, hybgen_regridCS)
call init_hybgen_unmix(CS%hybgen_unmixCS, GV, US, param_file, hybgen_regridCS)

call get_param(param_file, mdl, "REMAP_VEL_CONSERVE_KE", CS%conserve_ke, &
"If true, a correction is applied to the baroclinic component of velocity "//&
Expand Down Expand Up @@ -640,7 +642,8 @@ end subroutine ALE_offline_inputs

!> For a state-based coordinate, accelerate the process of regridding by
!! repeatedly applying the grid calculation algorithm
subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, dt, dzRegrid, initial)
subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, dt, &
dzRegrid, initial)
type(ALE_CS), pointer :: CS !< ALE control structure
type(ocean_grid_type), intent(inout) :: G !< Ocean grid
type(verticalGrid_type), intent(in) :: GV !< Vertical grid
Expand Down Expand Up @@ -689,7 +692,7 @@ subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, d

! initial total interface displacement due to successive regridding
if (CS%remap_uv_using_old_alg) &
dzIntTotal(:,:,:) = 0.
dzIntTotal(:,:,:) = 0.

call create_group_pass(pass_T_S_h, T, G%domain)
call create_group_pass(pass_T_S_h, S, G%domain)
Expand All @@ -708,7 +711,7 @@ subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, d

! Apply timescale to regridding (for e.g. filtered_grid_motion)
if (present(dt)) &
call ALE_update_regrid_weights(dt, CS)
call ALE_update_regrid_weights(dt, CS)

do itt = 1, n_itt

Expand All @@ -722,12 +725,14 @@ subroutine ALE_regrid_accelerated(CS, G, GV, US, h, tv, n_itt, u, v, OBC, Reg, d

call regridding_main(CS%remapCS, CS%regridCS, G, GV, US, h_loc, tv_local, h, dzInterface)
if (CS%remap_uv_using_old_alg) &
dzIntTotal(:,:,:) = dzIntTotal(:,:,:) + dzInterface(:,:,:)
dzIntTotal(:,:,:) = dzIntTotal(:,:,:) + dzInterface(:,:,:)

! remap from original grid onto new grid
do j = G%jsc-1,G%jec+1 ; do i = G%isc-1,G%iec+1
call remapping_core_h(CS%remapCS, nz, h_orig(i,j,:), tv%S(i,j,:), nz, h(i,j,:), tv_local%S(i,j,:))
call remapping_core_h(CS%remapCS, nz, h_orig(i,j,:), tv%T(i,j,:), nz, h(i,j,:), tv_local%T(i,j,:))
call remapping_core_h(CS%remapCS, nz, h_orig(i,j,:), tv%S(i,j,:), nz, h(i,j,:), &
tv_local%S(i,j,:))
call remapping_core_h(CS%remapCS, nz, h_orig(i,j,:), tv%T(i,j,:), nz, h(i,j,:), &
tv_local%T(i,j,:))
enddo ; enddo

! starting grid for next iteration
Expand Down Expand Up @@ -1146,7 +1151,7 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u
if (CS%id_remap_delta_integ_v2>0) dv2h_tot(:,:) = 0.

if (((CS%id_remap_delta_integ_u2>0) .or. (CS%id_remap_delta_integ_v2>0)) .and. .not.present(dt))&
call MOM_error(FATAL, "ALE KE diagnostics requires passing dt into ALE_remap_velocities")
call MOM_error(FATAL, "ALE KE diagnostics requires passing dt into ALE_remap_velocities")

nz = GV%ke

Expand Down Expand Up @@ -1212,7 +1217,7 @@ subroutine ALE_remap_velocities(CS, G, GV, h_old_u, h_old_v, h_new_u, h_new_v, u
endif

if ((CS%BBL_h_vel_mask > 0.0) .and. (CS%h_vel_mask > 0.0)) &
call mask_near_bottom_vel(u_tgt, h2, CS%BBL_h_vel_mask, CS%h_vel_mask, nz)
call mask_near_bottom_vel(u_tgt, h2, CS%BBL_h_vel_mask, CS%h_vel_mask, nz)

! Copy the column of new velocities back to the 3-d array
do k=1,nz
Expand Down Expand Up @@ -1361,13 +1366,14 @@ subroutine ALE_remap_vertex_vals(CS, G, GV, h_old, h_new, vert_val)

do J=G%JscB,G%JecB ; do I=G%IscB,G%IecB
if ((G%mask2dT(i,j) + G%mask2dT(i+1,j+1)) + (G%mask2dT(i+1,j) + G%mask2dT(i,j+1)) > 0.0 ) then
I_mask_sum = 1.0 / ((G%mask2dT(i,j) + G%mask2dT(i+1,j+1)) + (G%mask2dT(i+1,j) + G%mask2dT(i,j+1)))
I_mask_sum = 1.0 / ((G%mask2dT(i,j) + G%mask2dT(i+1,j+1)) + &
(G%mask2dT(i+1,j) + G%mask2dT(i,j+1)))

do k=1,nz
h_src(k) = ((G%mask2dT(i,j) * h_old(i,j,k) + G%mask2dT(i+1,j+1) * h_old(i+1,j+1,k)) + &
(G%mask2dT(i+1,j) * h_old(i+1,j,k) + G%mask2dT(i,j+1) * h_old(i,j+1,k)) ) * I_mask_sum
(G%mask2dT(i+1,j) * h_old(i+1,j,k) + G%mask2dT(i,j+1) * h_old(i,j+1,k)) ) * I_mask_sum
h_tgt(k) = ((G%mask2dT(i,j) * h_new(i,j,k) + G%mask2dT(i+1,j+1) * h_new(i+1,j+1,k)) + &
(G%mask2dT(i+1,j) * h_new(i+1,j,k) + G%mask2dT(i,j+1) * h_new(i,j+1,k)) ) * I_mask_sum
(G%mask2dT(i+1,j) * h_new(i+1,j,k) + G%mask2dT(i,j+1) * h_new(i,j+1,k)) ) * I_mask_sum
enddo

do K=1,nz+1
Expand Down Expand Up @@ -1549,7 +1555,8 @@ subroutine ALE_PLM_edge_values( CS, G, GV, h, Q, bdry_extrap, Q_t, Q_b )
do j = G%jsc-1,G%jec+1 ; do i = G%isc-1,G%iec+1
slp(1) = 0.
do k = 2, GV%ke-1
slp(k) = PLM_slope_wa(h(i,j,k-1), h(i,j,k), h(i,j,k+1), h_neglect, Q(i,j,k-1), Q(i,j,k), Q(i,j,k+1))
slp(k) = PLM_slope_wa(h(i,j,k-1), h(i,j,k), h(i,j,k+1), h_neglect, &
Q(i,j,k-1), Q(i,j,k), Q(i,j,k+1))
enddo
slp(GV%ke) = 0.

Expand All @@ -1562,7 +1569,8 @@ subroutine ALE_PLM_edge_values( CS, G, GV, h, Q, bdry_extrap, Q_t, Q_b )
mslp = - PLM_extrapolate_slope(h(i,j,2), h(i,j,1), h_neglect, Q(i,j,2), Q(i,j,1))
Q_t(i,j,1) = Q(i,j,1) - 0.5 * mslp
Q_b(i,j,1) = Q(i,j,1) + 0.5 * mslp
mslp = PLM_extrapolate_slope(h(i,j,GV%ke-1), h(i,j,GV%ke), h_neglect, Q(i,j,GV%ke-1), Q(i,j,GV%ke))
mslp = PLM_extrapolate_slope(h(i,j,GV%ke-1), h(i,j,GV%ke), h_neglect, &
Q(i,j,GV%ke-1), Q(i,j,GV%ke))
Q_t(i,j,GV%ke) = Q(i,j,GV%ke) - 0.5 * mslp
Q_b(i,j,GV%ke) = Q(i,j,GV%ke) + 0.5 * mslp
else
Expand Down Expand Up @@ -1630,7 +1638,7 @@ subroutine TS_PPM_edge_values( CS, S_t, S_b, T_t, T_b, G, GV, tv, h, bdry_extrap
call PPM_reconstruction( GV%ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect, &
answer_date=CS%answer_date )
if (bdry_extrap) &
call PPM_boundary_extrapolation( GV%ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )
call PPM_boundary_extrapolation( GV%ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )

do k = 1,GV%ke
S_t(i,j,k) = ppol_E(k,1)
Expand All @@ -1651,7 +1659,7 @@ subroutine TS_PPM_edge_values( CS, S_t, S_b, T_t, T_b, G, GV, tv, h, bdry_extrap
call PPM_reconstruction( GV%ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect, &
answer_date=CS%answer_date )
if (bdry_extrap) &
call PPM_boundary_extrapolation(GV%ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )
call PPM_boundary_extrapolation(GV%ke, hTmp, tmp, ppol_E, ppol_coefs, h_neglect )

do k = 1,GV%ke
T_t(i,j,k) = ppol_E(k,1)
Expand All @@ -1664,7 +1672,8 @@ end subroutine TS_PPM_edge_values


!> Initializes regridding for the main ALE algorithm
subroutine ALE_initRegridding(GV, US, max_depth, param_file, mdl, regridCS)
subroutine ALE_initRegridding(G, GV, US, max_depth, param_file, mdl, regridCS)
type(ocean_grid_type), intent(in) :: G !< 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, intent(in) :: max_depth !< The maximum depth of the ocean [Z ~> m].
Expand All @@ -1680,7 +1689,7 @@ subroutine ALE_initRegridding(GV, US, max_depth, param_file, mdl, regridCS)
trim(regriddingCoordinateModeDoc), &
default=DEFAULT_COORDINATE_MODE, fail_if_missing=.true.)

call initialize_regridding(regridCS, GV, US, max_depth, param_file, mdl, coord_mode, '', '')
call initialize_regridding(regridCS, G, GV, US, max_depth, param_file, mdl, coord_mode, '', '')

end subroutine ALE_initRegridding

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 @@ -988,12 +988,12 @@ subroutine hybgen_column_regrid(CS, nk, thkbot, Rcv_tgt, &
! Verify that everything is consistent.
do k=1,nk
if (abs((h_col(k) - h_in(k)) + (dp_int(K) - dp_int(K+1))) > 1.0e-13*max(p_int(nk+1), CS%onem)) then
write(mesg, '("k ",i4," h ",es13.4," h_in ",es13.4, " dp ",2es13.4," err ",es13.4)') &
write(mesg, '("k ",I0," h ",es13.4," h_in ",es13.4, " dp ",2es13.4," err ",es13.4)') &
k, h_col(k), h_in(k), dp_int(K), dp_int(K+1), (h_col(k) - h_in(k)) + (dp_int(K) - dp_int(K+1))
call MOM_error(FATAL, "Mismatched thickness changes in hybgen_regrid: "//trim(mesg))
endif
if (h_col(k) < 0.0) then ! Could instead do: -1.0e-15*max(p_int(nk+1), CS%onem)) then
write(mesg, '("k ",i4," h ",es13.4," h_in ",es13.4, " dp ",2es13.4, " fixlay ",i4)') &
write(mesg, '("k ",I0," h ",es13.4," h_in ",es13.4, " dp ",2es13.4, " fixlay ",I0)') &
k, h_col(k), h_in(k), dp_int(K), dp_int(K+1), fixlay
call MOM_error(FATAL, "Significantly negative final thickness in hybgen_regrid: "//trim(mesg))
endif
Expand Down
Loading
Loading