ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
if_bld Namespace Reference

Classes

struct  HorizFace
 
struct  VertFace
 
struct  HorizMasks
 
struct  VertMasks
 

Functions

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real snapped (amrex::Real b, bool snap) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real raw_face_blank (const amrex::Array4< const amrex::Real > &t, const amrex::Array4< const amrex::Real > &tf, int i, int j, int k, int io, int jo, int ko) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real face_blank (const amrex::Array4< const amrex::Real > &t, const amrex::Array4< const amrex::Real > &tf, int i, int j, int k, int io, int jo, int ko, bool snap, amrex::Real small) noexcept
 
template<int dir>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizFace horiz_face (const amrex::Array4< const amrex::Real > &t, const amrex::Array4< const amrex::Real > &tf, int i, int j, int k, int klo, bool snap, amrex::Real small) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertFace vert_face (const amrex::Array4< const amrex::Real > &t, const amrex::Array4< const amrex::Real > &tf, int i, int j, int k, bool snap, amrex::Real small) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizMasks horiz_masks (amrex::Real t, amrex::Real below, amrex::Real above, amrex::Real lo, amrex::Real hi, bool normal_face, bool use_most, bool snap) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizMasks horiz_masks (const HorizFace &f, bool use_most, bool snap) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertMasks vert_masks (amrex::Real t, amrex::Real above, amrex::Real south, amrex::Real north, amrex::Real west, amrex::Real east, bool above_floor, bool normal_face, bool use_most, bool snap) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertMasks vert_masks (const VertFace &f, bool above_floor, bool use_most, bool snap) noexcept
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real implicit_weight (amrex::Real linear, amrex::Real raw) noexcept
 

Function Documentation

◆ face_blank()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real if_bld::face_blank ( const amrex::Array4< const amrex::Real > &  t,
const amrex::Array4< const amrex::Real > &  tf,
int  i,
int  j,
int  k,
int  io,
int  jo,
int  ko,
bool  snap,
amrex::Real  small 
)
noexcept

The face blanking as the building kernels read it: with the snap, from the snapped cells (solid when either is), so both EB builds give the same staircase; otherwise raw_face_blank; then thresholded at small (eb2.small_volfrac), below which the face counts as fluid.

48 {
49  const amrex::Real b = snap ? amrex::max(snapped(t(i,j,k), snap), snapped(t(i-io,j-jo,k-ko), snap))
50  : raw_face_blank(t, tf, i, j, k, io, jo, ko);
51  return (b < small) ? amrex::Real(zero) : b;
52 }
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ t
Definition: ERF_WSM6.H:293
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real snapped(amrex::Real b, bool snap) noexcept
Definition: ERF_ImmersedBuildingMasks.H:23
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real raw_face_blank(const amrex::Array4< const amrex::Real > &t, const amrex::Array4< const amrex::Real > &tf, int i, int j, int k, int io, int jo, int ko) noexcept
Definition: ERF_ImmersedBuildingMasks.H:34

Referenced by horiz_face(), ERF::make_if_projection_sigma(), and vert_face().

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

◆ horiz_face()

template<int dir>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizFace if_bld::horiz_face ( const amrex::Array4< const amrex::Real > &  t,
const amrex::Array4< const amrex::Real > &  tf,
int  i,
int  j,
int  k,
int  klo,
bool  snap,
amrex::Real  small 
)
noexcept
Parameters
tCell blanking (with at least one ghost cell in each direction)
tfFace-centred blanking of this direction, or an empty Array4
kloLowest cell index of the domain (the face below the domain bottom counts as fluid)
snaperf.if_snap_partial_cells
smalleb2.small_volfrac
76 {
77  static_assert(dir == 0 || dir == 1, "horiz_face: x- or y-faces only");
78  constexpr int io = (dir == 0) ? 1 : 0;
79  constexpr int jo = (dir == 1) ? 1 : 0;
80  HorizFace f;
81  f.t = face_blank(t, tf, i, j, k, io, jo, 0, snap, small);
82  f.below = (k == klo) ? amrex::Real(zero) : face_blank(t, tf, i, j, k-1, io, jo, 0, snap, small);
83  f.above = face_blank(t, tf, i, j, k+1, io, jo, 0, snap, small);
84  f.lo = (dir == 0) ? face_blank(t, tf, i, j-1, k, io, jo, 0, snap, small)
85  : face_blank(t, tf, i-1, j, k, io, jo, 0, snap, small);
86  f.hi = (dir == 0) ? face_blank(t, tf, i, j+1, k, io, jo, 0, snap, small)
87  : face_blank(t, tf, i+1, j, k, io, jo, 0, snap, small);
88  f.raw = raw_face_blank(t, tf, i, j, k, io, jo, 0);
89  f.normal = snap && (snapped(t(i,j,k), snap) != snapped(t(i-io,j-jo,k), snap));
90  return f;
91 }
const int klo
Definition: ERF_InitCustomPert_KE.H:9
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real face_blank(const amrex::Array4< const amrex::Real > &t, const amrex::Array4< const amrex::Real > &tf, int i, int j, int k, int io, int jo, int ko, bool snap, amrex::Real small) noexcept
Definition: ERF_ImmersedBuildingMasks.H:46
Here is the call graph for this function:

◆ horiz_masks() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizMasks if_bld::horiz_masks ( amrex::Real  t,
amrex::Real  below,
amrex::Real  above,
amrex::Real  lo,
amrex::Real  hi,
bool  normal_face,
bool  use_most,
bool  snap 
)
noexcept
Parameters
tBlanking of the face
belowBlanking of the face below (zero at the domain bottom)
aboveBlanking of the face above
loBlanking of the neighbouring face on the low side across the other direction
hiBlanking of the neighbouring face on the high side across the other direction
normal_faceWith the snap, a face joining a solid and a fluid cell (wall-normal)
use_mosterf.if_use_most
snaperf.if_snap_partial_cells
143 {
144  HorizMasks m{};
145  // With the snap every solid face has t = 1: a roof face lies in the top solid row
146  // (t <= below, the face above fluid), and a face carrying a wall law is not also an
147  // interior face. A wall-normal face gets the interior drag (no penetration), not a wall law.
148  m.roof = (!normal_face && t > zero && (snap ? t <= below : t < below) && above == zero && use_most) ? one : zero;
149  m.lo = (!normal_face && t > zero && t <= hi && lo == zero && use_most) ? one : zero;
150  m.hi = (!normal_face && t > zero && t <= lo && hi == zero && use_most) ? one : zero;
151  m.wall = (t > zero && t < one && !use_most) ? one : zero; // all walls without MOST
152  m.side = (t > zero && t < one && use_most && m.most() == zero) ? one : zero; // partial faces not under MOST
153  m.interior = (t == one && !(snap && m.most() > zero)) ? one : zero;
154  return m;
155 }
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37

Referenced by horiz_masks(), ImmersedForcingBuildings_Xmom(), ImmersedForcingBuildings_Ymom(), and ERF::make_if_projection_sigma().

Here is the caller graph for this function:

