MOM6
mom_domains::clone_mom_domain Interface Reference

Detailed Description

Copy one MOM_domain_type into another.

Definition at line 99 of file MOM_domains.F90.

Private functions

subroutine clone_md_to_md (MD_in, MOM_dom, min_halo, halo_size, symmetric, domain_name, turns)
 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. More...
 
subroutine clone_md_to_d2d (MD_in, mpp_domain, min_halo, halo_size, symmetric, domain_name, turns)
 clone_MD_to_d2D uses information from a MOM_domain_type to create a new domain2d type, while allowing some properties of the new type to differ from the original one. More...
 

Detailed Description

Copy one MOM_domain_type into another.

Definition at line 99 of file MOM_domains.F90.

Functions and subroutines

◆ clone_md_to_d2d()

subroutine mom_domains::clone_mom_domain::clone_md_to_d2d ( type(mom_domain_type), intent(in)  MD_in,
type(domain2d), intent(inout)  mpp_domain,
integer, dimension(2), intent(inout), optional  min_halo,
integer, intent(in), optional  halo_size,
logical, intent(in), optional  symmetric,
character(len=*), intent(in), optional  domain_name,
integer, intent(in), optional  turns 
)
private

clone_MD_to_d2D uses information from a MOM_domain_type to create a new domain2d type, while allowing some properties of the new type to differ from the original one.

Parameters
[in]md_inAn existing MOM_domain to be cloned
[in,out]mpp_domainThe new mpp_domain to be set up
[in,out]min_haloIf present, this sets the
[in]halo_sizeIf present, this sets the halo size for the domain in the i- and j-directions. min_halo and halo_size can not both be present.
[in]symmetricIf present, this specifies whether the new domain is symmetric, regardless of whether the macro SYMMETRIC_MEMORY_ is defined.
[in]domain_nameA name for the new domain, "MOM"
[in]turnsIf true, swap X and Y axes

Definition at line 1735 of file MOM_domains.F90.

1737  type(MOM_domain_type), intent(in) :: MD_in !< An existing MOM_domain to be cloned
1738  type(domain2d), intent(inout) :: mpp_domain !< The new mpp_domain to be set up
1739  integer, dimension(2), &
1740  optional, intent(inout) :: min_halo !< If present, this sets the
1741  !! minimum halo size for this domain in the i- and j-
1742  !! directions, and returns the actual halo size used.
1743  integer, optional, intent(in) :: halo_size !< If present, this sets the halo
1744  !! size for the domain in the i- and j-directions.
1745  !! min_halo and halo_size can not both be present.
1746  logical, optional, intent(in) :: symmetric !< If present, this specifies
1747  !! whether the new domain is symmetric, regardless of
1748  !! whether the macro SYMMETRIC_MEMORY_ is defined.
1749  character(len=*), &
1750  optional, intent(in) :: domain_name !< A name for the new domain, "MOM"
1751  !! if missing.
1752  integer, optional, intent(in) :: turns !< If true, swap X and Y axes
1753 
1754  integer :: global_indices(4), layout(2), io_layout(2)
1755  integer :: X_FLAGS, Y_FLAGS, niglobal, njglobal, nihalo, njhalo
1756  logical :: symmetric_dom
1757  character(len=64) :: dom_name
1758 
1759  if (present(turns)) &
1760  call mom_error(fatal, "Rotation not supported for MOM_domain to domain2d")
1761 
1762 ! Save the extra data for creating other domains of different resolution that overlay this domain
1763  niglobal = md_in%niglobal ; njglobal = md_in%njglobal
1764  nihalo = md_in%nihalo ; njhalo = md_in%njhalo
1765 
1766  symmetric_dom = md_in%symmetric
1767 
1768  x_flags = md_in%X_FLAGS ; y_flags = md_in%Y_FLAGS
1769  layout(:) = md_in%layout(:) ; io_layout(:) = md_in%io_layout(:)
1770 
1771  if (present(halo_size) .and. present(min_halo)) call mom_error(fatal, &
1772  "clone_MOM_domain can not have both halo_size and min_halo present.")
1773 
1774  if (present(min_halo)) then
1775  nihalo = max(nihalo, min_halo(1))
1776  njhalo = max(njhalo, min_halo(2))
1777  min_halo(1) = nihalo ; min_halo(2) = njhalo
1778  endif
1779 
1780  if (present(halo_size)) then
1781  nihalo = halo_size ; njhalo = halo_size
1782  endif
1783 
1784  if (present(symmetric)) then ; symmetric_dom = symmetric ; endif
1785 
1786  dom_name = "MOM"
1787  if (present(domain_name)) dom_name = trim(domain_name)
1788 
1789  global_indices(1) = 1 ; global_indices(2) = niglobal
1790  global_indices(3) = 1 ; global_indices(4) = njglobal
1791  if (associated(md_in%maskmap)) then
1792  call mom_define_domain( global_indices, layout, mpp_domain, &
1793  xflags=x_flags, yflags=y_flags, &
1794  xhalo=nihalo, yhalo=njhalo, &
1795  symmetry = symmetric, name=dom_name, &
1796  maskmap=md_in%maskmap )
1797  else
1798  call mom_define_domain( global_indices, layout, mpp_domain, &
1799  xflags=x_flags, yflags=y_flags, &
1800  xhalo=nihalo, yhalo=njhalo, &
1801  symmetry = symmetric, name=dom_name)
1802  endif
1803 
1804  if ((io_layout(1) + io_layout(2) > 0) .and. &
1805  (layout(1)*layout(2) > 1)) then
1806  call mom_define_io_domain(mpp_domain, io_layout)
1807  endif
1808 

