@@ -135,7 +135,7 @@ module MOM_domain_infra
135135 character (len= 64 ) :: name ! < The name of this domain
136136 type (domain2D), pointer :: mpp_domain = > NULL () ! < The FMS domain with halos
137137 ! ! on this processor, centered at h points.
138- type (domain2D), pointer :: mpp_domain_d2 = > NULL () ! < A coarse FMS domain with halos
138+ type (domain2D), pointer :: mpp_domain_d(:) = > NULL () ! < A coarse FMS domain with halos
139139 ! ! on this processor, centered at h points.
140140 integer :: niglobal ! < The total horizontal i-domain size.
141141 integer :: njglobal ! < The total horizontal j-domain size.
@@ -1377,7 +1377,6 @@ subroutine create_MOM_domain(MOM_dom, n_global, n_halo, reentrant, tripolar_N, l
13771377 if (.not. associated (MOM_dom)) then
13781378 allocate (MOM_dom)
13791379 allocate (MOM_dom% mpp_domain)
1380- allocate (MOM_dom% mpp_domain_d2)
13811380 endif
13821381
13831382 MOM_dom% name = " MOM" ; if (present (domain_name)) MOM_dom% name = trim (domain_name)
@@ -1445,12 +1444,6 @@ subroutine create_MOM_domain(MOM_dom, n_global, n_halo, reentrant, tripolar_N, l
14451444
14461445 call clone_MD_to_d2D(MOM_dom, MOM_dom% mpp_domain)
14471446
1448- ! For downsampled domain, recommend a halo of 1 (or 0?) since we're not doing wide-stencil computations.
1449- ! But that does not work because the downsampled field would not have the correct size to pass the checks, e.g., we get
1450- ! error: downsample_diag_indices_get: peculiar size 28 in i-direction\ndoes not match one of 24 25 26 27
1451- ! call clone_MD_to_d2D(MOM_dom, MOM_dom%mpp_domain_d2, halo_size=(MOM_dom%nihalo/2), coarsen=2)
1452- call clone_MD_to_d2D(MOM_dom, MOM_dom% mpp_domain_d2, coarsen= 2 )
1453-
14541447end subroutine create_MOM_domain
14551448
14561449! > dealloc_MOM_domain deallocates memory associated with a pointer to a MOM_domain_type
@@ -1468,9 +1461,8 @@ subroutine deallocate_MOM_domain(MOM_domain, cursory)
14681461 if (invasive) call mpp_deallocate_domain(MOM_domain% mpp_domain)
14691462 deallocate (MOM_domain% mpp_domain)
14701463 endif
1471- if (associated (MOM_domain% mpp_domain_d2)) then
1472- if (invasive) call mpp_deallocate_domain(MOM_domain% mpp_domain_d2)
1473- deallocate (MOM_domain% mpp_domain_d2)
1464+ if (associated (MOM_domain% mpp_domain_d)) then
1465+ deallocate (MOM_domain% mpp_domain_d)
14741466 endif
14751467 if (associated (MOM_domain% maskmap)) deallocate (MOM_domain% maskmap)
14761468 deallocate (MOM_domain)
@@ -1580,7 +1572,6 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain
15801572 if (.not. associated (MOM_dom)) then
15811573 allocate (MOM_dom)
15821574 allocate (MOM_dom% mpp_domain)
1583- allocate (MOM_dom% mpp_domain_d2)
15841575 endif
15851576
15861577! Save the extra data for creating other domains of different resolution that overlay this domain
@@ -1702,7 +1693,6 @@ subroutine clone_MD_to_MD(MD_in, MOM_dom, min_halo, halo_size, symmetric, domain
17021693 endif
17031694
17041695 call clone_MD_to_d2D(MOM_dom, MOM_dom% mpp_domain, xextent= exni, yextent= exnj)
1705- call clone_MD_to_d2D(MOM_dom, MOM_dom% mpp_domain_d2, domain_name= MOM_dom% name, coarsen= 2 )
17061696
17071697end subroutine clone_MD_to_MD
17081698
@@ -1823,8 +1813,8 @@ subroutine get_domain_extent_MD(Domain, isc, iec, jsc, jec, isd, ied, jsd, jed,
18231813 integer , optional , intent (in ) :: index_offset ! < A fixed additional offset to all indices. This
18241814 ! ! can be useful for some types of debugging with
18251815 ! ! dynamic memory allocation. The default is 0.
1826- integer , optional , intent (in ) :: coarsen ! < A factor by which the grid is coarsened.
1827- ! ! The default is 1 , for no coarsening.
1816+ integer , optional , intent (in ) :: coarsen ! < The index of the factor by which the grid is coarsened.
1817+ ! ! The default is 0 , for no coarsening.
18281818
18291819 ! Local variables
18301820 integer :: isg_, ieg_, jsg_, jeg_
@@ -1834,20 +1824,18 @@ subroutine get_domain_extent_MD(Domain, isc, iec, jsc, jec, isd, ied, jsd, jed,
18341824 local = .true. ; if (present (local_indexing)) local = local_indexing
18351825 ind_off = 0 ; if (present (index_offset)) ind_off = index_offset
18361826
1837- coarsen_lev = 1 ; if (present (coarsen)) coarsen_lev = coarsen
1827+ coarsen_lev = 0 ; if (present (coarsen)) coarsen_lev = coarsen
18381828
1839- if (coarsen_lev == 1 ) then
1829+ if (coarsen_lev == 0 ) then
18401830 call mpp_get_compute_domain(Domain% mpp_domain, isc, iec, jsc, jec)
18411831 call mpp_get_data_domain(Domain% mpp_domain, isd, ied, jsd, jed)
18421832 call mpp_get_global_domain(Domain% mpp_domain, isg_, ieg_, jsg_, jeg_)
1843- elseif (coarsen_lev == 2 ) then
1844- if (.not. associated (Domain% mpp_domain_d2)) call MOM_error(FATAL, &
1845- " get_domain_extent called with coarsen=2, but Domain%mpp_domain_d2 is not associated." )
1846- call mpp_get_compute_domain(Domain% mpp_domain_d2, isc, iec, jsc, jec)
1847- call mpp_get_data_domain(Domain% mpp_domain_d2, isd, ied, jsd, jed)
1848- call mpp_get_global_domain(Domain% mpp_domain_d2, isg_, ieg_, jsg_, jeg_)
18491833 else
1850- call MOM_error(FATAL, " get_domain_extent called with an unsupported level of coarsening." )
1834+ if (.not. associated (Domain% mpp_domain_d)) call MOM_error(FATAL, &
1835+ " get_domain_extent called with coarsen_lev, but Domain%mpp_domain_d(coarsen_lev) is not associated." )
1836+ call mpp_get_compute_domain(Domain% mpp_domain_d(coarsen_lev), isc, iec, jsc, jec)
1837+ call mpp_get_data_domain(Domain% mpp_domain_d(coarsen_lev), isd, ied, jsd, jed)
1838+ call mpp_get_global_domain(Domain% mpp_domain_d(coarsen_lev), isg_, ieg_, jsg_, jeg_)
18511839 endif
18521840
18531841 if (local) then
0 commit comments