1 #ifndef AMREX_HYPRE_ML_ABECLAP_K_H_
2 #define AMREX_HYPRE_ML_ABECLAP_K_H_
3 #include <AMReX_Config.H>
10 #include <HYPRE_utilities.h>
16 Dim3 const& boxlo,
Dim3 const& boxhi,
25 int level,
IntVect const& fixed_pt)
27 Real bxm =
b[0] ?
b[0](i ,j ,k ) : Real(1.0);
28 Real bxp =
b[0] ?
b[0](i+1,j ,k ) : Real(1.0);
29 Real bym =
b[1] ?
b[1](i ,j ,k ) : Real(1.0);
30 Real byp =
b[1] ?
b[1](i ,j+1,k ) : Real(1.0);
31 #if (AMREX_SPACEDIM > 2)
32 Real bzm =
b[2] ?
b[2](i ,j ,k ) : Real(1.0);
33 Real bzp =
b[2] ?
b[2](i ,j ,k+1) : Real(1.0);
35 Real ac = a ? a(i,j,k) : Real(0.0);
37 sten[1] = -(sb / (dx[0]*dx[0])) * bxm;
38 sten[2] = -(sb / (dx[0]*dx[0])) * bxp;
39 sten[3] = -(sb / (dx[1]*dx[1])) * bym;
40 sten[4] = -(sb / (dx[1]*dx[1])) * byp;
41 #if (AMREX_SPACEDIM == 2)
42 sten[0] = -(sten[1] + sten[2] + sten[3] + sten[4]) + sa*ac;
44 sten[5] = -(sb / (dx[2]*dx[2])) * bzm;
45 sten[6] = -(sb / (dx[2]*dx[2])) * bzp;
46 sten[0] = -(sten[1] + sten[2] + sten[3] + sten[4] + sten[5] + sten[6]) + sa*ac;
52 int const bcmk = bcmsk[cdir](i-1,j,k);
54 int const bct = bctype[cdir];
57 Real xx[3] = {-bcl[cdir], dx[0]*Real(0.5), dx[0]*Real(1.5)};
58 poly_interp_coeff<3>(dx[0]*Real(-0.5), xx, cc);
64 Real fac = (sb / (dx[0]*dx[0])) * bxm;
68 bcrhs[cdir](i,j,k) = fac * cc[0] * bcval[cdir](i-1,j,k);
70 bcrhs[cdir](i,j,k) = Real(0.0);
72 sten[0] -= fac * cc[1];
74 sten[2] -= fac * cc[2];
81 int const bcmk = bcmsk[cdir](i+1,j,k);
83 int const bct = bctype[cdir];
86 Real xx[3] = {-bcl[cdir], dx[0]*Real(0.5), dx[0]*Real(1.5)};
87 poly_interp_coeff<3>(dx[0]*Real(-0.5), xx, cc);
93 Real fac = (sb / (dx[0]*dx[0])) * bxp;
97 bcrhs[cdir](i,j,k) = fac * cc[0] * bcval[cdir](i+1,j,k);
99 bcrhs[cdir](i,j,k) = Real(0.0);
101 sten[0] -= fac * cc[1];
102 sten[1] -= fac * cc[2];
110 int const bcmk = bcmsk[cdir](i,j-1,k);
112 int const bct = bctype[cdir];
115 Real xx[3] = {-bcl[cdir], dx[1]*Real(0.5), dx[1]*Real(1.5)};
116 poly_interp_coeff<3>(dx[1]*Real(-0.5), xx, cc);
122 Real fac = (sb / (dx[1]*dx[1])) * bym;
126 bcrhs[cdir](i,j,k) = fac * cc[0] * bcval[cdir](i,j-1,k);
128 bcrhs[cdir](i,j,k) = Real(0.0);
130 sten[0] -= fac * cc[1];
132 sten[4] -= fac * cc[2];
139 int const bcmk = bcmsk[cdir](i,j+1,k);
141 int const bct = bctype[cdir];
144 Real xx[3] = {-bcl[cdir], dx[1]*Real(0.5), dx[1]*Real(1.5)};
145 poly_interp_coeff<3>(dx[1]*Real(-0.5), xx, cc);
151 Real fac = (sb / (dx[1]*dx[1])) * byp;
155 bcrhs[cdir](i,j,k) = fac * cc[0] * bcval[cdir](i,j+1,k);
157 bcrhs[cdir](i,j,k) = Real(0.0);
159 sten[0] -= fac * cc[1];
160 sten[3] -= fac * cc[2];
165 #if (AMREX_SPACEDIM > 2)
170 int const bcmk = bcmsk[cdir](i,j,k-1);
172 int const bct = bctype[cdir];
175 Real xx[3] = {-bcl[cdir], dx[2]*Real(0.5), dx[2]*Real(1.5)};
176 poly_interp_coeff<3>(dx[2]*Real(-0.5), xx, cc);
182 Real fac = (sb / (dx[2]*dx[2])) * bzm;
186 bcrhs[cdir](i,j,k) = fac * cc[0] * bcval[cdir](i,j,k-1);
188 bcrhs[cdir](i,j,k) = Real(0.0);
190 sten[0] -= fac * cc[1];
192 sten[6] -= fac * cc[2];
199 int const bcmk = bcmsk[cdir](i,j,k+1);
201 int const bct = bctype[cdir];
204 Real xx[3] = {-bcl[cdir], dx[2]*Real(0.5), dx[2]*Real(1.5)};
205 poly_interp_coeff<3>(dx[2]*Real(-0.5), xx, cc);
211 Real fac = (sb / (dx[2]*dx[2])) * bzp;
215 bcrhs[cdir](i,j,k) = fac * cc[0] * bcval[cdir](i,j,k+1);
217 bcrhs[cdir](i,j,k) = Real(0.0);
219 sten[0] -= fac * cc[1];
220 sten[5] -= fac * cc[2];
228 for (
int n = 1; n < 2*AMREX_SPACEDIM+1; ++n) {
241 rhs1(i,j,k) = rhs0(i,j,k);
246 if (bcmsk[cdir](i-1,j,k) > 0) {
247 rhs1(i,j,k) += bcrhs[cdir](i,j,k);
254 if (bcmsk[cdir](i+1,j,k) > 0) {
255 rhs1(i,j,k) += bcrhs[cdir](i,j,k);
262 if (bcmsk[cdir](i,j-1,k) > 0) {
263 rhs1(i,j,k) += bcrhs[cdir](i,j,k);
270 if (bcmsk[cdir](i,j+1,k) > 0) {
271 rhs1(i,j,k) += bcrhs[cdir](i,j,k);
275 #if (AMREX_SPACEDIM > 2)
280 if (bcmsk[cdir](i,j,k-1) > 0) {
281 rhs1(i,j,k) += bcrhs[cdir](i,j,k);
288 if (bcmsk[cdir](i,j,k+1) > 0) {
289 rhs1(i,j,k) += bcrhs[cdir](i,j,k);
298 #if (AMREX_SPACEDIM == 2)
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_LO_DIRICHLET
Definition: AMReX_LO_BCTYPES.H:5
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
Encapsulation of the Orientation of the Faces of a Box.
Definition: AMReX_Orientation.H:29
@ low
Definition: AMReX_Orientation.H:34
@ high
Definition: AMReX_Orientation.H:34
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void hypmlabeclap_rhs(int i, int j, int k, Dim3 const &boxlo, Dim3 const &boxhi, Array4< Real > const &rhs1, Array4< Real const > const &rhs0, GpuArray< Array4< int const >, AMREX_SPACEDIM *2 > const &bcmsk, GpuArray< Array4< Real const >, AMREX_SPACEDIM *2 > const &bcrhs)
Definition: AMReX_HypreMLABecLap_K.H:235
IntVectND< AMREX_SPACEDIM > IntVect
Definition: AMReX_BaseFwd.H:30
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void hypmlabeclap_mat(GpuArray< Real, 2 *AMREX_SPACEDIM+1 > &sten, int i, int j, int k, Dim3 const &boxlo, Dim3 const &boxhi, Real sa, Array4< Real const > const &a, Real sb, GpuArray< Real, AMREX_SPACEDIM > const &dx, GpuArray< Array4< Real const >, AMREX_SPACEDIM > const &b, GpuArray< int, AMREX_SPACEDIM *2 > const &bctype, GpuArray< Real, AMREX_SPACEDIM *2 > const &bcl, GpuArray< Array4< int const >, AMREX_SPACEDIM *2 > const &bcmsk, GpuArray< Array4< Real const >, AMREX_SPACEDIM *2 > const &bcval, GpuArray< Array4< Real >, AMREX_SPACEDIM *2 > const &bcrhs, int level, IntVect const &fixed_pt)
Definition: AMReX_HypreMLABecLap_K.H:15
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:34