◆ clone_md_to_md()

subroutine mom_domains::clone_mom_domain::clone_md_to_md ( type(mom_domain_type), intent(in)  MD_in,
type(mom_domain_type), pointer  MOM_dom,
integer, dimension(2), intent(inout), optional  min_halo,
integer, intent(in), optional  halo_size,
logical, intent(in), optional  symmetric,
character(len=*), intent(in), optional  domain_name,
integer, intent(in), optional  turns 
)
private

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.

Parameters
[in]md_inAn existing MOM_domain
mom_domA pointer to a MOM_domain that will be allocated if it is unassociated, and will have data copied from MD_in
[in,out]min_haloIf present, this sets the
[in]halo_sizeIf present, this sets the halo size for the domain in the i- and j-directions. min_halo and halo_size can not both be present.
[in]symmetricIf present, this specifies whether the new domain is symmetric, regardless of whether the macro SYMMETRIC_MEMORY_ is defined.
[in]domain_nameA name for the new domain, "MOM"
[in]turnsNumber of quarter turns

Definition at line 1605 of file MOM_domains.F90.

1607  type(MOM_domain_type), intent(in) :: MD_in !< An existing MOM_domain
1608  type(MOM_domain_type), pointer :: MOM_dom !< A pointer to a MOM_domain that will be
1609  !! allocated if it is unassociated, and will have data
1610  !! copied from MD_in
1611  integer, dimension(2), &
1612  optional, intent(inout) :: min_halo !< If present, this sets the
1613  !! minimum halo size for this domain in the i- and j-
1614  !! directions, and returns the actual halo size used.
1615  integer, optional, intent(in) :: halo_size !< If present, this sets the halo
1616  !! size for the domain in the i- and j-directions.
1617  !! min_halo and halo_size can not both be present.
1618  logical, optional, intent(in) :: symmetric !< If present, this specifies
1619  !! whether the new domain is symmetric, regardless of
1620  !! whether the macro SYMMETRIC_MEMORY_ is defined.
1621  character(len=*), &
1622  optional, intent(in) :: domain_name !< A name for the new domain, "MOM"
1623  !! if missing.
1624  integer, optional, intent(in) :: turns !< Number of quarter turns
1625 
1626  integer :: global_indices(4)
1627  logical :: mask_table_exists
1628  character(len=64) :: dom_name
1629  integer :: qturns
1630 
1631  qturns = 0
1632  if (present(turns)) qturns = turns
1633 
1634  if (.not.associated(mom_dom)) then
1635  allocate(mom_dom)
1636  allocate(mom_dom%mpp_domain)
1637  allocate(mom_dom%mpp_domain_d2)
1638  endif
1639 
1640 ! Save the extra data for creating other domains of different resolution that overlay this domain
1641  mom_dom%symmetric = md_in%symmetric
1642  mom_dom%nonblocking_updates = md_in%nonblocking_updates
1643  mom_dom%thin_halo_updates = md_in%thin_halo_updates
1644 
1645  if (modulo(qturns, 2) /= 0) then
1646  mom_dom%niglobal = md_in%njglobal ; mom_dom%njglobal = md_in%niglobal
1647  mom_dom%nihalo = md_in%njhalo ; mom_dom%njhalo = md_in%nihalo
1648 
1649  mom_dom%X_FLAGS = md_in%Y_FLAGS ; mom_dom%Y_FLAGS = md_in%X_FLAGS
1650  mom_dom%layout(:) = md_in%layout(2:1:-1)
1651  mom_dom%io_layout(:) = md_in%io_layout(2:1:-1)
1652  else
1653  mom_dom%niglobal = md_in%niglobal ; mom_dom%njglobal = md_in%njglobal
1654  mom_dom%nihalo = md_in%nihalo ; mom_dom%njhalo = md_in%njhalo
1655 
1656  mom_dom%X_FLAGS = md_in%X_FLAGS ; mom_dom%Y_FLAGS = md_in%Y_FLAGS
1657  mom_dom%layout(:) = md_in%layout(:)
1658  mom_dom%io_layout(:) = md_in%io_layout(:)
1659  endif
1660 
1661  global_indices(1) = 1 ; global_indices(2) = mom_dom%niglobal
1662  global_indices(3) = 1 ; global_indices(4) = mom_dom%njglobal
1663 
1664  if (associated(md_in%maskmap)) then
1665  mask_table_exists = .true.
1666  allocate(mom_dom%maskmap(mom_dom%layout(1), mom_dom%layout(2)))
1667  if (qturns /= 0) then
1668  call rotate_array(md_in%maskmap(:,:), qturns, mom_dom%maskmap(:,:))
1669  else
1670  mom_dom%maskmap(:,:) = md_in%maskmap(:,:)
1671  endif
1672  else
1673  mask_table_exists = .false.
1674  endif
1675 
1676  if (present(halo_size) .and. present(min_halo)) call mom_error(fatal, &
1677  "clone_MOM_domain can not have both halo_size and min_halo present.")
1678 
1679  if (present(min_halo)) then
1680  mom_dom%nihalo = max(mom_dom%nihalo, min_halo(1))
1681  min_halo(1) = mom_dom%nihalo
1682  mom_dom%njhalo = max(mom_dom%njhalo, min_halo(2))
1683  min_halo(2) = mom_dom%njhalo
1684  endif
1685 
1686  if (present(halo_size)) then
1687  mom_dom%nihalo = halo_size ; mom_dom%njhalo = halo_size
1688  endif
1689 
1690  if (present(symmetric)) then ; mom_dom%symmetric = symmetric ; endif
1691 
1692  dom_name = "MOM"
1693  if (present(domain_name)) dom_name = trim(domain_name)
1694 
1695  if (mask_table_exists) then
1696  call mom_define_domain(global_indices, mom_dom%layout, mom_dom%mpp_domain, &
1697  xflags=mom_dom%X_FLAGS, yflags=mom_dom%Y_FLAGS, &
1698  xhalo=mom_dom%nihalo, yhalo=mom_dom%njhalo, &
1699  symmetry=mom_dom%symmetric, name=dom_name, &
1700  maskmap=mom_dom%maskmap)
1701 
1702  global_indices(2) = global_indices(2) / 2
1703  global_indices(4) = global_indices(4) / 2
1704  call mom_define_domain(global_indices, mom_dom%layout, &
1705  mom_dom%mpp_domain_d2, &
1706  xflags=mom_dom%X_FLAGS, yflags=mom_dom%Y_FLAGS, &
1707  xhalo=(mom_dom%nihalo/2), yhalo=(mom_dom%njhalo/2), &
1708  symmetry=mom_dom%symmetric, name=dom_name, &
1709  maskmap=mom_dom%maskmap)
1710  else
1711  call mom_define_domain(global_indices, mom_dom%layout, mom_dom%mpp_domain, &
1712  xflags=mom_dom%X_FLAGS, yflags=mom_dom%Y_FLAGS, &
1713  xhalo=mom_dom%nihalo, yhalo=mom_dom%njhalo, &
1714  symmetry=mom_dom%symmetric, name=dom_name)
1715 
1716  global_indices(2) = global_indices(2) / 2
1717  global_indices(4) = global_indices(4) / 2
1718  call mom_define_domain(global_indices, mom_dom%layout, &
1719  mom_dom%mpp_domain_d2, &
1720  xflags=mom_dom%X_FLAGS, yflags=mom_dom%Y_FLAGS, &
1721  xhalo=(mom_dom%nihalo/2), yhalo=(mom_dom%njhalo/2), &
1722  symmetry=mom_dom%symmetric, name=dom_name)
1723  endif
1724 
1725  if ((mom_dom%io_layout(1) + mom_dom%io_layout(2) > 0) .and. &
1726  (mom_dom%layout(1)*mom_dom%layout(2) > 1)) then
1727  call mom_define_io_domain(mom_dom%mpp_domain, mom_dom%io_layout)
1728  endif
1729 

The documentation for this interface was generated from the following file: