10 #ifndef ERF_IMMERSED_BUILDING_MASKS_H_
11 #define ERF_IMMERSED_BUILDING_MASKS_H_
13 #include <AMReX_Array4.H>
14 #include <AMReX_REAL.H>
15 #include <AMReX_GpuQualifiers.H>
22 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
33 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
35 int i,
int j,
int k,
int io,
int jo,
int ko) noexcept
37 return (tf) ? tf(i,j,k) :
myhalf * (
t(i,j,k) +
t(i-io,j-jo,k-ko));
45 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
47 int i,
int j,
int k,
int io,
int jo,
int ko,
bool snap,
amrex::Real small) noexcept
73 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
74 HorizFace horiz_face (
const amrex::Array4<const amrex::Real>&
t,
const amrex::Array4<const amrex::Real>& tf,
75 int i,
int j,
int k,
int klo,
bool snap,
amrex::Real small) noexcept
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;
81 f.
t =
face_blank(
t, tf, i, j, k, 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);
99 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
100 VertFace vert_face (
const amrex::Array4<const amrex::Real>&
t,
const amrex::Array4<const amrex::Real>& tf,
101 int i,
int j,
int k,
bool snap,
amrex::Real small) noexcept
122 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
125 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
139 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
142 bool normal_face,
bool use_most,
bool snap) noexcept
148 m.
roof = (!normal_face &&
t >
zero && (snap ?
t <= below :
t < below) && above ==
zero && use_most) ?
one :
zero;
157 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
160 return horiz_masks(f.t, f.below, f.above, f.lo, f.hi, f.normal, use_most, snap);
169 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
171 [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
184 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
187 bool above_floor,
bool normal_face,
bool use_most,
bool snap) noexcept
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;
195 m.roof = (!normal_face &&
t >
zero && above ==
zero && use_most) ?
one :
zero;
197 m.interior = (
t ==
one && !(snap && (m.most() + m.roof) >
zero)) ?
one :
zero;
201 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
204 return vert_masks(f.t, f.above, f.south, f.north, f.west, f.east, above_floor, f.normal, use_most, snap);
214 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
const int klo
Definition: ERF_InitCustomPert_KE.H:9
Dimensionless numeric literals and pure mathematical constants.
constexpr amrex::Real one
Definition: ERF_NumericalConstants.H:37
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
constexpr amrex::Real myhalf
Definition: ERF_NumericalConstants.H:41
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ t
Definition: ERF_WSM6.H:293
Definition: ERF_ImmersedBuildingMasks.H:19
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
Definition: ERF_ImmersedBuildingMasks.H:140
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 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
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
Definition: ERF_ImmersedBuildingMasks.H:185
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
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
Definition: ERF_ImmersedBuildingMasks.H:74
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
Definition: ERF_ImmersedBuildingMasks.H:100
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real implicit_weight(amrex::Real linear, amrex::Real raw) noexcept
Definition: ERF_ImmersedBuildingMasks.H:215
Definition: ERF_ImmersedBuildingMasks.H:60
amrex::Real t
Definition: ERF_ImmersedBuildingMasks.H:61
bool normal
Definition: ERF_ImmersedBuildingMasks.H:62
amrex::Real raw
Definition: ERF_ImmersedBuildingMasks.H:61
amrex::Real below
Definition: ERF_ImmersedBuildingMasks.H:61
amrex::Real lo
Definition: ERF_ImmersedBuildingMasks.H:61
amrex::Real hi
Definition: ERF_ImmersedBuildingMasks.H:61
amrex::Real above
Definition: ERF_ImmersedBuildingMasks.H:61
Definition: ERF_ImmersedBuildingMasks.H:119
amrex::Real lo
Definition: ERF_ImmersedBuildingMasks.H:120
amrex::Real hi
Definition: ERF_ImmersedBuildingMasks.H:120
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real linear(amrex::Real t) const noexcept
weight of the linear drag CdM |u| toward zero on this face, with t its blanking
Definition: ERF_ImmersedBuildingMasks.H:126
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real most() const noexcept
faces carrying the MOST wall law (a target velocity from the log law)
Definition: ERF_ImmersedBuildingMasks.H:123
amrex::Real roof
Definition: ERF_ImmersedBuildingMasks.H:120
amrex::Real wall
Definition: ERF_ImmersedBuildingMasks.H:120
amrex::Real side
Definition: ERF_ImmersedBuildingMasks.H:120
amrex::Real interior
Definition: ERF_ImmersedBuildingMasks.H:120
Definition: ERF_ImmersedBuildingMasks.H:94
amrex::Real north
Definition: ERF_ImmersedBuildingMasks.H:95
amrex::Real south
Definition: ERF_ImmersedBuildingMasks.H:95
amrex::Real t
Definition: ERF_ImmersedBuildingMasks.H:95
amrex::Real above
Definition: ERF_ImmersedBuildingMasks.H:95
amrex::Real raw
Definition: ERF_ImmersedBuildingMasks.H:95
bool normal
Definition: ERF_ImmersedBuildingMasks.H:96
amrex::Real west
Definition: ERF_ImmersedBuildingMasks.H:95
amrex::Real east
Definition: ERF_ImmersedBuildingMasks.H:95
Definition: ERF_ImmersedBuildingMasks.H:167
amrex::Real interior
Definition: ERF_ImmersedBuildingMasks.H:168
amrex::Real east
Definition: ERF_ImmersedBuildingMasks.H:168
amrex::Real north
Definition: ERF_ImmersedBuildingMasks.H:168
amrex::Real wall
Definition: ERF_ImmersedBuildingMasks.H:168
amrex::Real roof
Definition: ERF_ImmersedBuildingMasks.H:168
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real linear(amrex::Real t) const noexcept
Definition: ERF_ImmersedBuildingMasks.H:172
amrex::Real south
Definition: ERF_ImmersedBuildingMasks.H:168
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real most() const noexcept
Definition: ERF_ImmersedBuildingMasks.H:170
amrex::Real west
Definition: ERF_ImmersedBuildingMasks.H:168