◆ horiz_masks() [2/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizMasks if_bld::horiz_masks ( const HorizFace &  f,
bool  use_most,
bool  snap 
)
noexcept
159 {
160  return horiz_masks(f.t, f.below, f.above, f.lo, f.hi, f.normal, use_most, snap);
161 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE HorizMasks horiz_masks(const HorizFace &f, bool use_most, bool snap) noexcept
Definition: ERF_ImmersedBuildingMasks.H:158
Here is the call graph for this function:

◆ implicit_weight()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real if_bld::implicit_weight ( amrex::Real  linear,
amrex::Real  raw 
)
noexcept

Weight of the drag the implicit projection applies on a face (erf.if_implicit_projection): the linear-drag weight of the kernel, and the full rate on every face the explicit path zeroes after the projection (raw blanking 1, which the kernels leave without a wall law). The latter also caps the vertical roof face of an exact box without the snap, where the explicit kernel adds the roof and the interior drag together (weight 2 t), at one.

216 {
217  return (raw == one) ? amrex::Real(one) : linear;
218 }

Referenced by ERF::make_if_projection_sigma().

Here is the caller graph for this function:

◆ raw_face_blank()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real if_bld::raw_face_blank ( const amrex::Array4< const amrex::Real > &  t,
const amrex::Array4< const amrex::Real > &  tf,
int  i,
int  j,
int  k,
int  io,
int  jo,
int  ko 
)
noexcept

The face blanking the explicit path zeroes on after the projection (ERF_SlowRhsPost.cpp): the face-centred fraction when the build has it, else the mean of the two cells the face joins. (io, jo, ko) is the unit vector of the face's direction.

36 {
37  return (tf) ? tf(i,j,k) : myhalf * (t(i,j,k) + t(i-io,j-jo,k-ko));
38 }
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41

Referenced by face_blank(), horiz_face(), and vert_face().

Here is the caller graph for this function:

◆ snapped()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real if_bld::snapped ( amrex::Real  b,
bool  snap 
)
noexcept

Cell blanking snapped to solid (1) or fluid (0) at half (erf.if_snap_partial_cells), else as is

24 {
25  return snap ? ((b >= myhalf) ? amrex::Real(one) : amrex::Real(zero)) : b;
26 }
Definition: ERF_ConsoleIO.cpp:17

Referenced by face_blank(), horiz_face(), and vert_face().

Here is the caller graph for this function:

◆ vert_face()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertFace if_bld::vert_face ( const amrex::Array4< const amrex::Real > &  t,
const amrex::Array4< const amrex::Real > &  tf,
int  i,
int  j,
int  k,
bool  snap,
amrex::Real  small 
)
noexcept
102 {
103  VertFace f;
104  f.t = face_blank(t, tf, i, j, k, 0, 0, 1, snap, small);
105  f.above = face_blank(t, tf, i, j, k+1, 0, 0, 1, snap, small);
106  f.south = face_blank(t, tf, i, j-1, k, 0, 0, 1, snap, small);
107  f.north = face_blank(t, tf, i, j+1, k, 0, 0, 1, snap, small);
108  f.west = face_blank(t, tf, i-1, j, k, 0, 0, 1, snap, small);
109  f.east = face_blank(t, tf, i+1, j, k, 0, 0, 1, snap, small);
110  f.raw = raw_face_blank(t, tf, i, j, k, 0, 0, 1);
111  f.normal = snap && (snapped(t(i,j,k), snap) != snapped(t(i,j,k-1), snap));
112  return f;
113 }

Referenced by ImmersedForcingBuildings_Zmom(), and ERF::make_if_projection_sigma().

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

◆ vert_masks() [1/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertMasks if_bld::vert_masks ( amrex::Real  t,
amrex::Real  above,
amrex::Real  south,
amrex::Real  north,
amrex::Real  west,
amrex::Real  east,
bool  above_floor,
bool  normal_face,
bool  use_most,
bool  snap 
)
noexcept
Parameters
tBlanking of the face
aboveBlanking of the face above
south,north,west,eastBlanking of the neighbouring z-faces
above_floorThe face is not the domain bottom (k >= 1)
normal_faceWith the snap, a face joining a solid and a fluid cell (wall-normal)
use_mosterf.if_use_most
snaperf.if_snap_partial_cells
188 {
189  VertMasks m{};
190  m.south = (!normal_face && t > zero && t <= north && south == zero && use_most && above_floor) ? one : zero;
191  m.north = (!normal_face && t > zero && t <= south && north == zero && use_most && above_floor) ? one : zero;
192  m.west = (!normal_face && t > zero && t <= east && west == zero && use_most && above_floor) ? one : zero;
193  m.east = (!normal_face && t > zero && t <= west && east == zero && use_most && above_floor) ? one : zero;
194  m.wall = (t > zero && t < one && !use_most) ? one : zero;
195  m.roof = (!normal_face && t > zero && above == zero && use_most) ? one : zero;
196  // with the snap a face carrying a wall law or the roof drag is not also an interior face
197  m.interior = (t == one && !(snap && (m.most() + m.roof) > zero)) ? one : zero;
198  return m;
199 }

Referenced by ImmersedForcingBuildings_Zmom(), ERF::make_if_projection_sigma(), and vert_masks().

Here is the caller graph for this function:

◆ vert_masks() [2/2]

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertMasks if_bld::vert_masks ( const VertFace &  f,
bool  above_floor,
bool  use_most,
bool  snap 
)
noexcept
203 {
204  return vert_masks(f.t, f.above, f.south, f.north, f.west, f.east, above_floor, f.normal, use_most, snap);
205 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE VertMasks vert_masks(const VertFace &f, bool above_floor, bool use_most, bool snap) noexcept
Definition: ERF_ImmersedBuildingMasks.H:202
Here is the call graph for this function: