Block-Structured AMR Software Framework
AMReX_MLNodeLap_1D_K.H
Go to the documentation of this file.
1 #ifndef AMREX_MLNODELAP_1D_K_H_
2 #define AMREX_MLNODELAP_1D_K_H_
3 #include <AMReX_Config.H>
4 
5 namespace amrex {
6 
8 void mlndlap_set_nodal_mask (int i, int, int, Array4<int> const& nmsk,
9  Array4<int const> const& cmsk) noexcept
10 {
11  using namespace nodelap_detail;
12 
13  int s = cmsk(i-1,0,0) + cmsk(i,0,0);
14  if (s == 2*crse_cell) {
15  nmsk(i,0,0) = crse_node;
16  } else if (s == 2*fine_cell) {
17  nmsk(i,0,0) = fine_node;
18  } else {
19  nmsk(i,0,0) = crse_fine_node;
20  }
21 }
22 
24 void mlndlap_set_dirichlet_mask (Box const& bx, Array4<int> const& dmsk,
25  Array4<int const> const& omsk, Box const& dom,
27  GpuArray<LinOpBCType, AMREX_SPACEDIM> const& bchi) noexcept
28 {
29  const auto lo = bx.smallEnd(0);
30  const auto hi = bx.bigEnd(0);
32  for (int i = lo; i <= hi; ++i) {
33  if (!dmsk(i,0,0)) {
34  dmsk(i,0,0) = (omsk(i-1,0,0) == 1 || omsk(i,0,0) == 1);
35  }
36  }
37 
38  const auto domlo = dom.smallEnd(0);
39  const auto domhi = dom.bigEnd(0);
40 
41  if (bclo[0] == LinOpBCType::Dirichlet && lo == domlo) {
42  dmsk(lo,0,0) = 1;
43  }
44 
45  if (bchi[0] == LinOpBCType::Dirichlet && hi == domhi) {
46  dmsk(hi,0,0) = 1;
47  }
48 }
49 
51 void mlndlap_set_dot_mask (Box const& bx, Array4<Real> const& dmsk,
52  Array4<int const> const& omsk, Box const& dom,
54  GpuArray<LinOpBCType, AMREX_SPACEDIM> const& bchi) noexcept
55 {
56  const auto lo = bx.smallEnd(0);
57  const auto hi = bx.bigEnd(0);
58 
60  for (int i = lo; i <= hi; ++i) {
61  dmsk(i,0,0) = static_cast<Real>(omsk(i,0,0));
62  }
63 
64  const auto domlo = dom.smallEnd(0);
65  const auto domhi = dom.bigEnd(0);
66 
67  if ((bclo[0] == LinOpBCType::Neumann || bclo[0] == LinOpBCType::inflow)
68  && lo == domlo)
69  {
70  dmsk(lo,0,0) *= Real(0.5);
71  }
72 
73  if ((bchi[0] == LinOpBCType::Neumann || bchi[0] == LinOpBCType::inflow)
74  && hi == domhi)
75  {
76  dmsk(hi,0,0) *= Real(0.5);
77  }
78 }
79 
81 void mlndlap_zero_fine (int i, int, int, Array4<Real> const& phi,
82  Array4<int const> const& msk, int fine_flag) noexcept
83 {
84  // Testing if the node is covered by a fine level in computing
85  // coarse sync residual
86  if (msk(i-1,0,0) == fine_flag &&
87  msk(i ,0,0) == fine_flag)
88  {
89  phi(i,0,0) = Real(0.0);
90  }
91 }
92 
94 void mlndlap_avgdown_coeff_x (int i, int, int, Array4<Real> const& crse,
95  Array4<Real const> const& fine) noexcept
96 {
97  Real a = fine(2*i ,0,0);
98  Real b = fine(2*i+1,0,0);
99  crse(i,0,0) = Real(2.0)*a*b/(a+b);
100 }
101 
103 void mlndlap_semi_avgdown_coeff (int i, int j, int k, Array4<Real> const& crse,
104  Array4<Real const> const& fine, int) noexcept
105 {
107 }
108 
109 template <typename T>
110 void mlndlap_bc_doit (Box const& vbx, Array4<T> const& a, Box const& domain,
111  GpuArray<bool,AMREX_SPACEDIM> const& bflo,
112  GpuArray<bool,AMREX_SPACEDIM> const& bfhi) noexcept
113 {
114  Box gdomain = domain;
115  int const idim = 0;
116  if (! bflo[idim]) { gdomain.growLo(idim,1); }
117  if (! bfhi[idim]) { gdomain.growHi(idim,1); }
118 
119  if (gdomain.strictly_contains(vbx)) { return; }
120 
121  const int offset = domain.cellCentered() ? 0 : 1;
122 
123  const auto dlo = domain.smallEnd(0);
124  const auto dhi = domain.bigEnd(0);
125 
126  Box const& sbox = amrex::grow(vbx,1);
127  AMREX_HOST_DEVICE_FOR_3D(sbox, i, j, k,
128  {
129  if (! gdomain.contains(IntVect(i))) {
130  if (i == dlo-1 && bflo[0])
131  {
132  a(i,0,0) = a(i+1+offset, j, k);
133  }
134  else if (i == dhi+1 && bfhi[0])
135  {
136  a(i,0,0) = a(i-1-offset, j, k);
137  }
138  }
139  });
140 }
141 
143 Real mlndlap_adotx_c (int i, int, int, Array4<Real const> const& x,
144  Real sigma, Array4<int const> const& msk,
145  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
146 {
147  if (msk(i,0,0)) {
148  return Real(0.0);
149  } else {
150  Real y = x(i-1,0,0)
151  + x(i+1,0,0)
152  + x(i ,0,0)*Real(-2.0);
153  return dxinv[0]*dxinv[0] * y * sigma;
154  }
155 }
156 
158 Real mlndlap_adotx_ha (int i, int, int, Array4<Real const> const& x,
159  Array4<Real const> const& sx, Array4<int const> const& msk,
160  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
161 {
162  if (msk(i,0,0)) {
163  return Real(0.0);
164  } else {
165  Real y = (x(i+1,0,0) - x(i ,0,0)) * sx(i ,0,0)
166  - (x(i ,0,0) - x(i-1,0,0)) * sx(i-1,0,0);
167  return dxinv[0]*dxinv[0] * y;
168  }
169 }
170 
172 Real mlndlap_adotx_aa (int i, int j, int k, Array4<Real const> const& x,
173  Array4<Real const> const& sx, Array4<int const> const& msk,
174  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
175 {
176  return mlndlap_adotx_ha(i,j,k,x,sx,msk,dxinv);
177 }
178 
180 void mlndlap_normalize_ha (int i, int, int, Array4<Real> const& x,
181  Array4<Real const> const& sx, Array4<int const> const& msk,
182  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
183 {
184  if (!msk(i,0,0)) {
185  x(i,0,0) /= -dxinv[0]*dxinv[0] * (sx(i-1,0,0)+sx(i,0,0));
186  }
187 }
188 
190 void mlndlap_normalize_aa (int i, int j, int k, Array4<Real> const& x,
191  Array4<Real const> const& sx, Array4<int const> const& msk,
192  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
193 {
194  mlndlap_normalize_ha(i,j,k,x,sx,msk,dxinv);
195 }
196 
198 void mlndlap_jacobi_ha (int i, int, int, Array4<Real> const& sol, Real Ax,
199  Array4<Real const> const& rhs, Array4<Real const> const& sx,
200  Array4<int const> const& msk,
201  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
202 {
203  if (msk(i,0,0)) {
204  sol(i,0,0) = Real(0.0);
205  } else {
206  sol(i,0,0) += Real(2.0/3.0) * (rhs(i,0,0) - Ax)
207  / (-dxinv[0]*dxinv[0] * (sx(i-1,0,0)+sx(i,0,0)));
208  }
209 }
210 
211 inline
212 void mlndlap_jacobi_ha (Box const& bx, Array4<Real> const& sol, Array4<Real const> const& Ax,
213  Array4<Real const> const& rhs, Array4<Real const> const& sx,
214  Array4<int const> const& msk,
215  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
216 {
217  Real fac = -dxinv[0]*dxinv[0];
218 
219  amrex::LoopConcurrentOnCpu(bx, [&] (int i, int, int) noexcept
220  {
221  if (msk(i,0,0)) {
222  sol(i,0,0) = Real(0.0);
223  } else {
224  sol(i,0,0) += Real(2.0/3.0) * (rhs(i,0,0) - Ax(i,0,0))
225  / (fac * (sx(i-1,0,0)+sx(i,0,0)));
226  }
227  });
228 }
229 
231 void mlndlap_jacobi_aa (int i, int j, int k, Array4<Real> const& sol, Real Ax,
232  Array4<Real const> const& rhs, Array4<Real const> const& sig,
233  Array4<int const> const& msk, GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
234 {
235  mlndlap_jacobi_ha(i,j,k,sol,Ax,rhs,sig,msk,dxinv);
236 }
237 
238 inline
239 void mlndlap_jacobi_aa (Box const& bx, Array4<Real> const& sol, Array4<Real const> const& Ax,
240  Array4<Real const> const& rhs, Array4<Real const> const& sig,
241  Array4<int const> const& msk, GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
242 {
243  mlndlap_jacobi_ha(bx,sol,Ax,rhs,sig,msk,dxinv);
244 }
245 
247 void mlndlap_jacobi_c (int i, int, int, Array4<Real> const& sol, Real Ax,
248  Array4<Real const> const& rhs, Real sig,
249  Array4<int const> const& msk, GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
250 {
251  if (msk(i,0,0)) {
252  sol(i,0,0) = Real(0.0);
253  } else {
254  sol(i,0,0) += Real(2.0/3.0) * (rhs(i,0,0) - Ax)
255  / (-dxinv[0]*dxinv[0]*Real(2.0)*sig);
256  }
257 }
258 
259 inline
260 void mlndlap_jacobi_c (Box const& bx, Array4<Real> const& sol, Array4<Real const> const& Ax,
261  Array4<Real const> const& rhs, Real sig,
262  Array4<int const> const& msk, GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
263 {
264  amrex::LoopConcurrentOnCpu(bx, [&] (int i, int, int) noexcept
265  {
266  if (msk(i,0,0)) {
267  sol(i,0,0) = Real(0.0);
268  } else {
269  sol(i,0,0) += Real(2.0/3.0) * (rhs(i,0,0) - Ax(i,0,0))
270  / (-dxinv[0]*dxinv[0]*Real(2.0)*sig);
271  }
272  });
273 }
274 
275 inline
276 void mlndlap_gauss_seidel_ha (Box const& bx, Array4<Real> const& sol,
277  Array4<Real const> const& rhs,
278  Array4<Real const> const& sx,
279  Array4<int const> const& msk,
280  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
281 {
282  Real fac = dxinv[0]*dxinv[0];
283 
284  amrex::LoopOnCpu(bx, [&] (int i, int, int) noexcept
285  {
286  if (msk(i,0,0)) {
287  sol(i,0,0) = Real(0.0);
288  } else {
289  Real s0 = Real(-1.0) * fac * (sx(i-1,0,0)+sx(i,0,0));
290  Real Ax = sol(i-1,0,0)*fac*sx(i-1,0,0)
291  + sol(i+1,0,0)*fac*sx(i ,0,0)
292  + sol(i ,0,0)*s0;
293  sol(i,0,0) += (rhs(i,0,0) - Ax) / s0;
294  }
295  });
296 }
297 
298 inline
299 void mlndlap_gauss_seidel_aa (Box const& bx, Array4<Real> const& sol,
300  Array4<Real const> const& rhs,
301  Array4<Real const> const& sx,
302  Array4<int const> const& msk,
303  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
304 {
305  mlndlap_gauss_seidel_ha(bx,sol,rhs,sx,msk,dxinv);
306 }
307 
308 inline
309 void mlndlap_gauss_seidel_c (Box const& bx, Array4<Real> const& sol,
310  Array4<Real const> const& rhs, Real sig,
311  Array4<int const> const& msk,
312  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
313 {
314  Real fac = dxinv[0]*dxinv[0];
315 
316  amrex::LoopOnCpu(bx, [&] (int i, int, int) noexcept
317  {
318  if (msk(i,0,0)) {
319  sol(i,0,0) = Real(0.0);
320  } else {
321  Real s0 = Real(-2.0) * fac * sig;
322  Real Ax = sol(i-1,0,0)*fac*sig
323  + sol(i+1,0,0)*fac*sig
324  + sol(i ,0,0)*s0;
325  sol(i,0,0) += (rhs(i,0,0) - Ax) / s0;
326  }
327  });
328 }
329 
330 inline
332  Array4<Real const> const&, Array4<Real const> const&,
333  Array4<int const> const&, GpuArray<Real,AMREX_SPACEDIM> const&) noexcept
334 {
335  amrex::Abort("mlndlap_gauss_seidel_with_line_solve_aa: not implemented in 1D");
336 }
337 
338 
340 void mlndlap_restriction (int i, int, int, Array4<Real> const& crse,
341  Array4<Real const> const& fine, Array4<int const> const& msk) noexcept
342 {
343  int ii = i*2;
344  if (msk(ii,0,0)) {
345  crse(i,0,0) = Real(0.0);
346  } else {
347  crse(i,0,0) = Real(1./4.) *(fine(ii-1,0,0)
348  + Real(2.)* fine(ii ,0,0)
349  + fine(ii+1,0,0));
350  }
351 }
352 
353 template <int rr>
355 void mlndlap_restriction (int i, int, int, Array4<Real> const& crse,
356  Array4<Real const> const& fine, Array4<int const> const& msk,
357  Box const& fdom,
359  GpuArray<LinOpBCType, AMREX_SPACEDIM> const& bchi) noexcept
360 
361 {
362  const int ii = i*rr;
363  if (msk(ii,0,0)) {
364  crse(i,0,0) = Real(0.0);
365  } else {
366  const auto ndlo = fdom.smallEnd(0);
367  const auto ndhi = fdom.bigEnd(0);
368  Real tmp = Real(0.0);
369  for (int ioff = -rr+1; ioff <= rr-1; ++ioff) {
370  Real wx = rr - std::abs(ioff);
371  int itmp = ii + ioff;
372  if ((itmp < ndlo && (bclo[0] == LinOpBCType::Neumann ||
373  bclo[0] == LinOpBCType::inflow)) ||
374  (itmp > ndhi && (bchi[0] == LinOpBCType::Neumann ||
375  bchi[0] == LinOpBCType::inflow))) {
376  itmp = ii - ioff;
377  }
378  tmp += wx*fine(itmp,0,0);
379  }
380  crse(i,0,0) = tmp*(Real(1.0)/Real(rr*rr));
381  }
382 }
383 
385 void mlndlap_semi_restriction (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
386  Array4<Real const> const&, Array4<int const> const&, int) noexcept
387 {
388  amrex::Abort("mlndlap_semi_restriction: not implemented in 1D");
389 }
390 
392 void mlndlap_interpadd_c (int i, int , int, Array4<Real> const& fine,
393  Array4<Real const> const& crse,
394  Array4<int const> const& msk) noexcept
395 {
396  if (!msk(i,0,0)) {
397  int ic = amrex::coarsen(i,2);
398  bool i_is_odd = (ic*2 != i);
399  if (i_is_odd) {
400  // Node on X line
401  fine(i,0,0) += Real(0.5) * (crse(ic,0,0)+crse(ic+1,0,0));
402  } else {
403  // Node coincident with coarse node
404  fine(i,0,0) += crse(ic,0,0);
405  }
406  }
407 }
408 
410 void mlndlap_interpadd_aa (int i, int , int, Array4<Real> const& fine,
411  Array4<Real const> const& crse, Array4<Real const> const& sig,
412  Array4<int const> const& msk) noexcept
413 {
414  if (!msk(i,0,0)) {
415  int ic = amrex::coarsen(i,2);
416  bool i_is_odd = (ic*2 != i);
417  if (i_is_odd) {
418  // Node on X line
419  fine(i,0,0) += (sig(i-1,0,0)*crse(ic,0,0) + sig(i,0,0)*crse(ic+1,0,0))
420  / (sig(i-1,0,0) + sig(i,0,0));
421  } else {
422  // Node coincident with coarse node
423  fine(i,0,0) += crse(ic,0,0);
424  }
425  }
426 }
427 
429 void mlndlap_semi_interpadd_aa (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
430  Array4<Real const> const&, Array4<Real const> const&,
431  Array4<int const> const&, int) noexcept
432 {}
433 
435 void mlndlap_interpadd_ha (int i, int j, int k, Array4<Real> const& fine,
436  Array4<Real const> const& crse, Array4<Real const> const& sig,
437  Array4<int const> const& msk) noexcept
438 {
439  mlndlap_interpadd_aa(i,j,k,fine,crse,sig,msk);
440 }
441 
443 void mlndlap_divu (int i, int, int, Array4<Real> const& rhs, Array4<Real const> const& vel,
444  Array4<int const> const& msk, GpuArray<Real,AMREX_SPACEDIM> const& dxinv,
445  Box const&,
448 {
449  Real fac = dxinv[0];
450  if (msk(i,0,0)) {
451  rhs(i,0,0) = Real(0.0);
452  } else {
453  rhs(i,0,0) = fac*(vel(i,0,0)-vel(i-1,0,0));
454  }
455 }
456 
458 Real mlndlap_rhcc (int i, int, int, Array4<Real const> const& rhcc,
459  Array4<int const> const& msk) noexcept
460 {
461  Real r;
462  if (msk(i,0,0)) {
463  r = Real(0.0);
464  } else {
465  r = Real(0.5) * (rhcc(i-1,0,0)+rhcc(i,0,0));
466  }
467  return r;
468 }
469 
471 void mlndlap_mknewu (int i, int, int, Array4<Real> const& u,
472  Array4<Real const> const& p,
473  Array4<Real const> const& sig,
474  GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
475 {
476  Real fac = dxinv[0];
477  u(i,0,0) -= sig(i,0,0)*fac*(p(i+1,0,0)-p(i,0,0));
478 }
479 
481 void mlndlap_mknewu_c (int i, int, int, Array4<Real> const& u,
482  Array4<Real const> const& p,
483  Real sig, GpuArray<Real,AMREX_SPACEDIM> const& dxinv) noexcept
484 {
485  Real fac = dxinv[0];
486  u(i,0,0) -= sig*fac*(p(i+1,0,0)-p(i,0,0));
487 }
488 
489 template <int rr>
491 void mlndlap_rhcc_fine_contrib (int /*i*/, int /*j*/, int /*k*/, Box const&,
492  Array4<Real> const&, Array4<Real const> const&,
493  Array4<int const> const&) noexcept
494 {}
495 
497 void mlndlap_divu_cf_contrib (int, int, int, Array4<Real> const&,
498  Array4<Real const> const&, Array4<Real const> const&,
499  Array4<Real const> const&, Array4<int const> const&,
500  Array4<int const> const&, Array4<int const> const&,
504  bool) noexcept
505 {}
506 
508 void mlndlap_crse_resid (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
509  Array4<Real const> const&, Array4<int const> const&,
512  bool) noexcept
513 {}
514 
516 void mlndlap_res_cf_contrib (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
517  Array4<Real const> const&, Array4<Real const> const&,
518  Array4<Real const> const&, Array4<int const> const&,
519  Array4<int const> const&, Array4<int const> const&,
520  Array4<Real const> const&,
521  GpuArray<Real,AMREX_SPACEDIM> const&, Box const&,
524  bool) noexcept
525 {}
526 
528 void mlndlap_res_cf_contrib_cs (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
529  Array4<Real const> const&, Array4<Real const> const&,
530  Real, Array4<int const> const&,
531  Array4<int const> const&, Array4<int const> const&,
532  Array4<Real const> const&,
533  GpuArray<Real,AMREX_SPACEDIM> const&, Box const&,
536  bool) noexcept
537 {}
538 
540 void mlndlap_set_stencil (Box const&, Array4<Real> const&,
541  Array4<Real const> const&,
542  GpuArray<Real,AMREX_SPACEDIM> const&) noexcept
543 {}
544 
546 void mlndlap_set_stencil_s0 (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&) noexcept
547 {}
548 
550 void mlndlap_stencil_rap (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
551  Array4<Real const> const&) noexcept
552 {}
553 
555 Real mlndlap_adotx_sten (int /*i*/, int /*j*/, int /*k*/, Array4<Real const> const&,
556  Array4<Real const> const&, Array4<int const> const&) noexcept
557 { return Real(0.0); }
558 
559 inline
561  Array4<Real const> const&,
562  Array4<Real const> const&,
563  Array4<int const> const&) noexcept
564 {}
565 
567 void mlndlap_interpadd_rap (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
568  Array4<Real const> const&, Array4<Real const> const&,
569  Array4<int const> const&) noexcept
570 {}
571 
573 void mlndlap_restriction_rap (int /*i*/, int /*j*/, int /*k*/, Array4<Real> const&,
574  Array4<Real const> const&, Array4<Real const> const&,
575  Array4<int const> const&) noexcept
576 {}
577 
579 int mlndlap_color (int i, int, int)
580 {
581  return i%2;
582 }
583 
585 void mlndlap_gscolor_ha (int i, int j, int k, Array4<Real> const& sol,
586  Array4<Real const> const& rhs,
587  Array4<Real const> const& sx,
588  Array4<int const> const& msk,
589  GpuArray<Real,AMREX_SPACEDIM> const& dxinv, int color) noexcept
590 {
591  if (mlndlap_color(i,j,k) == color) {
592  if (msk(i,0,0)) {
593  sol(i,0,0) = Real(0.0);
594  } else {
595  Real fac = dxinv[0]*dxinv[0];
596 
597  Real s0 = Real(-1.0) * fac * (sx(i-1,0,0)+sx(i,0,0));
598  Real Ax = sol(i-1,0,0)*fac*sx(i-1,0,0)
599  + sol(i+1,0,0)*fac*sx(i ,0,0)
600  + sol(i ,0,0)*s0;
601  sol(i,0,0) += (rhs(i,0,0) - Ax) / s0;
602  }
603  }
604 }
605 
607 void mlndlap_gscolor_aa (int i, int j, int k, Array4<Real> const& sol,
608  Array4<Real const> const& rhs,
609  Array4<Real const> const& sx,
610  Array4<int const> const& msk,
611  GpuArray<Real,AMREX_SPACEDIM> const& dxinv, int color) noexcept
612 {
613  mlndlap_gscolor_ha(i,j,k,sol,rhs,sx,msk,dxinv,color);
614 }
615 
617 void mlndlap_gscolor_c (int i, int j, int k, Array4<Real> const& sol,
618  Array4<Real const> const& rhs, Real sig,
619  Array4<int const> const& msk,
620  GpuArray<Real,AMREX_SPACEDIM> const& dxinv, int color) noexcept
621 {
622  if (mlndlap_color(i,j,k) == color) {
623  if (msk(i,0,0)) {
624  sol(i,0,0) = Real(0.0);
625  } else {
626  Real fac = dxinv[0]*dxinv[0];
627 
628  Real s0 = Real(-2.0) * fac * sig;
629  Real Ax = sol(i-1,0,0)*fac*sig
630  + sol(i+1,0,0)*fac*sig
631  + sol(i ,0,0)*s0;
632  sol(i,0,0) += (rhs(i,0,0) - Ax) / s0;
633  }
634  }
635 }
636 
638 void mlndlap_gscolor_sten (int, int, int, Array4<Real> const&,
639  Array4<Real const> const&,
640  Array4<Real const> const&,
641  Array4<int const> const&, int) noexcept
642 {}
643 
644 }
645 
646 #endif
#define AMREX_PRAGMA_SIMD
Definition: AMReX_Extension.H:80
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_HOST_DEVICE_FOR_3D(...)
Definition: AMReX_GpuLaunch.nolint.H:50
#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
Array4< Real > fine
Definition: AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition: AMReX_InterpFaceRegister.cpp:92
AMREX_GPU_HOST_DEVICE bool strictly_contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is strictly contained within BoxND.
Definition: AMReX_Box.H:236
AMREX_GPU_HOST_DEVICE BoxND & growHi(int idir, int n_cell=1) noexcept
Grow the BoxND on the high end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the B...
Definition: AMReX_Box.H:659
AMREX_GPU_HOST_DEVICE BoxND & growLo(int idir, int n_cell=1) noexcept
Grow the BoxND on the low end by n_cell cells in direction idir. NOTE: n_cell negative shrinks the Bo...
Definition: AMReX_Box.H:648
AMREX_GPU_HOST_DEVICE bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition: AMReX_Box.H:204
#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 int crse_cell
Definition: AMReX_MLNodeLap_K.H:56
constexpr int crse_fine_node
Definition: AMReX_MLNodeLap_K.H:59
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_adotx_ha(int i, int, int, Array4< Real const > const &x, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:158
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndlap_gscolor_ha(int i, int j, int k, Array4< Real > const &sol, Array4< Real const > const &rhs, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv, int color) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:585
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
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:354
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_nodal_mask(int i, int, int, Array4< int > const &nmsk, Array4< int const > const &cmsk) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:8
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopConcurrentOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:377
void mlndlap_gauss_seidel_with_line_solve_aa(Box const &, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, GpuArray< Real, AMREX_SPACEDIM > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:331
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndlap_jacobi_ha(int i, int, int, Array4< Real > const &sol, Real Ax, Array4< Real const > const &rhs, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:198
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_semi_avgdown_coeff(int i, int j, int k, Array4< Real > const &crse, Array4< Real const > const &fine, int) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:103
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_rap(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:567
void mlndlap_gauss_seidel_aa(Box const &bx, Array4< Real > const &sol, Array4< Real const > const &rhs, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:299
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_adotx_aa(int i, int j, int k, Array4< Real const > const &x, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:172
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndlap_jacobi_c(int i, int, int, Array4< Real > const &sol, Real Ax, Array4< Real const > const &rhs, Real sig, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:247
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndlap_jacobi_aa(int i, int j, int k, Array4< Real > const &sol, Real Ax, Array4< Real const > const &rhs, Array4< Real const > const &sig, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:231
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition: AMReX_Box.H:1211
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_adotx_sten(int, int, int, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:555
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_c(int i, int, int, Array4< Real > const &fine, Array4< Real const > const &crse, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:392
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_stencil_s0(int, int, int, Array4< Real > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:546
void mlndlap_gauss_seidel_ha(Box const &bx, Array4< Real > const &sol, Array4< Real const > const &rhs, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:276
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_res_cf_contrib(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, Array4< int const > const &, Array4< int const > const &, Array4< Real const > const &, GpuArray< Real, AMREX_SPACEDIM > const &, Box const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, bool) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:516
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_normalize_aa(int i, int j, int k, Array4< Real > const &x, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:190
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_restriction(int i, int, int, Array4< Real > const &crse, Array4< Real const > const &fine, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:340
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_rhcc_fine_contrib(int, int, int, Box const &, Array4< Real > const &, Array4< Real const > const &, Array4< int const > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:491
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_semi_interpadd_aa(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, int) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:429
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_semi_restriction(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< int const > const &, int) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:385
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_stencil(Box const &, Array4< Real > const &, Array4< Real const > const &, GpuArray< Real, AMREX_SPACEDIM > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:540
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_zero_fine(int i, int, int, Array4< Real > const &phi, Array4< int const > const &msk, int fine_flag) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:81
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_adotx_c(int i, int, int, Array4< Real const > const &x, Real sigma, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:143
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_aa(int i, int, int, Array4< Real > const &fine, Array4< Real const > const &crse, Array4< Real const > const &sig, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:410
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_res_cf_contrib_cs(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Real, Array4< int const > const &, Array4< int const > const &, Array4< int const > const &, Array4< Real const > const &, GpuArray< Real, AMREX_SPACEDIM > const &, Box const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, bool) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:528
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_divu(int i, int, int, Array4< Real > const &rhs, Array4< Real const > const &vel, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv, Box const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:443
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_divu_cf_contrib(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, Array4< int const > const &, Array4< int const > const &, GpuArray< Real, AMREX_SPACEDIM > const &, Box const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, bool) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:497
void mlndlap_gauss_seidel_sten(Box const &, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:560
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_gscolor_sten(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &, int) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:638
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndlap_gscolor_aa(int i, int j, int k, Array4< Real > const &sol, Array4< Real const > const &rhs, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv, int color) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:607
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_mknewu(int i, int, int, Array4< Real > const &u, Array4< Real const > const &p, Array4< Real const > const &sig, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:471
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_restriction_rap(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< Real const > const &, Array4< int const > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:573
AMREX_GPU_DEVICE AMREX_FORCE_INLINE void mlndlap_gscolor_c(int i, int j, int k, Array4< Real > const &sol, Array4< Real const > const &rhs, Real sig, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv, int color) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:617
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition: AMReX_Box.H:1304
AMREX_GPU_DEVICE AMREX_FORCE_INLINE int mlndlap_color(int i, int, int)
Definition: AMReX_MLNodeLap_1D_K.H:579
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:221
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_crse_resid(int, int, int, Array4< Real > const &, Array4< Real const > const &, Array4< int const > const &, Box const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &, bool) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:508
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_dirichlet_mask(Box const &bx, Array4< int > const &dmsk, Array4< int const > const &omsk, Box const &dom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bchi) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:24
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_normalize_ha(int i, int, int, Array4< Real > const &x, Array4< Real const > const &sx, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:180
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_avgdown_coeff_x(int i, int, int, Array4< Real > const &crse, Array4< Real const > const &fine) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:94
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_set_dot_mask(Box const &bx, Array4< Real > const &dmsk, Array4< int const > const &omsk, Box const &dom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bchi) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:51
void mlndlap_gauss_seidel_c(Box const &bx, Array4< Real > const &sol, Array4< Real const > const &rhs, Real sig, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:309
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_interpadd_ha(int i, int j, int k, Array4< Real > const &fine, Array4< Real const > const &crse, Array4< Real const > const &sig, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:435
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_stencil_rap(int, int, int, Array4< Real > const &, Array4< Real const > const &) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:550
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_rhcc(int i, int, int, Array4< Real const > const &rhcc, Array4< int const > const &msk) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:458
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_mknewu_c(int i, int, int, Array4< Real > const &u, Array4< Real const > const &p, Real sig, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_1D_K.H:481
Definition: AMReX_Array.H:33