|
ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
|
#include <ERF_PlanarBoundary.H>

Classes | |
| struct | Buffer |
Public Member Functions | |
| void | define (const amrex::BoxArray &ba3d, const amrex::BoxArray &ba2d, const amrex::DistributionMapping &dm, int surface_index, bool is_low=true, int normal_dir=2) |
| void | fill (amrex::MultiFab &mf, const amrex::Periodicity &period) |
| void | gather_surface (const amrex::MultiFab &mf, amrex::MultiFab &dst, int scomp, int dcomp, int ncomp) const |
| const amrex::BoxArray & | surface_boxes () const |
| Cell-centered surface copies of the planar boxes, without duplicates. More... | |
| const amrex::DistributionMapping & | surface_dm () const |
| Ranks owning the surface copies: each is on the rank of the planar box it is a copy of. More... | |
| const amrex::Vector< int > & | surface_index () const |
| Index of each surface copy in the planar BoxArray. More... | |
| AMREX_GPU_HOST bool | is_surface_copy (const int planar_index) const |
| Whether a planar-box index is the computed copy that touches the surface. More... | |
Private Member Functions | |
| amrex::MultiFab & | buffer (const amrex::MultiFab &mf) |
Private Attributes | |
| int | m_nplanar {0} |
| amrex::BoxArray | m_ba_sfc |
| amrex::DistributionMapping | m_dm_sfc |
| amrex::Vector< int > | m_src_index |
| amrex::Vector< Buffer > | m_buffers |
Ghost-cell fill for planar (2D) MultiFabs built on the collapse of a 3D BoxArray along a surface-normal direction.
The surface-layer fields and the MOST averages are defined on one 2D box per 3D box. When the 3D BoxArray is split in the normal direction, several 3D boxes collapse onto the same 2D box, so the planar BoxArray holds duplicate boxes with overlapping valid regions, and only the copy that belongs to the 3D box touching the surface is ever computed. A FillBoundary on such a MultiFab may fill a ghost cell from an uncomputed copy.
define() records which planar boxes are those surface copies. fill() copies them into a buffer without duplicates and ParallelCopies the buffer onto every planar box, valid region and ghost cells alike. Unlike FillBoundary it therefore also overwrites the valid region of the uncomputed copies, so that any copy can be read afterwards. Without duplicates fill() is a plain FillBoundary.
The buffer is kept for each target layout, index type, and number of components, so only the first fill of each kind allocates. For a face-centered MultiFab (the MOST velocity averages) neighbouring surface boxes share a face in the buffer. Both should hold the same value there, but nothing enforces it, so fill() gives the shared faces a single value before it copies: the lowest global box index wins, which does not depend on the decomposition or the rank count, and every copy of the field then agrees.
A level none of whose boxes reaches the surface (a fine level away from the surface) has no computed copy to fill from, and fill() leaves the MultiFab as it is.
|
private |
Gather buffer for one target layout, index type, and number of components, allocated on first use. The source MultiFab list avoids rebuilding the layout key on every fill.
| [in] | mf | planar MultiFab to buffer |
| void PlanarBoundary::define | ( | const amrex::BoxArray & | ba3d, |
| const amrex::BoxArray & | ba2d, | ||
| const amrex::DistributionMapping & | dm, | ||
| int | surface_index, | ||
| bool | is_low = true, |
||
| int | normal_dir = 2 |
||
| ) |
Record the surface copies of a planar BoxArray.
| [in] | ba3d | 3D BoxArray the planar BoxArray was collapsed from |
| [in] | ba2d | planar BoxArray, one box per box of ba3d and in the same order |
| [in] | dm | DistributionMapping shared by ba3d and ba2d |
| [in] | surface_index | index of the surface cell in the normal direction |
| [in] | is_low | whether the surface is the low side of the domain |
| [in] | normal_dir | normal direction of the surface |
Record the surface copies of a planar BoxArray (see ERF_PlanarBoundary.H).
| [in] | ba3d | 3D BoxArray the planar BoxArray was collapsed from |
| [in] | ba2d | planar BoxArray, one box per box of ba3d and in the same order |
| [in] | dm | DistributionMapping shared by ba3d and ba2d |
| [in] | surface_index | index of the surface cell in the normal direction |
| [in] | is_low | whether the surface is the low side of the domain |
| [in] | normal_dir | normal direction of the surface |

| void PlanarBoundary::fill | ( | amrex::MultiFab & | mf, |
| const amrex::Periodicity & | period | ||
| ) |
Fill every copy of a planar MultiFab, valid region and ghost cells, from the surface copies.
| [in,out] | mf | planar MultiFab on ba2d, of any index type and number of components |
| [in] | period | periodicity of the level |
Fill every copy of a planar MultiFab, valid region and ghost cells, from the surface copies (see ERF_PlanarBoundary.H).
| [in,out] | mf | planar MultiFab on the planar BoxArray given to define |
| [in] | period | periodicity of the level |

| void PlanarBoundary::gather_surface | ( | const amrex::MultiFab & | mf, |
| amrex::MultiFab & | dst, | ||
| int | scomp, | ||
| int | dcomp, | ||
| int | ncomp | ||
| ) | const |
Copy the computed surface copies of a planar MultiFab into a MultiFab without duplicates.
define() gives each surface copy the rank of the planar box it is a copy of, so every box of dst is filled from a FAB of mf that lives on the same rank and the gather needs no communication. Reading the surface copies directly, rather than any copy of the field, means the caller need not have filled the duplicates with fill().
| [in] | mf | planar MultiFab on the planar BoxArray given to define |
| [out] | dst | MultiFab on surface_boxes() converted to the index type of mf, and on surface_dm() |
| [in] | scomp | first component to read from mf |
| [in] | dcomp | first component to write in dst |
| [in] | ncomp | number of components |
Copy the computed surface copies of a planar MultiFab into a MultiFab without duplicates (see ERF_PlanarBoundary.H).
| [in] | mf | planar MultiFab on the planar BoxArray given to define |
| [out] | dst | MultiFab on the surface boxes, in the index type of mf |
| [in] | scomp | first component to read from mf |
| [in] | dcomp | first component to write in dst |
| [in] | ncomp | number of components |
Referenced by SurfaceLayer::surface_sum().


|
inline |
Whether a planar-box index is the computed copy that touches the surface.
|
inline |
Cell-centered surface copies of the planar boxes, without duplicates.
Referenced by SurfaceLayer::surface_sum().

|
inline |
Ranks owning the surface copies: each is on the rank of the planar box it is a copy of.
Referenced by SurfaceLayer::surface_sum().

|
inline |
Index of each surface copy in the planar BoxArray.
|
private |
Referenced by surface_boxes().
|
private |
|
private |
Referenced by surface_dm().
|
private |
|
private |
Referenced by is_surface_copy(), and surface_index().