ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_PlanarBoundary.H File Reference
#include <AMReX_BoxArray.H>
#include <AMReX_DistributionMapping.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_IndexType.H>
#include <AMReX_MultiFab.H>
#include <AMReX_Periodicity.H>
#include <AMReX_Vector.H>
#include <algorithm>
#include <memory>
Include dependency graph for ERF_PlanarBoundary.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  PlanarBoundary
 
struct  PlanarBoundary::Buffer
 

Functions

std::unique_ptr< amrex::MultiFab > copy_ground_plane (const amrex::MultiFab &src, int klo)
 
void sum_over_stacked_boxes (amrex::MultiFab &mf, int comp, int ncomp)
 

Function Documentation

◆ copy_ground_plane()

std::unique_ptr<amrex::MultiFab> copy_ground_plane ( const amrex::MultiFab &  src,
int  klo 
)

The ground plane of a field on a level's 3D grids, on one planar box per 3D box.

Box ib of the result is the footprint of box ib of src, cut down to the plane k = klo in the index type of src (so a nodal-in-z field keeps the nodes klo and klo+1), on the rank of box ib. It therefore lines up, box for box, with any MultiFab on the collapsed BoxArray (ba2d) and the level's DistributionMapping, and a kernel that reads src at klo can read it instead from any box, including one that starts above the ground.

Each planar box first takes the lowest plane of its own 3D box, moved down to klo; the ground plane is then copied in from the boxes that hold it. Where no box of the level reaches the ground (a refined level aloft), the planar box keeps that lowest plane: a finite stand-in, not the ground, which callers must not report as the ground.

Parameters
[in]srcfield on the level's 3D grids (any index type, any number of components)
[in]kloindex of the lowest cell of the domain

◆ sum_over_stacked_boxes()

void sum_over_stacked_boxes ( amrex::MultiFab &  mf,
int  comp,
int  ncomp 
)

Finish a column sum computed box by box on a planar MultiFab.

A column sum over a level's 3D grids, accumulated into the planar box of each 3D box, holds in each planar box only the part of the column inside its own 3D box. When the 3D BoxArray is split in z, several planar boxes cover one column; this adds their parts and gives every one of them the whole sum. A planar BoxArray without overlapping boxes is left as it is.

Parameters
[in,out]mfplanar MultiFab, one box per 3D box, cell-centered, no ghost cells used
[in]compfirst component holding a column sum
[in]ncompnumber of components