Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+Add Hybgen remapping options #81

Merged
merged 1 commit into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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