Skip to content
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
4 changes: 2 additions & 2 deletions config_src/drivers/nuopc_cap/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ module MOM_cap_mod
use mpp_domains_mod, only: mpp_get_ntile_count, mpp_get_pelist, mpp_get_global_domain
use mpp_domains_mod, only: mpp_get_domain_npes

use MOM_time_manager, only: set_calendar_type, time_type, set_time, set_date, month_name
use MOM_time_manager, only: set_calendar_type, time_type, set_time, set_date
use MOM_time_manager, only: GREGORIAN, JULIAN, NOLEAP
use MOM_time_manager, only: operator( <= ), operator( < ), operator( >= )
use MOM_time_manager, only: operator( + ), operator( - ), operator( / )
use MOM_time_manager, only: operator( * ), operator( /= ), operator( > )
use MOM_domains, only: MOM_infra_init, MOM_infra_end, num_pes, root_pe, pe_here
use MOM_domains, only: MOM_infra_init, MOM_infra_end
use MOM_file_parser, only: get_param, log_version, param_file_type, close_param_file
use MOM_get_input, only: get_MOM_input, directories
use MOM_domains, only: pass_var
Expand Down
15 changes: 12 additions & 3 deletions config_src/infra/FMS1/MOM_domain_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ end subroutine get_domain_components_d2D
!> clone_MD_to_MD copies one MOM_domain_type into another, while allowing
!! some properties of the new type to differ from the original one.
subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain_name, &
turns, refine, extra_halo)
turns, refine, extra_halo, io_layout)
type(MOM_domain_type), target, intent(in) :: MD_in !< An existing MOM_domain
type(MOM_domain_type), pointer :: MOM_dom
!< A pointer to a MOM_domain that will be
Expand All @@ -1512,6 +1512,8 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain
integer, optional, intent(in) :: refine !< A factor by which to enhance the grid resolution.
integer, optional, intent(in) :: extra_halo !< An extra number of points in the halos
!! compared with MD_in
integer, optional, intent(in) :: io_layout(2)
!< A user-defined IO layout to replace the domain's IO layout

logical :: mask_table_exists
integer, dimension(:), allocatable :: exni ! The extents of the grid for each i-row of the layout.
Expand All @@ -1520,10 +1522,17 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain
! The sum of exni must equal MOM_dom%niglobal.
integer :: qturns ! The number of quarter turns, restricted to the range of 0 to 3.
integer :: i, j, nl1, nl2
integer :: io_layout_in(2)

qturns = 0
if (present(turns)) qturns = modulo(turns, 4)

if (present(io_layout)) then
io_layout_in(:) = io_layout(:)
else
io_layout_in(:) = MD_in%io_layout(:)
endif

if (.not.associated(MOM_dom)) then
allocate(MOM_dom)
allocate(MOM_dom%mpp_domain)
Expand All @@ -1542,15 +1551,15 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain

MOM_dom%X_FLAGS = MD_in%Y_FLAGS ; MOM_dom%Y_FLAGS = MD_in%X_FLAGS
MOM_dom%layout(:) = MD_in%layout(2:1:-1)
MOM_dom%io_layout(:) = MD_in%io_layout(2:1:-1)
MOM_dom%io_layout(:) = io_layout_in(2:1:-1)
else
MOM_dom%niglobal = MD_in%niglobal ; MOM_dom%njglobal = MD_in%njglobal
MOM_dom%nihalo = MD_in%nihalo ; MOM_dom%njhalo = MD_in%njhalo
call get_layout_extents(MD_in, exni, exnj)

MOM_dom%X_FLAGS = MD_in%X_FLAGS ; MOM_dom%Y_FLAGS = MD_in%Y_FLAGS
MOM_dom%layout(:) = MD_in%layout(:)
MOM_dom%io_layout(:) = MD_in%io_layout(:)
MOM_dom%io_layout(:) = io_layout_in(:)
endif

