Skip to content

Commit

Permalink
+Add Hybgen remapping options
Browse files Browse the repository at this point in the history
  This commit adds the ability to specify three remapping options derived from
Hycom's hybgen code.

 - Adds the new module MOM_hybgen_remap, which contains the new subroutines
   hybgen_plm_coefs, hybgen_ppm_coefs, and hybgen_weno_coefs

 - Adds code to handle PLM_HYBGEN, PPM_HYBGEN and WENO_HYBGEN as valid entries
   for specifying the ALE remapping schemes.  Also added descriptions of units
   to some internal remapping variables.

 - Adds the optional argument PCM_cell to regridding_main, remapping_core_h, and
   remap_all_state_vars to specify layers that should use piecewise constant
   remapping, regardless of the overall remapping scheme, to follow the approach
   used in Hycom.  ALE_main uses these new optional arguments, although until
   the Hybgen regridding code is added, they will always be set to false.

 - Makes 7 character strings longer in 5 files to accommodate the new
   remapping options.

All answers are bitwise identical, but there are changes to some entries in the
MOM_parameter_doc files.
  • Loading branch information
Hallberg-NOAA committed Mar 6, 2022
1 parent 9a01cd5 commit def40e4
Show file tree
Hide file tree
Showing 10 changed files with 515 additions and 50 deletions.
19 changes: 14 additions & 5 deletions src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ subroutine ALE_main( G, GV, US, h, u, v, tv, Reg, CS, OBC, dt, frac_shelf_h)
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1) :: dzRegrid ! The change in grid interface positions
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1) :: eta_preale
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)) :: h_new ! New 3D grid obtained after last time step [H ~> m or kg m-2]
logical :: PCM_cell(SZI_(G),SZJ_(G),SZK_(GV)) !< If true, PCM remapping should be used in a cell.
integer :: nk, i, j, k, isc, iec, jsc, jec, ntr

nk = GV%ke; isc = G%isc; iec = G%iec; jsc = G%jsc; jec = G%jec
Expand All @@ -405,7 +406,7 @@ 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.
call regridding_main( CS%remapCS, CS%regridCS, G, GV, h, tv, h_new, dzRegrid, &
frac_shelf_h )
frac_shelf_h, PCM_cell=PCM_cell)

call check_grid( G, GV, h, 0. )

Expand All @@ -419,7 +420,7 @@ subroutine ALE_main( G, GV, US, h, u, v, tv, Reg, CS, OBC, dt, frac_shelf_h)

! Remap all variables from old grid h onto new grid h_new
call remap_all_state_vars( CS, G, GV, h, h_new, Reg, OBC, dzRegrid, u, v, &
CS%show_call_tree, dt )
CS%show_call_tree, dt, PCM_cell=PCM_cell )

if (CS%show_call_tree) call callTree_waypoint("state remapped (ALE_main)")

Expand Down Expand Up @@ -776,7 +777,7 @@ end subroutine ALE_regrid_accelerated
!! remap initial conditions to the model grid. It is also called during a
!! time step to update the state.
subroutine remap_all_state_vars(CS, G, GV, h_old, h_new, Reg, OBC, &
dzInterface, u, v, debug, dt )
dzInterface, u, v, debug, dt, PCM_cell)
type(ALE_CS), intent(in) :: CS !< ALE control structure
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid structure
Expand All @@ -795,6 +796,8 @@ subroutine remap_all_state_vars(CS, G, GV, h_old, h_new, Reg, OBC, &
optional, intent(inout) :: v !< Meridional velocity [L T-1 ~> m s-1]
logical, optional, intent(in) :: debug !< If true, show the call tree
real, optional, intent(in) :: dt !< time step for diagnostics [T ~> s]
logical, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
optional, intent(in) :: PCM_cell !< Use PCM remapping in cells where true

! Local variables
real, dimension(SZI_(G),SZJ_(G)) :: h_tot ! The vertically summed thicknesses [H ~> m or kg m-2]
Expand Down Expand Up @@ -861,8 +864,14 @@ subroutine remap_all_state_vars(CS, G, GV, h_old, h_new, Reg, OBC, &
! Build the start and final grids
h1(:) = h_old(i,j,:)
h2(:) = h_new(i,j,:)
call remapping_core_h(CS%remapCS, nz, h1, Tr%t(i,j,:), nz, h2, tr_column, &
h_neglect, h_neglect_edge)
if (present(PCM_cell)) then
PCM(:) = PCM_cell(i,j,:)
call remapping_core_h(CS%remapCS, nz, h1, Tr%t(i,j,:), nz, h2, tr_column, &
h_neglect, h_neglect_edge, PCM_cell=PCM)
else
call remapping_core_h(CS%remapCS, nz, h1, Tr%t(i,j,:), nz, h2, tr_column, &
h_neglect, h_neglect_edge)
endif

! Intermediate steps for tendency of tracer concentration and tracer content.
if (present(dt)) then
Expand Down
Loading

0 comments on commit def40e4

Please sign in to comment.