ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_PoissonWallDist.cpp File Reference
#include "ERF.H"
#include "ERF_Constants.H"
#include "ERF_Utils.H"
#include "ERF_TerrainPoisson_3D_K.H"
#include "ERF_TerrainMetrics.H"
#include "AMReX_MLMG.H"
#include "AMReX_MLABecLaplacian.H"
Include dependency graph for ERF_PoissonWallDist.cpp:

Functions

static MultiFab surface_slab (const MultiFab &z_nd, int klo)
 
static void assert_surface_gathered (const MultiFab &znd_surf)
 

Function Documentation

◆ assert_surface_gathered()

static void assert_surface_gathered ( const MultiFab &  znd_surf)
static

Stop unless every surface node, valid and x/y ghost, was gathered. The slab has no z ghosts, so the reduction runs over its own ghost vector.

Parameters
znd_surfSurface slab filled by fill_surface_nodes
41 {
42  Real znd_max = ReduceMax(znd_surf, znd_surf.nGrowVect(),
43  [=] AMREX_GPU_HOST_DEVICE (Box const& bx, Array4<Real const> const& a) -> Real
44  {
45  Real m = std::numeric_limits<Real>::lowest();
46  amrex::Loop(bx, [&] (int i, int j, int k) { m = amrex::max(m, a(i,j,k)); });
47  return m;
48  });
49  ParallelAllReduce::Max(znd_max, ParallelContext::CommunicatorSub());
50  // Same threshold as fill_surface_nodes: a node interpolated from a stencil that still
51  // held bogus values is a fraction of bogus_large_value, not equal to it
53  "poisson_wall_dist: the surface nodes were not gathered onto every box");
54 }
constexpr amrex::Real bogus_large_value
Definition: ERF_Constants.H:19
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(axis >=0 &&axis< AMREX_SPACEDIM, "prob.axis must be 0, 1 or 2")
amrex::Real Real
Definition: ERF_ShocInterface.H:19

Referenced by ERF::poisson_wall_dist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ surface_slab()

static MultiFab surface_slab ( const MultiFab &  z_nd,
int  klo 
)
static

Nodal slab at k = klo on the 2D footprint of every box of z_nd, so that boxes that do not touch the surface (a BoxArray split in z, a refined level that stops above the ground) still hold the surface nodes once fill_surface_nodes has run.

Parameters
z_ndNodal physical heights of the level
kloLowest k index of the level's domain
25 {
26  BoxList bl_surf = z_nd.boxArray().boxList();
27  for (auto& b : bl_surf) { b.setRange(2,klo); }
28  BoxArray ba_surf(std::move(bl_surf));
29  IntVect ng_surf = z_nd.nGrowVect(); ng_surf[2] = 0;
30  return MultiFab(ba_surf, z_nd.DistributionMap(), 1, ng_surf);
31 }
const int klo
Definition: ERF_InitCustomPert_KE.H:9

Referenced by ERF::poisson_wall_dist().

Here is the caller graph for this function: