5 #ifndef ERF_TERRAIN_IF_H_
6 #define ERF_TERRAIN_IF_H_
8 #include <AMReX_Array.H>
9 #include <AMReX_EB2_IF_Base.H>
33 TerrainIF (amrex::FArrayBox
const& a_z_terrain, amrex::Geometry
const& a_geom,
34 amrex::Gpu::DeviceVector<amrex::Real>& a_dz_stretched)
35 :
terr_arr(a_z_terrain.const_array()),
36 dz_s(a_dz_stretched.data()),
37 dx(a_geom.CellSize(0)),
38 dy(a_geom.CellSize(1)),
39 dz(a_geom.CellSize(2)),
45 i_hi(static_cast<int>(std::round((a_geom.ProbHi(0)-a_geom.ProbLo(0))/a_geom.CellSize(0)))),
46 j_hi(static_cast<int>(std::round((a_geom.ProbHi(1)-a_geom.ProbLo(1))/a_geom.CellSize(1)))),
47 k_hi(static_cast<int>(std::round((a_geom.ProbHi(2)-a_geom.ProbLo(2))/a_geom.CellSize(2))))
58 AMREX_GPU_HOST_DEVICE
inline
76 const int k1 = amrex::Clamp(
static_cast<int>(std::floor((
z-
prob_lo_z) /
dz)), 0,
k_hi - 1);
80 for (
int kk = 0; kk <
k1; ++kk) {
81 z_stretched +=
dz_s[kk];
83 z_stretched += remainder_z *
dz_s[
k1];
92 }
else if (x <= prob_lo_x && y >=
prob_hi_y) {
136 return -(z_stretched - terr_z);
144 AMREX_GPU_HOST_DEVICE
amrex::Real Real
Definition: ERF_ShocInterface.H:19
AMReX EB implicit-function sign convention: >0 is body, 0 is boundary, <0 is fluid.
Definition: ERF_EBIFTerrain.H:24
amrex::Real prob_lo_x
Low problem bounds used for interpolation.
Definition: ERF_EBIFTerrain.H:158
TerrainIF(amrex::FArrayBox const &a_z_terrain, amrex::Geometry const &a_geom, amrex::Gpu::DeviceVector< amrex::Real > &a_dz_stretched)
Construct a terrain implicit function from height and geometry data.
Definition: ERF_EBIFTerrain.H:33
amrex::Array4< amrex::Real const > terr_arr
Terrain height array sampled on the horizontal mesh.
Definition: ERF_EBIFTerrain.H:152
amrex::Real prob_hi_x
High problem bounds used for interpolation.
Definition: ERF_EBIFTerrain.H:160
int k_hi
Number of vertical cells (one past the highest valid dz_s index).
Definition: ERF_EBIFTerrain.H:164
amrex::Real prob_lo_y
Low problem bound in y.
Definition: ERF_EBIFTerrain.H:158
amrex::Real const * dz_s
Device pointer to stretched vertical cell sizes.
Definition: ERF_EBIFTerrain.H:154
amrex::Real dx
Uniform computational grid spacing in each direction.
Definition: ERF_EBIFTerrain.H:156
amrex::Real prob_lo_z
Low problem bound in z.
Definition: ERF_EBIFTerrain.H:158
int j_hi
Highest terrain-array index in y.
Definition: ERF_EBIFTerrain.H:162
int i_hi
Highest terrain-array index in the x and y directions.
Definition: ERF_EBIFTerrain.H:162
amrex::Real dy
Uniform computational grid spacing in y.
Definition: ERF_EBIFTerrain.H:156
AMREX_GPU_HOST_DEVICE amrex::Real operator()(AMREX_D_DECL(amrex::Real x, amrex::Real y, amrex::Real z)) const noexcept
Evaluate the signed implicit-function value at physical coordinates.
Definition: ERF_EBIFTerrain.H:59
amrex::Real dz
Uniform computational grid spacing in z.
Definition: ERF_EBIFTerrain.H:156
amrex::Real prob_hi_y
High problem bound in y.
Definition: ERF_EBIFTerrain.H:160
@ p
Definition: ERF_WSM6.H:191
real(c_double), private k1
Definition: ERF_module_mp_morr_two_moment.F90:213