1 #ifndef AMREX_MLNODEABECLAP_3D_K_H_
2 #define AMREX_MLNODEABECLAP_3D_K_H_
8 Array4<Real const>
const& rhs,
10 Array4<Real const>
const& acf,
11 Array4<Real const>
const& bcf,
12 Array4<int const>
const& msk,
13 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
15 Real facx = Real(1.0/36.0)*dxinv[0]*dxinv[0];
16 Real facy = Real(1.0/36.0)*dxinv[1]*dxinv[1];
17 Real facz = Real(1.0/36.0)*dxinv[2]*dxinv[2];
18 Real fxyz = facx + facy + facz;
19 Real fmx2y2z = -facx + Real(2.0)*facy + Real(2.0)*facz;
20 Real f2xmy2z = Real(2.0)*facx - facy + Real(2.0)*facz;
21 Real f2x2ymz = Real(2.0)*facx + Real(2.0)*facy - facz;
22 Real f4xm2ym2z = Real(4.0)*facx - Real(2.0)*facy - Real(2.0)*facz;
23 Real fm2x4ym2z = -Real(2.0)*facx + Real(4.0)*facy - Real(2.0)*facz;
24 Real fm2xm2y4z = -Real(2.0)*facx - Real(2.0)*facy + Real(4.0)*facz;
29 sol(i,j,k) = Real(0.0);
31 Real s0 = Real(-4.0)*fxyz*(bcf(i-1,j-1,k-1)+bcf(i,j-1,k-1)+bcf(i-1,j,k-1)+bcf(i,j,k-1)
32 +bcf(i-1,j-1,k )+bcf(i,j-1,k )+bcf(i-1,j,k )+bcf(i,j,k ));
33 Real lap = sol(i,j,k)*s0
34 + fxyz*(sol(i-1,j-1,k-1)*bcf(i-1,j-1,k-1)
35 + sol(i+1,j-1,k-1)*bcf(i ,j-1,k-1)
36 + sol(i-1,j+1,k-1)*bcf(i-1,j ,k-1)
37 + sol(i+1,j+1,k-1)*bcf(i ,j ,k-1)
38 + sol(i-1,j-1,k+1)*bcf(i-1,j-1,k )
39 + sol(i+1,j-1,k+1)*bcf(i ,j-1,k )
40 + sol(i-1,j+1,k+1)*bcf(i-1,j ,k )
41 + sol(i+1,j+1,k+1)*bcf(i ,j ,k ))
42 + fmx2y2z*(sol(i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-1,k )+bcf(i,j-1,k )+bcf(i-1,j,k )+bcf(i,j,k )));
60 Real Ax = alpha*acf(i,j,k)*sol(i,j,k) - beta*lap;
62 sol(i,j,k) += (rhs(i,j,k) - Ax) / (alpha*acf(i,j,k)-beta*s0);
69 Real lap, Array4<Real const>
const& rhs,
70 Real alpha, Real beta,
71 Array4<Real const>
const& acf,
72 Array4<Real const>
const& bcf,
73 Array4<int const>
const& msk,
74 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
77 sol(i,j,k) = Real(0.0);
79 Real fxyz = Real(-4.0 / 36.0)*(dxinv[0]*dxinv[0] +
82 Real s0 = fxyz*(bcf(i-1,j-1,k-1)+bcf(i,j-1,k-1)+bcf(i-1,j,k-1)+bcf(i,j,k-1)
83 +bcf(i-1,j-1,k )+bcf(i,j-1,k )+bcf(i-1,j,k )+bcf(i,j,k));
84 Real Ax = alpha*acf(i,j,k)*sol(i,j,k) - beta*lap;
86 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax)
87 / (alpha*acf(i,j,k)-beta*s0);
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
Definition: AMReX_Amr.cpp:49
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:355
BoxND< AMREX_SPACEDIM > Box
Definition: AMReX_BaseFwd.H:27
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndabeclap_jacobi_aa(int, int, int, Array4< Real > const &, Real, Array4< Real const > const &, Real, Real, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, GpuArray< Real, AMREX_SPACEDIM > const &) noexcept
Definition: AMReX_MLNodeABecLap_1D_K.H:17
void mlndabeclap_gauss_seidel_aa(Box const &, Array4< Real > const &, Array4< Real const > const &, Real, Real, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, GpuArray< Real, AMREX_SPACEDIM > const &) noexcept
Definition: AMReX_MLNodeABecLap_1D_K.H:7