Block-Structured AMR Software Framework
AMReX_MLNodeABecLap_2D_K.H
Go to the documentation of this file.
1 #ifndef AMREX_MLNODEABECLAP_2D_K_H_
2 #define AMREX_MLNODEABECLAP_2D_K_H_
3 
4 namespace amrex {
5 
6 inline void
7 mlndabeclap_gauss_seidel_aa (Box const& bx, Array4<Real> const& sol,
8  Array4<Real const> const& rhs,
9  Real alpha, Real beta,
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
14 {
15  Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
16  Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
17  Real fxy = facx + facy;
18  Real f2xmy = Real(2.0)*facx - facy;
19  Real fmx2y = Real(2.0)*facy - facx;
20 
21  amrex::Loop(bx, [=] (int i, int j, int k) noexcept
22  {
23  if (msk(i,j,k)) {
24  sol(i,j,k) = Real(0.0);
25  } else {
26  Real s0 = (-Real(2.0))*fxy*(bcf(i-1,j-1,k)+bcf(i,j-1,k)+bcf(i-1,j,k)+bcf(i,j,k));
27  Real lap = sol(i-1,j-1,k)*fxy*bcf(i-1,j-1,k)
28  + sol(i+1,j-1,k)*fxy*bcf(i ,j-1,k)
29  + sol(i-1,j+1,k)*fxy*bcf(i-1,j ,k)
30  + sol(i+1,j+1,k)*fxy*bcf(i ,j ,k)
31  + sol(i-1,j,k)*f2xmy*(bcf(i-1,j-1,k)+bcf(i-1,j,k))
32  + sol(i+1,j,k)*f2xmy*(bcf(i ,j-1,k)+bcf(i ,j,k))
33  + sol(i,j-1,k)*fmx2y*(bcf(i-1,j-1,k)+bcf(i,j-1,k))
34  + sol(i,j+1,k)*fmx2y*(bcf(i-1,j ,k)+bcf(i,j ,k))
35  + sol(i,j,k)*s0;
36  Real Ax = alpha*acf(i,j,k)*sol(i,j,k) - beta*lap;
37 
38  sol(i,j,k) += (rhs(i,j,k) - Ax) / (alpha*acf(i,j,k)-beta*s0);
39  }
40  });
41 }
42 
44 mlndabeclap_jacobi_aa (int i, int j, int k, Array4<Real> const& sol,
45  Real lap, Array4<Real const> const& rhs,
46  Real alpha, Real beta,
47  Array4<Real const> const& acf,
48  Array4<Real const> const& bcf,
49  Array4<int const> const& msk,
50  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
51 {
52  if (msk(i,j,k)) {
53  sol(i,j,k) = Real(0.0);
54  } else {
55  Real fac = -Real(2.0/6.0)*(dxinv[0]*dxinv[0] + dxinv[1]*dxinv[1]);
56  Real s0 = fac*(bcf(i-1,j-1,k)+bcf(i,j-1,k)+bcf(i-1,j,k)+bcf(i,j,k));
57  Real Ax = alpha*acf(i,j,k)*sol(i,j,k) - beta*lap;
58 
59  sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax)
60  / (alpha*acf(i,j,k)-beta*s0);
61  }
62 
63 }
64 
65 }
66 
67 #endif
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
Definition: AMReX_Amr.cpp:49
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
AMREX_GPU_HOST_DEVICE AMREX_ATTRIBUTE_FLATTEN_FOR void Loop(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:125