1 #ifndef AMREX_MLNODELAP_K_H_
2 #define AMREX_MLNODELAP_K_H_
3 #include <AMReX_Config.H>
13 namespace nodelap_detail {
20 int icell =
offset / nsten;
21 node.
z = icell / (len.
x*len.
y);
22 node.
y = (icell - node.
z*(len.
x*len.
y)) / len.
x;
23 node.
x = (icell - node.
z*(len.
x*len.
y)) - node.
y*len.
x;
39 constexpr
int nstenhalf = AMREX_SPACEDIM == 2 ? 4 : 13;
47 node2.
x = (
offset - node2.
z*9) - node2.
y*3;
62 constexpr
float eps = 1.e-30_rt;
64 constexpr
double eps = 1.e-100_rt;
66 constexpr Real
almostone = Real(1.) - Real(100.)*std::numeric_limits<Real>::epsilon();
76 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
77 if (lobc[idim] == LinOpBCType::Neumann || lobc[idim] == LinOpBCType::inflow) {
79 if (blo.
smallEnd(idim) == nddom.smallEnd(idim)) {
86 if (hibc[idim] == LinOpBCType::Neumann || hibc[idim] == LinOpBCType::inflow) {
88 if (bhi.
bigEnd(idim) == nddom.bigEnd(idim)) {
116 #if (AMREX_SPACEDIM == 1)
118 #elif (AMREX_SPACEDIM == 2)
126 template <
typename T>
132 bclo[1] != LinOpBCType::Periodic,
133 bclo[2] != LinOpBCType::Periodic)}};
135 bchi[1] != LinOpBCType::Periodic,
136 bchi[2] != LinOpBCType::Periodic)}};
140 template <
typename T>
146 bclo[0] == LinOpBCType::inflow,
147 bclo[1] == LinOpBCType::Neumann ||
148 bclo[1] == LinOpBCType::inflow,
149 bclo[2] == LinOpBCType::Neumann ||
150 bclo[2] == LinOpBCType::inflow)}};
152 bchi[0] == LinOpBCType::inflow,
153 bchi[1] == LinOpBCType::Neumann ||
154 bchi[1] == LinOpBCType::inflow,
155 bchi[2] == LinOpBCType::Neumann ||
156 bchi[2] == LinOpBCType::inflow)}};
165 if (!msk(i,j,k) &&
std::abs(sten(i,j,k,0)) > s0_norm0) {
166 x(i,j,k) /= sten(i,j,k,0);
177 sol(i,j,k) = Real(0.0);
178 }
else if (sten(i,j,k,0) != Real(0.0)) {
179 sol(i,j,k) += Real(2./3.) * (rhs(i,j,k) - Ax) / sten(i,j,k,0);
193 sol(i,j,k) = Real(0.0);
194 }
else if (sten(i,j,k,0) != Real(0.0)) {
195 sol(i,j,k) += Real(2./3.) * (rhs(i,j,k) - Ax(i,j,k)) / sten(i,j,k,0);
205 for (
int k = lo.z; k <= hi.z; ++k) {
206 for (
int j = lo.y; j <= hi.y; ++j) {
207 for (
int i = lo.x; i <= hi.x; ++i) {
208 if (msk(i,j,k) == fine_flag) {
return true; }
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D(...)
Definition: AMReX_GpuLaunch.nolint.H:54
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Array4< int const > offset
Definition: AMReX_HypreMLABecLap.cpp:1089
#define AMREX_D_TERM(a, b, c)
Definition: AMReX_SPACE.H:129
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & smallEnd() const &noexcept
Get the smallend of the BoxND.
Definition: AMReX_Box.H:105
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & bigEnd() const &noexcept
Get the bigend.
Definition: AMReX_Box.H:116
#define abs(x)
Definition: complex-type.h:85
constexpr int fine_cell
Definition: AMReX_MLNodeLap_K.H:57
constexpr int fine_node
Definition: AMReX_MLNodeLap_K.H:60
constexpr int crse_node
Definition: AMReX_MLNodeLap_K.H:58
constexpr Real almostzero
Definition: AMReX_MLNodeLap_K.H:67
constexpr int crse_cell
Definition: AMReX_MLNodeLap_K.H:56
constexpr int crse_fine_node
Definition: AMReX_MLNodeLap_K.H:59
constexpr double eps
Definition: AMReX_MLNodeLap_K.H:64
constexpr Real almostone
Definition: AMReX_MLNodeLap_K.H:66
Definition: AMReX_Amr.cpp:49
void mlndlap_bc_doit(Box const &vbx, Array4< T > const &a, Box const &domain, GpuArray< bool, AMREX_SPACEDIM > const &bflo, GpuArray< bool, AMREX_SPACEDIM > const &bfhi) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:110
void mlndlap_scale_neumann_bc(Real s, Box const &bx, Array4< Real > const &rhs, Box const &nddom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &lobc, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &hibc) noexcept
Definition: AMReX_MLNodeLap_K.H:72
void mlndlap_fillbc_cc(Box const &vbx, Array4< T > const &sigma, Box const &domain, GpuArray< LinOpBCType, AMREX_SPACEDIM > bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > bchi) noexcept
Definition: AMReX_MLNodeLap_K.H:127
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_jacobi_sten(int i, int j, int k, Array4< Real > const &sol, Real Ax, Array4< Real const > const &rhs, Array4< Real const > const &sten, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLap_K.H:171
void mlndlap_impose_neumann_bc(Box const &bx, Array4< Real > const &rhs, Box const &nddom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &lobc, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &hibc) noexcept
Definition: AMReX_MLNodeLap_K.H:99
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > bdryLo(const BoxND< dim > &b, int dir, int len=1) noexcept
Returns the edge-centered BoxND (in direction dir) defining the low side of BoxND b.
Definition: AMReX_Box.H:1502
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:315
AMREX_FORCE_INLINE bool mlndlap_any_fine_sync_cells(Box const &bx, Array4< int const > const &msk, int fine_flag) noexcept
Definition: AMReX_MLNodeLap_K.H:201
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308
void mlndlap_unimpose_neumann_bc(Box const &bx, Array4< Real > const &rhs, Box const &nddom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &lobc, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &hibc) noexcept
Definition: AMReX_MLNodeLap_K.H:107
AMREX_GPU_HOST_DEVICE AMREX_ATTRIBUTE_FLATTEN_FOR void LoopConcurrent(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:149
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_normalize_sten(int i, int j, int k, Array4< Real > const &x, Array4< Real const > const &sten, Array4< int const > const &msk, Real s0_norm0) noexcept
Definition: AMReX_MLNodeLap_K.H:161
void mlndlap_applybc(Box const &vbx, Array4< T > const &phi, Box const &domain, GpuArray< LinOpBCType, AMREX_SPACEDIM > bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > bchi) noexcept
Definition: AMReX_MLNodeLap_K.H:141
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > bdryHi(const BoxND< dim > &b, int dir, int len=1) noexcept
Returns the edge-centered BoxND (in direction dir) defining the high side of BoxND b.
Definition: AMReX_Box.H:1525
Definition: AMReX_Array4.H:61
Definition: AMReX_Dim3.H:12
int x
Definition: AMReX_Dim3.H:12
int z
Definition: AMReX_Dim3.H:12
int y
Definition: AMReX_Dim3.H:12
Definition: AMReX_Array.H:33
Definition: AMReX_MLNodeLap_K.H:32
AMREX_GPU_DEVICE Dim3 operator()(int offset, Dim3 const &node)
Definition: AMReX_MLNodeLap_K.H:33
Definition: AMReX_MLNodeLap_K.H:15
AMREX_GPU_DEVICE Dim3 operator()(Dim3 const &lo, Dim3 const &len, int &offset)
Definition: AMReX_MLNodeLap_K.H:16