! Ensure that the points per processor are the same on the source and densitation grids.
Expand Down
20 changes: 15 additions & 5 deletions config_src/infra/FMS2/MOM_domain_infra.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module MOM_domain_infra
use mpp_domains_mod, only : To_East => WUPDATE, To_West => EUPDATE, Omit_Corners => EDGEUPDATE
use mpp_domains_mod, only : To_North => SUPDATE, To_South => NUPDATE
use mpp_domains_mod, only : CENTER, CORNER, NORTH_FACE => NORTH, EAST_FACE => EAST
use fms_io_mod, only : file_exist, parse_mask_table
use fms_io_utils_mod, only : file_exists, parse_mask_table
use fms_affinity_mod, only : fms_affinity_init, fms_affinity_set, fms_affinity_get

! This subroutine is not in MOM6/src but may be required by legacy drivers
Expand Down Expand Up @@ -1390,7 +1390,7 @@ subroutine create_MOM_domain(MOM_dom, n_global, n_halo, reentrant, tripolar_N, l
endif

if (present(mask_table)) then
mask_table_exists = file_exist(mask_table)
mask_table_exists = file_exists(mask_table)
if (mask_table_exists) then
allocate(MOM_dom%maskmap(layout(1), layout(2)))
call parse_mask_table(mask_table, MOM_dom%maskmap, MOM_dom%name)
Expand Down Expand Up @@ -1491,7 +1491,7 @@ end subroutine get_domain_components_d2D
!> clone_MD_to_MD copies one MOM_domain_type into another, while allowing
!! some properties of the new type to differ from the original one.
subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain_name, &
turns, refine, extra_halo)
turns, refine, extra_halo, io_layout)
type(MOM_domain_type), target, intent(in) :: MD_in !< An existing MOM_domain
type(MOM_domain_type), pointer :: MOM_dom
!< A pointer to a MOM_domain that will be
Expand All @@ -1514,6 +1514,9 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain
integer, optional, intent(in) :: refine !< A factor by which to enhance the grid resolution.
integer, optional, intent(in) :: extra_halo !< An extra number of points in the halos
!! compared with MD_in
integer, optional, intent(in) :: io_layout(2)
!< A user-defined IO layout to replace the domain's IO layout


integer :: global_indices(4)
logical :: mask_table_exists
Expand All @@ -1523,10 +1526,17 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain
! The sum of exni must equal MOM_dom%niglobal.
integer :: qturns ! The number of quarter turns, restricted to the range of 0 to 3.
integer :: i, j, nl1, nl2
integer :: io_layout_in(2)

qturns = 0
if (present(turns)) qturns = modulo(turns, 4)

if (present(io_layout)) then
io_layout_in(:) = io_layout(:)
else
io_layout_in(:) = MD_in%io_layout(:)
endif

if (.not.associated(MOM_dom)) then
allocate(MOM_dom)
allocate(MOM_dom%mpp_domain)
Expand All @@ -1545,15 +1555,15 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain

MOM_dom%X_FLAGS = MD_in%Y_FLAGS ; MOM_dom%Y_FLAGS = MD_in%X_FLAGS
MOM_dom%layout(:) = MD_in%layout(2:1:-1)
MOM_dom%io_layout(:) = MD_in%io_layout(2:1:-1)
MOM_dom%io_layout(:) = io_layout_in(2:1:-1)
else
MOM_dom%niglobal = MD_in%niglobal ; MOM_dom%njglobal = MD_in%njglobal
MOM_dom%nihalo = MD_in%nihalo ; MOM_dom%njhalo = MD_in%njhalo
call get_layout_extents(MD_in, exni, exnj)

MOM_dom%X_FLAGS = MD_in%X_FLAGS ; MOM_dom%Y_FLAGS = MD_in%Y_FLAGS
MOM_dom%layout(:) = MD_in%layout(:)
MOM_dom%io_layout(:) = MD_in%io_layout(:)
MOM_dom%io_layout(:) = io_layout_in(:)
endif

! Ensure that the points per processor are the same on the source and densitation grids.
Expand Down
Loading