1 #ifndef AMREX_MLNODELAP_2D_K_H_
2 #define AMREX_MLNODELAP_2D_K_H_
3 #include <AMReX_Config.H>
9 Array4<int const>
const& msk,
int fine_flag) noexcept
13 if (msk(i-1,j-1,0) == fine_flag &&
14 msk(i ,j-1,0) == fine_flag &&
15 msk(i-1,j ,0) == fine_flag &&
16 msk(i ,j ,0) == fine_flag)
18 phi(i,j,0) = Real(0.0);
28 Array4<Real const>
const&
fine) noexcept
30 Real a =
fine(2*i ,2*j,k) +
fine(2*i ,2*j+1,k);
31 Real
b =
fine(2*i+1,2*j,k) +
fine(2*i+1,2*j+1,k);
39 Real a =
fine(2*i,2*j ,k) +
fine(2*i+1,2*j ,k);
40 Real
b =
fine(2*i,2*j+1,k) +
fine(2*i+1,2*j+1,k);
46 Array4<Real const>
const&
fine,
int idir) noexcept
49 Real a =
fine(2*i ,j,k);
50 Real b =
fine(2*i+1,j,k);
51 crse(i,j,k) = Real(2.0)*a*b/(a+b);
53 Real a =
fine(i,2*j ,k);
54 Real
b =
fine(i,2*j+1,k);
55 crse(i,j,k) = Real(2.0)*a*
b/(a+
b);
72 Real facx = Real(1./6.)*dxinv[0]*dxinv[0];
73 Real facy = Real(1./6.)*dxinv[1]*dxinv[1];
74 Real y =
x(i-1,j-1,k)*(facx*sx(i-1,j-1,k)+facy*sy(i-1,j-1,k))
75 +
x(i+1,j-1,k)*(facx*sx(i ,j-1,k)+facy*sy(i ,j-1,k))
76 +
x(i-1,j+1,k)*(facx*sx(i-1,j ,k)+facy*sy(i-1,j ,k))
77 +
x(i+1,j+1,k)*(facx*sx(i ,j ,k)+facy*sy(i ,j ,k))
78 +
x(i-1,j,k)*(Real(2.0)*facx*(sx(i-1,j-1,k)+sx(i-1,j,k))
79 - facy*(sy(i-1,j-1,k)+sy(i-1,j,k)))
80 +
x(i+1,j,k)*(Real(2.0)*facx*(sx(i ,j-1,k)+sx(i ,j,k))
81 - facy*(sy(i ,j-1,k)+sy(i ,j,k)))
82 +
x(i,j-1,k)*( -facx*(sx(i-1,j-1,k)+sx(i,j-1,k))
83 +Real(2.0)*facy*(sy(i-1,j-1,k)+sy(i,j-1,k)))
84 +
x(i,j+1,k)*( -facx*(sx(i-1,j ,k)+sx(i,j ,k))
85 +Real(2.0)*facy*(sy(i-1,j ,k)+sy(i,j ,k)))
86 +
x(i,j,k)*(-Real(2.0))*(facx*(sx(i-1,j-1,k)+sx(i,j-1,k)+sx(i-1,j,k)+sx(i,j,k))
87 +facy*(sy(i-1,j-1,k)+sy(i,j-1,k)+sy(i-1,j,k)+sy(i,j,k)));
89 Real fp = facy /
static_cast<Real
>(2*i+1);
90 Real fm = facy /
static_cast<Real
>(2*i-1);
91 y += (fm*sy(i-1,j ,k)-fp*sy(i,j ,k))*(
x(i,j+1,k)-
x(i,j,k))
92 + (fm*sy(i-1,j-1,k)-fp*sy(i,j-1,k))*(
x(i,j-1,k)-
x(i,j,k));
106 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
107 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
108 Real fxy = facx + facy;
109 Real f2xmy = Real(2.0)*facx - facy;
110 Real fmx2y = Real(2.0)*facy - facx;
111 Real y =
x(i-1,j-1,k)*fxy*sig(i-1,j-1,k)
112 +
x(i+1,j-1,k)*fxy*sig(i ,j-1,k)
113 +
x(i-1,j+1,k)*fxy*sig(i-1,j ,k)
114 +
x(i+1,j+1,k)*fxy*sig(i ,j ,k)
115 +
x(i-1,j,k)*f2xmy*(sig(i-1,j-1,k)+sig(i-1,j,k))
116 +
x(i+1,j,k)*f2xmy*(sig(i ,j-1,k)+sig(i ,j,k))
117 +
x(i,j-1,k)*fmx2y*(sig(i-1,j-1,k)+sig(i,j-1,k))
118 +
x(i,j+1,k)*fmx2y*(sig(i-1,j ,k)+sig(i,j ,k))
119 +
x(i,j,k)*(-Real(2.0))*fxy*(sig(i-1,j-1,k)+sig(i,j-1,k)
120 +sig(i-1,j,k)+sig(i,j,k));
122 Real fp = facy /
static_cast<Real
>(2*i+1);
123 Real fm = facy /
static_cast<Real
>(2*i-1);
124 y += (fm*sig(i-1,j ,k)-fp*sig(i,j ,k))*(
x(i,j+1,k)-
x(i,j,k))
125 + (fm*sig(i-1,j-1,k)-fp*sig(i,j-1,k))*(
x(i,j-1,k)-
x(i,j,k));
139 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
140 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
141 Real fxy = facx + facy;
142 Real f2xmy = Real(2.0)*facx - facy;
143 Real fmx2y = Real(2.0)*facy - facx;
144 Real y = (
x(i-1,j-1,k)*fxy
148 +
x(i-1,j,k)*f2xmy*Real(2.)
149 +
x(i+1,j,k)*f2xmy*Real(2.)
150 +
x(i,j-1,k)*fmx2y*Real(2.)
151 +
x(i,j+1,k)*fmx2y*Real(2.)
152 +
x(i,j,k)*(-Real(2.0))*fxy*Real(4.));
154 Real fp = facy /
static_cast<Real
>(2*i+1);
155 Real fm = facy /
static_cast<Real
>(2*i-1);
156 y += ((fm-fp)*(
x(i,j+1,k)-
x(i,j,k))
157 + (fm-fp)*(
x(i,j-1,k)-
x(i,j,k)));
168 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
169 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
172 x(i,j,k) /= (-Real(2.0))*(facx*(sx(i-1,j-1,k)+sx(i,j-1,k)+sx(i-1,j,k)+sx(i,j,k))
173 +facy*(sy(i-1,j-1,k)+sy(i,j-1,k)+sy(i-1,j,k)+sy(i,j,k)));
178 void mlndlap_normalize_aa (
int i,
int j,
int k, Array4<Real>
const& x, Array4<Real const>
const& sig,
179 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
181 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
182 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
183 Real fxy = facx + facy;
186 x(i,j,k) /= (-Real(2.0))*fxy*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k));
196 Real facx = -Real(2.0/6.0)*dxinv[0]*dxinv[0];
197 Real facy = -Real(2.0/6.0)*dxinv[1]*dxinv[1];
200 sol(i,j,k) = Real(0.0);
202 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax)
203 / (facx*(sx(i-1,j-1,k)+sx(i,j-1,k)+sx(i-1,j,k)+sx(i,j,k))
204 + facy*(sy(i-1,j-1,k)+sy(i,j-1,k)+sy(i-1,j,k)+sy(i,j,k)));
214 Real facx = -Real(2.0/6.0)*dxinv[0]*dxinv[0];
215 Real facy = -Real(2.0/6.0)*dxinv[1]*dxinv[1];
220 sol(i,j,k) = Real(0.0);
222 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax(i,j,k))
223 / (facx*(sx(i-1,j-1,k)+sx(i,j-1,k)+sx(i-1,j,k)+sx(i,j,k))
224 + facy*(sy(i-1,j-1,k)+sy(i,j-1,k)+sy(i-1,j,k)+sy(i,j,k)));
231 Array4<Real const>
const& rhs, Array4<Real const>
const& sig,
232 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
234 Real fac = -Real(2.0/6.0)*(dxinv[0]*dxinv[0] + dxinv[1]*dxinv[1]);
237 sol(i,j,k) = Real(0.0);
239 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax)
240 / (fac*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k)));
245 void mlndlap_jacobi_c (
int i,
int j,
int k, Array4<Real>
const& sol, Real Ax,
246 Array4<Real const>
const& rhs, Real sig,
247 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
249 Real fac = -Real(2.0/6.0)*(dxinv[0]*dxinv[0] + dxinv[1]*dxinv[1]);
252 sol(i,j,k) = Real(0.0);
254 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax)
255 / (fac*Real(4.)*sig);
261 Array4<Real const>
const& rhs, Array4<Real const>
const& sig,
262 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
264 Real fac = -Real(2.0/6.0)*(dxinv[0]*dxinv[0] + dxinv[1]*dxinv[1]);
269 sol(i,j,k) = Real(0.0);
271 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax(i,j,k))
272 / (fac*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k)));
278 void mlndlap_jacobi_c (
Box const& bx, Array4<Real>
const& sol, Array4<Real const>
const& Ax,
279 Array4<Real const>
const& rhs, Real sig,
280 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
282 Real fac = -Real(2.0/6.0)*(dxinv[0]*dxinv[0] + dxinv[1]*dxinv[1]);
287 sol(i,j,k) = Real(0.0);
289 sol(i,j,k) += Real(2.0/3.0) * (rhs(i,j,k) - Ax(i,j,k))
290 / (fac*Real(4.)*sig);
302 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
303 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
308 sol(i,j,k) = Real(0.0);
310 Real s0 = Real(-2.0)*(facx*(sx(i-1,j-1,k)+sx(i,j-1,k)+sx(i-1,j,k)+sx(i,j,k))
311 +facy*(sy(i-1,j-1,k)+sy(i,j-1,k)+sy(i-1,j,k)+sy(i,j,k)));
313 Real Ax = sol(i-1,j-1,k)*(facx*sx(i-1,j-1,k)+facy*sy(i-1,j-1,k))
314 + sol(i+1,j-1,k)*(facx*sx(i ,j-1,k)+facy*sy(i ,j-1,k))
315 + sol(i-1,j+1,k)*(facx*sx(i-1,j ,k)+facy*sy(i-1,j ,k))
316 + sol(i+1,j+1,k)*(facx*sx(i ,j ,k)+facy*sy(i ,j ,k))
317 + sol(i-1,j,k)*(Real(2.0)*facx*(sx(i-1,j-1,k)+sx(i-1,j,k))
318 - facy*(sy(i-1,j-1,k)+sy(i-1,j,k)))
319 + sol(i+1,j,k)*(Real(2.0)*facx*(sx(i ,j-1,k)+sx(i ,j,k))
320 - facy*(sy(i ,j-1,k)+sy(i ,j,k)))
321 + sol(i,j-1,k)*( -facx*(sx(i-1,j-1,k)+sx(i,j-1,k))
322 +Real(2.0)*facy*(sy(i-1,j-1,k)+sy(i,j-1,k)))
323 + sol(i,j+1,k)*( -facx*(sx(i-1,j ,k)+sx(i,j ,k))
324 +Real(2.0)*facy*(sy(i-1,j ,k)+sy(i,j ,k)))
328 Real fp = facy /
static_cast<Real
>(2*i+1);
329 Real fm = facy /
static_cast<Real
>(2*i-1);
330 Real frzlo = fm*sy(i-1,j-1,k)-fp*sy(i,j-1,k);
331 Real frzhi = fm*sy(i-1,j ,k)-fp*sy(i,j ,k);
332 s0 += - frzhi - frzlo;
333 Ax += frzhi*(sol(i,j+1,k)-sol(i,j,k))
334 + frzlo*(sol(i,j-1,k)-sol(i,j,k));
337 sol(i,j,k) += (rhs(i,j,k) - Ax) / s0;
349 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
350 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
351 Real fxy = facx + facy;
352 Real f2xmy = Real(2.0)*facx - facy;
353 Real fmx2y = Real(2.0)*facy - facx;
358 sol(i,j,k) = Real(0.0);
360 Real s0 = (-Real(2.0))*fxy*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k));
361 Real Ax = sol(i-1,j-1,k)*fxy*sig(i-1,j-1,k)
362 + sol(i+1,j-1,k)*fxy*sig(i ,j-1,k)
363 + sol(i-1,j+1,k)*fxy*sig(i-1,j ,k)
364 + sol(i+1,j+1,k)*fxy*sig(i ,j ,k)
365 + sol(i-1,j,k)*f2xmy*(sig(i-1,j-1,k)+sig(i-1,j,k))
366 + sol(i+1,j,k)*f2xmy*(sig(i ,j-1,k)+sig(i ,j,k))
367 + sol(i,j-1,k)*fmx2y*(sig(i-1,j-1,k)+sig(i,j-1,k))
368 + sol(i,j+1,k)*fmx2y*(sig(i-1,j ,k)+sig(i,j ,k))
372 Real fp = facy /
static_cast<Real
>(2*i+1);
373 Real fm = facy /
static_cast<Real
>(2*i-1);
374 Real frzlo = fm*sig(i-1,j-1,k)-fp*sig(i,j-1,k);
375 Real frzhi = fm*sig(i-1,j ,k)-fp*sig(i,j ,k);
376 s0 += - frzhi - frzlo;
377 Ax += frzhi*(sol(i,j+1,k)-sol(i,j,k))
378 + frzlo*(sol(i,j-1,k)-sol(i,j,k));
381 sol(i,j,k) += (rhs(i,j,k) - Ax) / s0;
393 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
394 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
395 Real fxy = facx + facy;
396 Real f2xmy = Real(2.0)*facx - facy;
397 Real fmx2y = Real(2.0)*facy - facx;
402 sol(i,j,k) = Real(0.0);
404 Real s0 = (-Real(2.0))*fxy*Real(4.);
405 Real Ax = sol(i-1,j-1,k)*fxy
409 + sol(i-1,j,k)*f2xmy*Real(2.)
410 + sol(i+1,j,k)*f2xmy*Real(2.)
411 + sol(i,j-1,k)*fmx2y*Real(2.)
412 + sol(i,j+1,k)*fmx2y*Real(2.)
416 Real fp = facy /
static_cast<Real
>(2*i+1);
417 Real fm = facy /
static_cast<Real
>(2*i-1);
420 s0 += - frzhi - frzlo;
421 Ax += frzhi*(sol(i,j+1,k)-sol(i,j,k))
422 + frzlo*(sol(i,j-1,k)-sol(i,j,k));
425 sol(i,j,k) += (rhs(i,j,k) - Ax*sig) / (s0*sig);
436 u_ls(0) = r_ls(0) / bet;
438 for (
int i = 1; i <= ilen - 1; i++) {
439 gam(i) = c_ls(i-1) / bet;
440 bet = b_ls(i) - a_ls(i)*gam(i);
442 u_ls(i) = (r_ls(i)-a_ls(i)*u_ls(i-1)) / bet;
444 for (
int i = ilen-2; i >= 0; i--) {
445 u_ls(i) = u_ls(i) - gam(i+1)*u_ls(i+1);
456 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
457 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
458 Real fxy = facx + facy;
459 Real f2xmy = Real(2.0)*facx - facy;
460 Real fmx2y = Real(2.0)*facy - facx;
463 amrex::Abort(
"mlndlap_gauss_seidel_with_line_solve_aa is not implemented in r-z 2D ");
472 if (dxinv[0] <= dxinv[1]) {
474 ilen = hi.y - lo.y + 1;
476 if (dxinv[1] <= dxinv[0]) {
478 ilen = hi.x - lo.x + 1;
482 amrex::Abort(
"mlndlap_gauss_seidel_with_line_solve_aa is hard-wired to be no longer than 32");
488 for (
int i = lo.x; i <= hi.x; ++i)
490 for (
int j = lo.y; j <= hi.y; ++j)
501 Real s0 = (-Real(2.0))*fxy*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k));
503 Real Ax = sol(i-1,j-1,k)*fxy*sig(i-1,j-1,k)
504 + sol(i+1,j-1,k)*fxy*sig(i ,j-1,k)
505 + sol(i-1,j+1,k)*fxy*sig(i-1,j ,k)
506 + sol(i+1,j+1,k)*fxy*sig(i ,j ,k)
507 + sol(i-1,j,k)*f2xmy*(sig(i-1,j-1,k)+sig(i-1,j,k))
508 + sol(i+1,j,k)*f2xmy*(sig(i ,j-1,k)+sig(i ,j,k));
510 a_ls(j-lo.y) = fmx2y*(sig(i-1,j-1,k)+sig(i,j-1,k));
512 c_ls(j-lo.y) = fmx2y*(sig(i-1,j ,k)+sig(i,j ,k));
514 r_ls(j-lo.y) = rhs(i,j,k) - Ax;
519 for (
int j = lo.y; j <= hi.y; ++j)
521 sol(i,j,k) = u_ls(j-lo.y);
524 }
else if (
idir == 0) {
525 for (
int j = lo.y ;j <= hi.y; ++j)
527 for (
int i = lo.x; i <= hi.x; ++i)
538 Real s0 = (-Real(2.0))*fxy*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k));
540 Real Ax = sol(i-1,j-1,k)*fxy*sig(i-1,j-1,k)
541 + sol(i+1,j-1,k)*fxy*sig(i ,j-1,k)
542 + sol(i-1,j+1,k)*fxy*sig(i-1,j ,k)
543 + sol(i+1,j+1,k)*fxy*sig(i ,j ,k)
544 + sol(i,j-1,k)*fmx2y*(sig(i-1,j-1,k)+sig(i,j-1,k))
545 + sol(i,j+1,k)*fmx2y*(sig(i-1,j ,k)+sig(i,j ,k));
547 a_ls(i-lo.x) = f2xmy*(sig(i-1,j-1,k)+sig(i-1,j,k));
549 c_ls(i-lo.x) = f2xmy*(sig(i ,j-1,k)+sig(i ,j,k));
551 r_ls(i-lo.x) = rhs(i,j,k) - Ax;
557 for (
int i = lo.x; i <= hi.x; ++i)
559 sol(i,j,k) = u_ls(i-lo.x);
563 amrex::Abort(
"mlndlap_gauss_seidel_with_line_solve_aa is wrong direction.");
574 int i,
int j,
int ic,
int jc) noexcept
576 Real w1 = sig(i-1,j-1,0) + sig(i-1,j,0);
577 Real w2 = sig(i ,j-1,0) + sig(i ,j,0);
578 return (w1*
crse(ic,jc,0)+w2*
crse(ic+1,jc,0))/(w1+w2);
583 int i,
int j,
int ic,
int jc) noexcept
585 Real w1 = sig(i-1,j-1,0) + sig(i,j-1,0);
586 Real w2 = sig(i-1,j ,0) + sig(i,j ,0);
587 return (w1*
crse(ic,jc,0)+w2*
crse(ic,jc+1,0))/(w1+w2);
592 int i,
int j,
int ic,
int jc) noexcept
594 Real w1 = sig(i-1,j-1,0) + sig(i-1,j,0);
595 Real w2 = sig(i ,j-1,0) + sig(i ,j,0);
596 Real w3 = sig(i-1,j-1,0) + sig(i,j-1,0);
597 Real w4 = sig(i-1,j ,0) + sig(i,j ,0);
606 Array4<Real const>
const&
crse,
607 Array4<int const>
const& msk) noexcept
612 bool i_is_odd = (ic*2 != i);
613 bool j_is_odd = (jc*2 != j);
614 if (i_is_odd && j_is_odd) {
616 fine(i,j,0) += Real(0.25) * (
crse(ic ,jc ,0) +
620 }
else if (i_is_odd) {
622 fine(i,j,0) += Real(0.5) * (
crse(ic,jc,0)+
crse(ic+1,jc,0));
623 }
else if (j_is_odd) {
625 fine(i,j,0) += Real(0.5) * (
crse(ic,jc,0)+
crse(ic,jc+1,0));
635 Array4<Real const>
const&
crse, Array4<Real const>
const& sig,
636 Array4<int const>
const& msk) noexcept
641 bool i_is_odd = (ic*2 != i);
642 bool j_is_odd = (jc*2 != j);
643 if (i_is_odd && j_is_odd) {
646 }
else if (i_is_odd) {
649 }
else if (j_is_odd) {
661 Array4<Real const>
const&
crse, Array4<Real const>
const& sig,
662 Array4<int const>
const& msk,
int idir) noexcept
668 bool i_is_odd = (ic*2 != i);
677 }
else if (
idir == 0 ) {
681 bool j_is_odd = (ic*2 != i);
696 int i,
int j,
int ic,
int jc) noexcept
698 Real w1 = sigx(i-1,j-1,0) + sigx(i-1,j,0);
699 Real w2 = sigx(i ,j-1,0) + sigx(i ,j,0);
700 Real w3 = sigy(i-1,j-1,0) + sigy(i,j-1,0);
701 Real w4 = sigy(i-1,j ,0) + sigy(i,j ,0);
717 bool i_is_odd = (ic*2 != i);
718 bool j_is_odd = (jc*2 != j);
719 if (i_is_odd && j_is_odd) {
722 }
else if (i_is_odd) {
725 }
else if (j_is_odd) {
742 Box const& nodal_domain,
747 Real facx = Real(0.5)*dxinv[0];
748 Real facy = Real(0.5)*dxinv[1];
754 rhs(i,j,k) = Real(0.0);
757 Real zero_ilo = Real(1.0);
758 Real zero_ihi = Real(1.0);
759 Real zero_jlo = Real(1.0);
760 Real zero_jhi = Real(1.0);
764 if ((bclo[0] == LinOpBCType::Neumann || bclo[0] == LinOpBCType::inflow)
767 zero_ilo = Real(0.0);
769 if ((bchi[0] == LinOpBCType::Neumann || bchi[0] == LinOpBCType::inflow)
772 zero_ihi = Real(0.0);
774 if ((bclo[1] == LinOpBCType::Neumann || bclo[1] == LinOpBCType::inflow)
777 zero_jlo = Real(0.0);
779 if ((bchi[1] == LinOpBCType::Neumann || bchi[1] == LinOpBCType::inflow)
782 zero_jhi = Real(0.0);
785 rhs(i,j,k) = facx*(-vel(i-1,j-1,k,0)*zero_jlo + vel(i,j-1,k,0)*zero_jlo
786 -vel(i-1,j ,k,0)*zero_jhi + vel(i,j ,k,0)*zero_jhi)
787 + facy*(-vel(i-1,j-1,k,1)*zero_ilo - vel(i,j-1,k,1)*zero_ihi
788 +vel(i-1,j ,k,1)*zero_ilo + vel(i,j ,k,1)*zero_ihi);
791 Real fm = facy /
static_cast<Real
>(6*i-3);
792 Real fp = facy /
static_cast<Real
>(6*i+3);
793 rhs(i,j,k) += fm*(vel(i-1,j,k,1)-vel(i-1,j-1,k,1))
794 - fp*(vel(i ,j,k,1)-vel(i ,j-1,k,1));
800 Real
mlndlap_rhcc (
int i,
int j,
int k, Array4<Real const>
const& rhcc,
801 Array4<int const>
const& msk) noexcept
807 r = Real(0.25) * (rhcc(i-1,j-1,k)+rhcc(i,j-1,k)+rhcc(i-1,j,k)+rhcc(i,j,k));
817 Real facx = Real(0.5)*dxinv[0];
818 Real facy = Real(0.5)*dxinv[1];
819 u(i,j,k,0) -= sig(i,j,k)*facx*(-p(i,j,k)+p(i+1,j,k)-p(i,j+1,k)+p(i+1,j+1,k));
820 u(i,j,k,1) -= sig(i,j,k)*facy*(-p(i,j,k)-p(i+1,j,k)+p(i,j+1,k)+p(i+1,j+1,k));
822 Real frz = sig(i,j,k)*facy /
static_cast<Real
>(6*i+3);
823 u(i,j,k,1) += frz*(p(i,j,k)-p(i+1,j,k)-p(i,j+1,k)+p(i+1,j+1,k));
832 Real facx = Real(0.5)*dxinv[0];
833 Real facy = Real(0.5)*dxinv[1];
834 u(i,j,k,0) -= sig*facx*(-p(i,j,k)+p(i+1,j,k)-p(i,j+1,k)+p(i+1,j+1,k));
835 u(i,j,k,1) -= sig*facy*(-p(i,j,k)-p(i+1,j,k)+p(i,j+1,k)+p(i+1,j+1,k));
837 Real frz = sig*facy /
static_cast<Real
>(6*i+3);
838 u(i,j,k,1) += frz*(p(i,j,k)-p(i+1,j,k)-p(i,j+1,k)+p(i+1,j+1,k));
846 Real fm = is_rz ? facy /
static_cast<Real
>(6*ii-3) : Real(0.0);
847 Real fp = is_rz ? facy /
static_cast<Real
>(6*ii+3) : Real(0.0);
850 if (velbx.contains(ii-1,jj-1,0)) {
851 Df += -facx*vel(ii-1,jj-1,0,0) - (facy+fm)*vel(ii-1,jj-1,0,1);
853 if (velbx.contains(ii,jj-1,0)) {
854 Df += facx*vel(ii,jj-1,0,0) - (facy-fp)*vel(ii,jj-1,0,1);
856 if (velbx.contains(ii-1,jj,0)) {
857 Df += -facx*vel(ii-1,jj,0,0) + (facy+fm)*vel(ii-1,jj,0,1);
859 if (velbx.contains(ii,jj,0)) {
860 Df += facx*vel(ii,jj,0,0) + (facy-fp)*vel(ii,jj,0,1);
875 const Real facx = Real(0.5)*dxinv[0];
876 const Real facy = Real(0.5)*dxinv[1];
880 const int ilo =
amrex::max(ii-rr+1, fvbx.smallEnd(0));
881 const int ihi =
amrex::min(ii+rr-1, fvbx.bigEnd (0));
882 const int jlo =
amrex::max(jj-rr+1, fvbx.smallEnd(1));
883 const int jhi =
amrex::min(jj+rr-1, fvbx.bigEnd (1));
885 for (
int joff = jlo; joff <= jhi; ++joff) {
886 for (
int ioff = ilo; ioff <= ihi; ++ioff) {
889 if (fvbx.strictly_contains(ioff,joff,0)) {
890 Df +=
scale * frhs(ioff,joff,0);
896 rhs(i,j,0) = Df * (Real(1.0)/
static_cast<Real
>(rr*rr*rr*rr));
898 rhs(i,j,0) = Real(0.0);
905 Array4<Real>
const& rhs, Array4<Real const>
const& cc,
906 Array4<int const>
const& msk) noexcept
911 Real tmp = Real(0.0);
913 const int ilo =
amrex::max(ii-rr , ccbx.smallEnd(0));
914 const int ihi =
amrex::min(ii+rr-1, ccbx.bigEnd (0));
915 const int jlo =
amrex::max(jj-rr , ccbx.smallEnd(1));
916 const int jhi =
amrex::min(jj+rr-1, ccbx.bigEnd (1));
918 for (
int joff = jlo; joff <= jhi; ++joff) {
919 for (
int ioff = ilo; ioff <= ihi; ++ioff) {
920 Real
scale = (
static_cast<Real
>(rr)-
std::abs(
static_cast<Real
>(ioff-ii)+Real(0.5)))
921 * (
static_cast<Real
>(rr)-
std::abs(
static_cast<Real
>(joff-jj)+Real(0.5)));
922 tmp += cc(ioff,joff,0) *
scale;
925 rhs(i,j,0) += tmp * (Real(1.0)/Real(rr*rr*rr*rr));
934 Real val = Real(1.0);
939 if ((i == ndlo.x && ( bclo[0] == LinOpBCType::Neumann ||
940 bclo[0] == LinOpBCType::inflow)) ||
941 (i == ndhi.x && ( bchi[0] == LinOpBCType::Neumann ||
942 bchi[0] == LinOpBCType::inflow))) {
946 if ((j == ndlo.y && ( bclo[1] == LinOpBCType::Neumann ||
947 bclo[1] == LinOpBCType::inflow)) ||
948 (j == ndhi.y && ( bchi[1] == LinOpBCType::Neumann ||
949 bchi[1] == LinOpBCType::inflow))) {
962 Box const& ccdom_p,
Box const& veldom,
Box const& nddom,
966 using namespace nodelap_detail;
969 Real facx = Real(0.5) * dxinv[0];
970 Real facy = Real(0.5) * dxinv[1];
971 Real tmp = fc(i,j,0);
973 Real fm = is_rz ? facy /
static_cast<Real
>(6*i-3) : Real(0.0);
974 Real fp = is_rz ? facy /
static_cast<Real
>(6*i+3) : Real(0.0);
979 if (ccmsk(i-1,j-1,0) ==
crse_cell && veldom.contains(i-1,j-1,0)) {
980 tmp += -facx*vel(i-1,j-1,0,0) - (facy+fm)*vel(i-1,j-1,0,1);
981 if (rhcc && ccdom_p.contains(i-1,j-1,0)) {
982 tmp += Real(0.25) * rhcc(i-1,j-1,0);
986 if (ccmsk(i,j-1,0) ==
crse_cell && veldom.contains(i,j-1,0)) {
987 tmp += facx*vel(i,j-1,0,0) - (facy-fp)*vel(i,j-1,0,1);
988 if (rhcc && ccdom_p.contains(i,j-1,0)) {
989 tmp += Real(0.25) * rhcc(i,j-1,0);
993 if (ccmsk(i-1,j,0) ==
crse_cell && veldom.contains(i-1,j,0)) {
994 tmp += -facx*vel(i-1,j,0,0) + (facy+fm)*vel(i-1,j,0,1);
995 if (rhcc && ccdom_p.contains(i-1,j,0)) {
996 tmp += Real(0.25) * rhcc(i-1,j,0);
1000 if (ccmsk(i,j,0) ==
crse_cell && veldom.contains(i,j,0)) {
1001 tmp += facx*vel(i,j,0,0) + (facy-fp)*vel(i,j,0,1);
1002 if (rhcc && ccdom_p.contains(i,j,0)) {
1003 tmp += Real(0.25) * rhcc(i,j,0);
1017 Array4<Real const>
const& rhs, Array4<int const>
const& msk,
1018 Box const& nddom, GpuArray<LinOpBCType,AMREX_SPACEDIM>
const& bclo,
1019 GpuArray<LinOpBCType,AMREX_SPACEDIM>
const& bchi,
1020 bool neumann_doubling) noexcept
1022 if ( msk(i-1,j-1,k ) == 0 ||
1023 msk(i ,j-1,k ) == 0 ||
1024 msk(i-1,j ,k ) == 0 ||
1025 msk(i ,j ,k ) == 0 )
1027 Real fac = Real(1.0);
1028 if (neumann_doubling) {
1031 if ((i == ndlo.x && ( bclo[0] == LinOpBCType::Neumann ||
1032 bclo[0] == LinOpBCType::inflow)) ||
1033 (i == ndhi.x && ( bchi[0] == LinOpBCType::Neumann ||
1034 bchi[0] == LinOpBCType::inflow))) {
1037 if ((j == ndlo.y && ( bclo[1] == LinOpBCType::Neumann ||
1038 bclo[1] == LinOpBCType::inflow)) ||
1039 (j == ndhi.y && ( bchi[1] == LinOpBCType::Neumann ||
1040 bchi[1] == LinOpBCType::inflow))) {
1045 resid(i,j,k) = (rhs(i,j,k) - resid(i,j,k)) * fac;
1047 resid(i,j,k) = Real(0.);
1055 template <
typename P,
typename S>
1060 Real Ax = Real(0.0);
1061 Real fp = Real(0.0), fm = Real(0.0);
1063 fp = facy /
static_cast<Real
>(2*i+1);
1064 fm = facy /
static_cast<Real
>(2*i-1);
1066 if (pred(i-1,j-1)) {
1067 Ax += sig(i-1,j-1,0)*(facx*(Real(2.)*(phi(i-1,j ,0)-phi(i ,j ,0))
1068 + (phi(i-1,j-1,0)-phi(i ,j-1,0)))
1069 + facy*(Real(2.)*(phi(i ,j-1,0)-phi(i ,j ,0))
1070 + (phi(i-1,j-1,0)-phi(i-1,j ,0)))
1071 + fm * (phi(i ,j-1,0)-phi(i ,j ,0)));
1074 Ax += sig(i,j-1,0)*(facx*(Real(2.)*(phi(i+1,j ,0)-phi(i ,j ,0))
1075 + (phi(i+1,j-1,0)-phi(i ,j-1,0)))
1076 + facy*(Real(2.)*(phi(i ,j-1,0)-phi(i ,j ,0))
1077 + (phi(i+1,j-1,0)-phi(i+1,j ,0)))
1078 - fp * (phi(i ,j-1,0)-phi(i ,j ,0)));
1081 Ax += sig(i-1,j,0)*(facx*(Real(2.)*(phi(i-1,j ,0)-phi(i ,j ,0))
1082 + (phi(i-1,j+1,0)-phi(i ,j+1,0)))
1083 + facy*(Real(2.)*(phi(i ,j+1,0)-phi(i ,j ,0))
1084 + (phi(i-1,j+1,0)-phi(i-1,j ,0)))
1085 + fm * (phi(i ,j+1,0)-phi(i ,j ,0)));
1088 Ax += sig(i,j,0)*(facx*(Real(2.)*(phi(i+1,j ,0)-phi(i ,j ,0))
1089 + (phi(i+1,j+1,0)-phi(i ,j+1,0)))
1090 + facy*(Real(2.)*(phi(i ,j+1,0)-phi(i ,j ,0))
1091 + (phi(i+1,j+1,0)-phi(i+1,j ,0)))
1092 - fp * (phi(i ,j+1,0)-phi(i ,j ,0)));
1097 template <
int rr,
typename S>
1106 const int ii = rr*i;
1107 const int jj = rr*j;
1109 Real facx = Real(1./6.)*dxinv[0]*dxinv[0];
1110 Real facy = Real(1./6.)*dxinv[1]*dxinv[1];
1112 auto is_fine = [&ccbx] (
int ix,
int iy) ->
bool {
1113 return ccbx.contains(
ix,
iy,0);
1116 Real Df = Real(0.0);
1118 const int ilo =
amrex::max(ii-rr+1, ndbx.smallEnd(0));
1119 const int ihi =
amrex::min(ii+rr-1, ndbx.bigEnd (0));
1120 const int jlo =
amrex::max(jj-rr+1, ndbx.smallEnd(1));
1121 const int jhi =
amrex::min(jj+rr-1, ndbx.bigEnd (1));
1123 for (
int joff = jlo; joff <= jhi; ++joff) {
1124 for (
int ioff = ilo; ioff <= ihi; ++ioff) {
1127 if (ndbx.strictly_contains(ioff,joff,0)) {
1128 Df +=
scale * (rhs(ioff,joff,0)-res(ioff,joff,0));
1131 (is_fine, sig, ioff, joff, facx, facy, phi, is_rz);
1135 f(i,j,0) = Df * (Real(1.0)/
static_cast<Real
>(rr*rr*rr*rr));
1137 f(i,j,0) = Real(0.0);
1150 mlndlap_Ax_fine_contrib_doit<rr>
1151 ([&sig] (
int ix,
int iy,
int) -> Real
const& {
return sig(
ix,
iy,0); },
1152 i,j,ndbx,ccbx,
f,res,rhs,phi,msk,is_rz,dxinv);
1164 mlndlap_Ax_fine_contrib_doit<rr>
1165 ([=] (
int,
int,
int) -> Real {
return sig; },
1166 i,j,ndbx,ccbx,
f,res,rhs,phi,msk,is_rz,dxinv);
1176 Box const& ccdom_p,
Box const& nddom,
1180 bool neumann_doubling) noexcept
1182 using namespace nodelap_detail;
1185 Real facx = Real(1./6.)*dxinv[0]*dxinv[0];
1186 Real facy = Real(1./6.)*dxinv[1]*dxinv[1];
1190 return ccdom_p.contains(
ix,
iy,0)
1193 [&sig] (
int ix,
int iy,
int) -> Real
const&
1195 return sig(
ix,
iy,0);
1197 i, j, facx, facy, phi, is_rz);
1199 Real
const ns = (neumann_doubling) ?
neumann_scale(i,j,nddom,bclo,bchi) : Real(1.0);
1200 res(i,j,0) = rhs(i,j,0) - Ax*ns;
1211 Box const& ccdom_p,
Box const& nddom,
1215 bool neumann_doubling) noexcept
1217 using namespace nodelap_detail;
1220 Real facx = Real(1./6.)*dxinv[0]*dxinv[0];
1221 Real facy = Real(1./6.)*dxinv[1]*dxinv[1];
1225 return ccdom_p.contains(
ix,
iy,0)
1232 i, j, facx, facy, phi, is_rz);
1234 Real
const ns = (neumann_doubling) ?
neumann_scale(i,j,nddom,bclo,bchi) : Real(1.0);
1235 res(i,j,0) = rhs(i,j,0) - Ax*ns;
1245 Array4<Real const>
const& sigma,
1246 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
1248 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
1249 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
1250 Real fxy = facx + facy;
1251 Real f2xmy = Real(2.0)*facx - facy;
1252 Real fmx2y = Real(2.0)*facy - facx;
1256 sten(i,j,k,1) = f2xmy*(sigma(i,j-1,k)+sigma(i,j,k));
1257 sten(i,j,k,2) = fmx2y*(sigma(i-1,j,k)+sigma(i,j,k));
1258 sten(i,j,k,3) = fxy*sigma(i,j,k);
1265 using namespace nodelap_detail;
1267 sten(i,j,k,0) = -(sten(i-1,j ,k,1) + sten(i ,j ,k,1)
1268 + sten(i ,j-1,k,2) + sten(i ,j ,k,2)
1269 + sten(i-1,j-1,k,3) + sten(i ,j-1,k,3)
1270 + sten(i-1,j ,k,3) + sten(i ,j ,k,3));
1271 sten(i,j,k,4) = Real(1.0) / (
std::abs(sten(i-1,j ,k,1)) +
std::abs(sten(i,j ,k,1))
1279 Array4<Real const>
const& fsten) noexcept
1281 using namespace nodelap_detail;
1283 constexpr
int k = 0;
1286 auto interp_from_mm_to = [&fsten] (
int i_,
int j_) -> Real {
1289 Real wmm =
std::abs(fsten(i_-1,j_-1,0,3)) * (Real(1.) + wxm + wym);
1290 return wmm * fsten(i_,j_,0,4);
1294 auto interp_from_mp_to = [&fsten] (
int i_,
int j_) -> Real {
1297 Real wmp =
std::abs(fsten(i_-1,j_ ,0,3)) *(Real(1.) + wxm + wyp);
1298 return wmp * fsten(i_,j_,0,4);
1301 auto interp_from_pm_to = [&fsten] (
int i_,
int j_) -> Real {
1304 Real wpm =
std::abs(fsten(i_ ,j_-1,0,3)) * (Real(1.) + wxp + wym);
1305 return wpm * fsten(i_,j_,0,4);
1308 auto interp_from_pp_to = [&fsten] (
int i_,
int j_) -> Real {
1311 Real wpp =
std::abs(fsten(i_ ,j_ ,0,3)) * (Real(1.) + wxp + wyp);
1312 return wpp * fsten(i_,j_,0,4);
1315 auto interp_from_m0_to = [&fsten] (
int i_,
int j_) -> Real {
1319 auto interp_from_p0_to = [&fsten] (
int i_,
int j_) -> Real {
1323 auto interp_from_0m_to = [&fsten] (
int i_,
int j_) -> Real {
1327 auto interp_from_0p_to = [&fsten] (
int i_,
int j_) -> Real {
1332 auto Amm = [&fsten] (
int i_,
int j_) -> Real {
1333 return fsten(i_-1,j_-1,0,3);
1337 auto A0m = [&fsten] (
int i_,
int j_) -> Real {
1338 return fsten(i_,j_-1,0,2);
1341 auto Apm = [&fsten] (
int i_,
int j_) -> Real {
1342 return fsten(i_,j_-1,0,3);
1345 auto Am0 = [&fsten] (
int i_,
int j_) -> Real {
1346 return fsten(i_-1,j_,0,1);
1349 auto A00 = [&fsten] (
int i_,
int j_) -> Real {
1350 return fsten(i_,j_,0,0);
1353 auto Ap0 = [&fsten] (
int i_,
int j_) -> Real {
1354 return fsten(i_,j_,0,1);
1357 auto Amp = [&fsten] (
int i_,
int j_) -> Real {
1358 return fsten(i_-1,j_,0,3);
1361 auto A0p = [&fsten] (
int i_,
int j_) -> Real {
1362 return fsten(i_,j_,0,2);
1365 auto App = [&fsten] (
int i_,
int j_) -> Real {
1366 return fsten(i_,j_,0,3);
1370 auto restrict_from_mm_to = [&fsten] (
int ii_,
int jj_) -> Real {
1373 Real wpp =
std::abs(fsten(ii_-1,jj_-1,0,3))*(Real(1.)+wxp+wyp);
1374 return wpp * fsten(ii_-1,jj_-1,0,4);
1378 auto restrict_from_0m_to = [&fsten] (
int ii_,
int jj_) -> Real {
1382 auto restrict_from_pm_to = [&fsten] (
int ii_,
int jj_) -> Real {
1385 Real wmp =
std::abs(fsten(ii_ ,jj_-1,0,3)) *(Real(1.) + wxm + wyp);
1386 return wmp * fsten(ii_+1,jj_-1,0,4);
1389 auto restrict_from_m0_to = [&fsten] (
int ii_,
int jj_) -> Real {
1393 auto restrict_from_p0_to = [&fsten] (
int ii_,
int jj_) -> Real {
1397 auto restrict_from_mp_to = [&fsten] (
int ii_,
int jj_) -> Real {
1400 Real wpm =
std::abs(fsten(ii_-1,jj_ ,0,3)) * (Real(1.) + wxp + wym);
1401 return wpm * fsten(ii_-1,jj_+1,0,4);
1404 auto restrict_from_0p_to = [&fsten] (
int ii_,
int jj_) -> Real {
1408 auto restrict_from_pp_to = [&fsten] (
int ii_,
int jj_) -> Real {
1411 Real wmm =
std::abs(fsten(ii_ ,jj_ ,0,3)) * (Real(1.) + wxm + wym);
1412 return wmm * fsten(ii_+1,jj_+1,0,4);
1417 Array2D<Real,-1,1,-1,1> ap, p;
1420 p(-1,-1) = interp_from_pp_to(ii+1,jj-1);
1421 p( 0,-1) = interp_from_0p_to(ii+2,jj-1);
1422 p(-1, 0) = interp_from_p0_to(ii+1,jj );
1423 p( 0, 0) = Real(1.);
1424 p(-1, 1) = interp_from_pm_to(ii+1,jj+1);
1425 p( 0, 1) = interp_from_0m_to(ii+2,jj+1);
1427 ap(0,-1) = Ap0(ii,jj-1)*p(-1,-1) + App(ii,jj-1)*p(-1,0);
1428 ap(1,-1) = A00(ii+1,jj-1)*p(-1,-1) + Ap0(ii+1,jj-1)*p(0,-1)
1429 + A0p(ii+1,jj-1)*p(-1,0) + App(ii+1,jj-1)*p(0,0);
1430 ap(0,0) = Apm(ii,jj)*p(-1,-1) + Ap0(ii,jj)*p(-1,0) + App(ii,jj)*p(-1,1);
1431 ap(1,0) = A0m(ii+1,jj)*p(-1,-1) + Apm(ii+1,jj)*p(0,-1)
1432 + A00(ii+1,jj)*p(-1,0) + Ap0(ii+1,jj)*p(0,0)
1433 + A0p(ii+1,jj)*p(-1,1) + App(ii+1,jj)*p(0,1);
1434 ap(0,1) = Apm(ii,jj+1)*p(-1,0) + Ap0(ii,jj+1)*p(-1,1);
1435 ap(1,1) = A0m(ii+1,jj+1)*p(-1,0) + Apm(ii+1,jj+1)*p(0,0)
1436 + A00(ii+1,jj+1)*p(-1,1) + Ap0(ii+1,jj+1)*p(0,1);
1438 csten(i,j,k,1) = Real(0.25)*(restrict_from_0m_to(ii,jj)*ap(0,-1)
1439 + restrict_from_pm_to(ii,jj)*ap(1,-1)
1441 + restrict_from_p0_to(ii,jj)*ap(1,0)
1442 + restrict_from_0p_to(ii,jj)*ap(0,1)
1443 + restrict_from_pp_to(ii,jj)*ap(1,1));
1446 p(-1,-1) = interp_from_pp_to(ii-1,jj+1);
1447 p( 0,-1) = interp_from_0p_to(ii ,jj+1);
1448 p( 1,-1) = interp_from_mp_to(ii+1,jj+1);
1449 p(-1, 0) = interp_from_p0_to(ii-1,jj+2);
1450 p( 0, 0) = Real(1.);
1451 p( 1, 0) = interp_from_m0_to(ii+1,jj+2);
1453 ap(-1,0) = A0p(ii-1,jj)*p(-1,-1) + App(ii-1,jj)*p(0,-1);
1454 ap(0,0) = Amp(ii,jj)*p(-1,-1) + A0p(ii,jj)*p(0,-1) + App(ii,jj)*p(1,-1);
1455 ap(1,0) = Amp(ii+1,jj)*p(0,-1) + A0p(ii+1,jj)*p(1,-1);
1456 ap(-1,1) = A00(ii-1,jj+1)*p(-1,-1) + Ap0(ii-1,jj+1)*p(0,-1)
1457 + A0p(ii-1,jj+1)*p(-1,0) + App(ii-1,jj+1)*p(0,0);
1458 ap(0,1) = Am0(ii,jj+1)*p(-1,-1) + A00(ii,jj+1)*p(0,-1) + Ap0(ii,jj+1)*p(1,-1)
1459 + Amp(ii,jj+1)*p(-1,0) + A0p(ii,jj+1)*p(0,0) + App(ii,jj+1)*p(1,0);
1460 ap(1,1) = Am0(ii+1,jj+1)*p(0,-1) + A00(ii+1,jj+1)*p(1,-1)
1461 + Amp(ii+1,jj+1)*p(0,0) + A0p(ii+1,jj+1)*p(1,0);
1463 csten(i,j,k,2) = Real(0.25)*(restrict_from_m0_to(ii,jj)*ap(-1,0)
1465 + restrict_from_p0_to(ii,jj)*ap(1,0)
1466 + restrict_from_mp_to(ii,jj)*ap(-1,1)
1467 + restrict_from_0p_to(ii,jj)*ap(0,1)
1468 + restrict_from_pp_to(ii,jj)*ap(1,1));
1471 p(-1,-1) = interp_from_pp_to(ii+1,jj+1);
1472 p( 0,-1) = interp_from_0p_to(ii+2,jj+1);
1473 p(-1, 0) = interp_from_p0_to(ii+1,jj+2);
1474 p( 0, 0) = Real(1.);
1476 ap(0,0) = App(ii,jj)*p(-1,-1);
1477 ap(1,0) = A0p(ii+1,jj)*p(-1,-1) + App(ii+1,jj)*p(0,-1);
1478 ap(0,1) = Ap0(ii,jj+1)*p(-1,-1) + App(ii,jj+1)*p(-1,0);
1479 ap(1,1) = A00(ii+1,jj+1)*p(-1,-1) + Ap0(ii+1,jj+1)*p(0,-1)
1480 + A0p(ii+1,jj+1)*p(-1,0) + App(ii+1,jj+1)*p(0,0);
1482 Real cross1 = Real(0.25)*(ap(0,0)
1483 + restrict_from_p0_to(ii,jj)*ap(1,0)
1484 + restrict_from_0p_to(ii,jj)*ap(0,1)
1485 + restrict_from_pp_to(ii,jj)*ap(1,1));
1487 p(0,-1) = interp_from_0p_to(ii,jj+1);
1488 p(1,-1) = interp_from_mp_to(ii+1,jj+1);
1490 p(1, 0) = interp_from_m0_to(ii+1,jj+2);
1492 ap(-1,0) = Amp(ii+1,jj)*p(0,-1) + A0p(ii+1,jj)*p(1,-1);
1493 ap( 0,0) = Amp(ii+2,jj)*p(1,-1);
1494 ap(-1,1) = Am0(ii+1,jj+1)*p(0,-1) + A00(ii+1,jj+1)*p(1,-1) + Amp(ii+1,jj+1)*p(0,0)
1495 + A0p(ii+1,jj+1)*p(1,0);
1496 ap( 0,1) = Am0(ii+2,jj+1)*p(1,-1) + Amp(ii+2,jj+1)*p(1,0);
1498 Real cross2 = Real(0.25)*(ap(0,0)
1499 + restrict_from_m0_to(ii+2,jj)*ap(-1,0)
1500 + restrict_from_mp_to(ii+2,jj)*ap(-1,1)
1501 + restrict_from_0p_to(ii+2,jj)*ap( 0,1));
1503 csten(i,j,k,3) = Real(0.5)*(cross1+cross2);
1510 return x(i-1,j-1,k)*sten(i-1,j-1,k,3)
1511 +
x(i ,j-1,k)*sten(i ,j-1,k,2)
1512 +
x(i+1,j-1,k)*sten(i ,j-1,k,3)
1513 +
x(i-1,j ,k)*sten(i-1,j ,k,1)
1514 +
x(i ,j ,k)*sten(i ,j ,k,0)
1515 +
x(i+1,j ,k)*sten(i ,j ,k,1)
1516 +
x(i-1,j+1,k)*sten(i-1,j ,k,3)
1517 +
x(i ,j+1,k)*sten(i ,j ,k,2)
1518 +
x(i+1,j+1,k)*sten(i ,j ,k,3);
1523 Array4<Real const>
const& sten, Array4<int const>
const& msk) noexcept
1539 sol(i,j,k) = Real(0.0);
1540 }
else if (sten(i,j,k,0) != Real(0.0)) {
1542 sol(i,j,k) += (rhs(i,j,k) - Ax) / sten(i,j,k,0);
1548 Array4<Real const>
const& rhs,
1549 Array4<Real const>
const& sten,
1550 Array4<int const>
const& msk) noexcept
1560 Array4<Real const>
const&
crse, Array4<Real const>
const& sten,
1561 Array4<int const>
const& msk) noexcept
1563 using namespace nodelap_detail;
1565 if (!msk(i,j,0) && sten(i,j,0,0) != Real(0.0)) {
1568 bool ieven = ic*2 == i;
1569 bool jeven = jc*2 == j;
1571 if (ieven && jeven) {
1574 Real wym =
std::abs(sten(i,j-1,0,2));
1575 Real wyp =
std::abs(sten(i,j ,0,2));
1576 fv = (wym*
crse(ic,jc,0) + wyp*
crse(ic,jc+1,0)) / (wym+wyp+
eps);
1578 Real wxm =
std::abs(sten(i-1,j,0,1));
1579 Real wxp =
std::abs(sten(i ,j,0,1));
1580 fv = (wxm*
crse(ic,jc,0) + wxp*
crse(ic+1,jc,0)) / (wxm+wxp+
eps);
1582 Real wxm =
std::abs(sten(i-1,j ,0,1)) /
1584 Real wxp =
std::abs(sten(i ,j ,0,1)) /
1586 Real wym =
std::abs(sten(i ,j-1,0,2)) /
1588 Real wyp =
std::abs(sten(i ,j ,0,2)) /
1590 Real wmm =
std::abs(sten(i-1,j-1,0,3)) * (Real(1.0) + wxm + wym);
1591 Real wpm =
std::abs(sten(i,j-1,0,3)) * (Real(1.0) + wxp + wym);
1592 Real wmp =
std::abs(sten(i-1,j,0,3)) *(Real(1.0) + wxm + wyp);
1593 Real wpp =
std::abs(sten(i,j,0,3)) * (Real(1.0) + wxp + wyp);
1594 fv = (wmm*
crse(ic,jc,0) + wpm*
crse(ic+1,jc,0)
1595 + wmp*
crse(ic,jc+1,0) + wpp*
crse(ic+1,jc+1,0))
1596 / (wmm+wpm+wmp+wpp+
eps);
1605 Array4<Real const>
const&
fine, Array4<Real const>
const& sten,
1606 Array4<int const>
const& msk) noexcept
1608 using namespace nodelap_detail;
1613 crse(i,j,0) = Real(0.0);
1616 Real cv =
fine(ii,jj,0)
1630 Real wxp =
std::abs(sten(ii-1,jj-1,0,1))
1633 Real wyp =
std::abs(sten(ii-1,jj-1,0,2))
1636 Real wpp =
std::abs(sten(ii-1,jj-1,0,3))*(Real(1.0) + wxp + wyp);
1637 cv += wpp*sten(ii-1,jj-1,0,4)*
fine(ii-1,jj-1,0);
1639 Real wxm =
std::abs(sten(ii ,jj-1,0,1))
1642 wyp =
std::abs(sten(ii+1,jj-1,0,2))
1645 Real wmp =
std::abs(sten(ii ,jj-1,0,3))*(Real(1.0) + wxm + wyp);
1646 cv += wmp*sten(ii+1,jj-1,0,4)*
fine(ii+1,jj-1,0);
1648 wxp =
std::abs(sten(ii-1,jj+1,0,1))
1651 Real wym =
std::abs(sten(ii-1,jj ,0,2))
1654 Real wpm =
std::abs(sten(ii-1,jj ,0,3)) * (Real(1.0) + wxp + wym);
1655 cv += wpm*sten(ii-1,jj+1,0,4)*
fine(ii-1,jj+1,0);
1663 Real wmm =
std::abs(sten(ii ,jj ,0,3)) * (Real(1.0) + wxm + wym);
1664 cv += wmm*sten(ii+1,jj+1,0,4)*
fine(ii+1,jj+1,0);
1666 crse(i,j,0) = cv * Real(0.25);
1672 namespace nodelap_detail {
1673 constexpr
int i_S_x = 0;
1674 constexpr
int i_S_y = 1;
1675 constexpr
int i_S_x2 = 2;
1676 constexpr
int i_S_y2 = 3;
1677 constexpr
int i_S_xy = 4;
1678 constexpr
int n_Sintg = 5;
1680 constexpr
int i_B_x = 0;
1681 constexpr
int i_B_y = 1;
1682 constexpr
int i_B_xy = 2;
1683 constexpr
int n_Bintg = 3;
1687 void mlndlap_set_connection (
int i,
int j,
int, Array4<Real>
const& conn,
1688 Array4<Real const>
const& intg, Array4<Real const>
const& vol,
1689 Array4<EBCellFlag const>
const& flag) noexcept
1691 using namespace nodelap_detail;
1693 if (flag(i,j,0).isCovered()) {
1694 for (
int n = 0; n < 6; ++n) { conn(i,j,0,n) = Real(0.); }
1695 }
else if (flag(i,j,0).isRegular() || vol(i,j,0) >=
almostone) {
1696 for (
int n = 0; n < 6; ++n) { conn(i,j,0,n) = Real(1.); }
1700 conn(i,j,0,0) = Real(3.)*(Real(0.25)*vol(i,j,0) + intg(i,j,0,
i_S_y2) - intg(i,j,0,
i_S_y));
1701 conn(i,j,0,1) = Real(6.)*(Real(0.25)*vol(i,j,0) - intg(i,j,0,
i_S_y2));
1702 conn(i,j,0,2) = Real(3.)*(Real(0.25)*vol(i,j,0) + intg(i,j,0,
i_S_y2) + intg(i,j,0,
i_S_y));
1704 conn(i,j,0,3) = Real(3.)*(Real(0.25)*vol(i,j,0) + intg(i,j,0,
i_S_x2) - intg(i,j,0,
i_S_x));
1705 conn(i,j,0,4) = Real(6.)*(Real(0.25)*vol(i,j,0) - intg(i,j,0,
i_S_x2));
1706 conn(i,j,0,5) = Real(3.)*(Real(0.25)*vol(i,j,0) + intg(i,j,0,
i_S_x2) + intg(i,j,0,
i_S_x));
1711 void mlndlap_set_stencil_eb (
int i,
int j,
int, Array4<Real>
const& sten,
1712 Array4<Real const>
const& sig, Array4<Real const>
const& conn,
1713 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
1715 Real facx = Real(1./6.)*dxinv[0]*dxinv[0];
1716 Real facy = Real(1./6.)*dxinv[1]*dxinv[1];
1718 sten(i,j,0,1) = Real(2.)*facx*(sig(i,j-1,0)*conn(i,j-1,0,2)+sig(i,j,0)*conn(i,j,0,0))
1719 -facy*(sig(i,j-1,0)*conn(i,j-1,0,4)+sig(i,j,0)*conn(i,j,0,4));
1720 sten(i,j,0,2) = Real(2.)*facy*(sig(i-1,j,0)*conn(i-1,j,0,5)+sig(i,j,0)*conn(i,j,0,3))
1721 -facx*(sig(i-1,j,0)*conn(i-1,j,0,1)+sig(i,j,0)*conn(i,j,0,1));
1722 sten(i,j,0,3) = (facx*conn(i,j,0,1)+facy*conn(i,j,0,4))*sig(i,j,0);
1727 void mlndlap_divu_eb (
int i,
int j,
int, Array4<Real>
const& rhs, Array4<Real const>
const& vel,
1728 Array4<Real const>
const& vfrac, Array4<Real const>
const& intg,
1729 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
1730 Box const& nodal_domain,
1731 GpuArray<LinOpBCType, AMREX_SPACEDIM>
const& bclo,
1732 GpuArray<LinOpBCType, AMREX_SPACEDIM>
const& bchi) noexcept
1734 Real facx = Real(0.5)*dxinv[0];
1735 Real facy = Real(0.5)*dxinv[1];
1742 Real zero_ilo = Real(1.0);
1743 Real zero_ihi = Real(1.0);
1744 Real zero_jlo = Real(1.0);
1745 Real zero_jhi = Real(1.0);
1749 if ((bclo[0] == LinOpBCType::Neumann || bclo[0] == LinOpBCType::inflow)
1752 zero_ilo = Real(0.0);
1754 if ((bchi[0] == LinOpBCType::Neumann || bchi[0] == LinOpBCType::inflow)
1757 zero_ihi = Real(0.0);
1759 if ((bclo[1] == LinOpBCType::Neumann || bclo[1] == LinOpBCType::inflow)
1762 zero_jlo = Real(0.0);
1764 if ((bchi[1] == LinOpBCType::Neumann || bchi[1] == LinOpBCType::inflow)
1767 zero_jhi = Real(0.0);
1770 rhs(i,j,0) = facx*(-vel(i-1,j-1,0,0)*(vfrac(i-1,j-1,0)+Real(2.)*intg(i-1,j-1,0,1))*zero_jlo
1771 +vel(i ,j-1,0,0)*(vfrac(i ,j-1,0)+Real(2.)*intg(i ,j-1,0,1))*zero_jlo
1772 -vel(i-1,j ,0,0)*(vfrac(i-1,j ,0)-Real(2.)*intg(i-1,j ,0,1))*zero_jhi
1773 +vel(i ,j ,0,0)*(vfrac(i ,j ,0)-Real(2.)*intg(i ,j ,0,1))*zero_jhi)
1774 + facy*(-vel(i-1,j-1,0,1)*(vfrac(i-1,j-1,0)+Real(2.)*intg(i-1,j-1,0,0))*zero_ilo
1775 -vel(i ,j-1,0,1)*(vfrac(i ,j-1,0)-Real(2.)*intg(i ,j-1,0,0))*zero_ihi
1776 +vel(i-1,j ,0,1)*(vfrac(i-1,j ,0)+Real(2.)*intg(i-1,j ,0,0))*zero_ilo
1777 +vel(i ,j ,0,1)*(vfrac(i ,j ,0)-Real(2.)*intg(i ,j ,0,0))*zero_ihi);
1779 rhs(i,j,0) = Real(0.);
1784 void add_eb_flow_contribution (
int i,
int j,
int, Array4<Real>
const& rhs,
1785 Array4<int const>
const& msk, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
1786 Array4<Real const>
const& bareaarr,
1787 Array4<Real const>
const& sintg,
1788 Array4<Real const>
const& eb_vel_dot_n) noexcept
1790 using namespace nodelap_detail;
1792 Real fac_eb = 0.25 *dxinv[0];
1795 rhs(i,j,0) += fac_eb*(
1796 eb_vel_dot_n(i-1,j-1,0)*( bareaarr(i-1,j-1,0)
1797 +Real(2.)*sintg(i-1,j-1,0,
i_B_x )
1798 +Real(2.)*sintg(i-1,j-1,0,
i_B_y )
1799 +Real(4.)*sintg(i-1,j-1,0,i_B_xy))
1800 +eb_vel_dot_n(i ,j-1,0)*( bareaarr(i ,j-1,0)
1801 -Real(2.)*sintg(i ,j-1,0,
i_B_x )
1802 +Real(2.)*sintg(i ,j-1,0,
i_B_y )
1803 -Real(4.)*sintg(i ,j-1,0,i_B_xy))
1804 +eb_vel_dot_n(i-1,j ,0)*( bareaarr(i-1,j ,0)
1805 +Real(2.)*sintg(i-1,j ,0,
i_B_x )
1806 -Real(2.)*sintg(i-1,j ,0,
i_B_y )
1807 -Real(4.)*sintg(i-1,j ,0,i_B_xy))
1808 +eb_vel_dot_n(i ,j ,0)*( bareaarr(i ,j ,0)
1809 -Real(2.)*sintg(i ,j ,0,
i_B_x )
1810 -Real(2.)*sintg(i ,j ,0,
i_B_y )
1811 +Real(4.)*sintg(i ,j ,0,i_B_xy)));
1816 void mlndlap_mknewu_eb (
int i,
int j,
int, Array4<Real>
const& u, Array4<Real const>
const& p,
1817 Array4<Real const>
const& sig, Array4<Real const>
const& vfrac,
1818 Array4<Real const>
const& intg, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
1820 Real facx = Real(0.5)*dxinv[0];
1821 Real facy = Real(0.5)*dxinv[1];
1822 if (vfrac(i,j,0) == Real(0.)) {
1823 u(i,j,0,0) = u(i,j,0,1) = Real(0.);
1825 Real dpdx = facx*(-p(i,j,0)+p(i+1,j,0)-p(i,j+1,0)+p(i+1,j+1,0));
1826 Real dpdy = facy*(-p(i,j,0)-p(i+1,j,0)+p(i,j+1,0)+p(i+1,j+1,0));
1827 Real dpp = (p(i,j,0)+p(i+1,j+1,0)-p(i+1,j,0)-p(i,j+1,0))/vfrac(i,j,0);
1828 u(i,j,0,0) -= sig(i,j,0)*(dpdx + dxinv[0]*intg(i,j,0,1)*dpp);
1829 u(i,j,0,1) -= sig(i,j,0)*(dpdy + dxinv[1]*intg(i,j,0,0)*dpp);
1834 void mlndlap_mknewu_eb_c (
int i,
int j,
int, Array4<Real>
const& u, Array4<Real const>
const& p,
1835 Real sig, Array4<Real const>
const& vfrac,
1836 Array4<Real const>
const& intg, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv) noexcept
1838 Real facx = Real(0.5)*dxinv[0];
1839 Real facy = Real(0.5)*dxinv[1];
1840 if (vfrac(i,j,0) == Real(0.)) {
1841 u(i,j,0,0) = u(i,j,0,1) = Real(0.);
1843 Real dpdx = facx*(-p(i,j,0)+p(i+1,j,0)-p(i,j+1,0)+p(i+1,j+1,0));
1844 Real dpdy = facy*(-p(i,j,0)-p(i+1,j,0)+p(i,j+1,0)+p(i+1,j+1,0));
1845 Real dpp = (p(i,j,0)+p(i+1,j+1,0)-p(i+1,j,0)-p(i,j+1,0))/vfrac(i,j,0);
1846 u(i,j,0,0) -= sig*(dpdx + dxinv[0]*intg(i,j,0,1)*dpp);
1847 u(i,j,0,1) -= sig*(dpdy + dxinv[1]*intg(i,j,0,0)*dpp);
1852 Real mlndlap_rhcc_eb (
int i,
int j,
int, Array4<Real const>
const& rhcc,
1853 Array4<Real const>
const& vfrac, Array4<Real const>
const& intg,
1854 Array4<int const>
const& msk) noexcept
1856 using namespace nodelap_detail;
1860 rhcc(i ,j ,0)*(Real(0.25)*vfrac(i ,j ,0)-intg(i ,j ,0,
i_S_x)-intg(i ,j ,0,
i_S_y)+intg(i ,j ,0,i_S_xy)) +
1861 rhcc(i-1,j ,0)*(Real(0.25)*vfrac(i-1,j ,0)+intg(i-1,j ,0,
i_S_x)-intg(i-1,j ,0,
i_S_y)-intg(i-1,j ,0,i_S_xy)) +
1862 rhcc(i-1,j-1,0)*(Real(0.25)*vfrac(i-1,j-1,0)+intg(i-1,j-1,0,
i_S_x)+intg(i-1,j-1,0,
i_S_y)+intg(i-1,j-1,0,i_S_xy)) +
1863 rhcc(i ,j-1,0)*(Real(0.25)*vfrac(i ,j-1,0)-intg(i ,j-1,0,
i_S_x)+intg(i ,j-1,0,
i_S_y)-intg(i ,j-1,0,i_S_xy));
1870 void mlndlap_set_integral (
int i,
int j,
int, Array4<Real>
const& intg) noexcept
1872 using namespace nodelap_detail;
1874 intg(i,j,0,
i_S_x ) = Real(0.);
1875 intg(i,j,0,
i_S_y ) = Real(0.);
1876 intg(i,j,0,
i_S_x2) = Real(1./12.);
1877 intg(i,j,0,
i_S_y2) = Real(1./12.);
1878 intg(i,j,0,i_S_xy) = Real(0.);
1882 void mlndlap_set_surface_integral (
int i,
int j,
int, Array4<Real>
const& sintg) noexcept
1884 using namespace nodelap_detail;
1886 sintg(i,j,0,
i_B_x ) = Real(0.);
1887 sintg(i,j,0,
i_B_y ) = Real(0.);
1888 sintg(i,j,0,i_B_xy) = Real(0.);
1892 void mlndlap_set_integral_eb (
int i,
int j,
int, Array4<Real>
const& intg,
1893 Array4<EBCellFlag const>
const& flag, Array4<Real const>
const& vol,
1894 Array4<Real const>
const& ax, Array4<Real const>
const& ay,
1895 Array4<Real const>
const& bcen) noexcept
1897 using namespace nodelap_detail;
1899 if (flag(i,j,0).isCovered()) {
1900 intg(i,j,0,
i_S_x ) = Real(0.);
1901 intg(i,j,0,
i_S_y ) = Real(0.);
1902 intg(i,j,0,
i_S_x2) = Real(0.);
1903 intg(i,j,0,
i_S_y2) = Real(0.);
1904 intg(i,j,0,i_S_xy) = Real(0.);
1905 }
else if (flag(i,j,0).isRegular() || vol(i,j,0) >=
almostone) {
1906 intg(i,j,0,
i_S_x ) = Real(0.);
1907 intg(i,j,0,
i_S_y ) = Real(0.);
1908 intg(i,j,0,
i_S_x2) = Real(1./12.);
1909 intg(i,j,0,
i_S_y2) = Real(1./12.);
1910 intg(i,j,0,i_S_xy) = Real(0.);
1912 Real axm = ax(i,j,0);
1913 Real axp = ax(i+1,j,0);
1914 Real aym = ay(i,j,0);
1915 Real ayp = ay(i,j+1,0);
1917 Real apnorm =
std::sqrt((axm-axp)*(axm-axp) + (aym-ayp)*(aym-ayp));
1918 if (apnorm == Real(0.)) {
1919 amrex::Abort(
"amrex_mlndlap_set_integral: we are in trouble");
1922 Real apnorminv = Real(1.)/apnorm;
1923 Real anrmx = (axm-axp) * apnorminv;
1924 Real anrmy = (aym-ayp) * apnorminv;
1926 Real bcx = bcen(i,j,0,0);
1927 Real bcy = bcen(i,j,0,1);
1929 Real Sx, Sy, Sx2, Sy2, Sxy;
1932 Sx2 = Real(1./24.)*(axm+axp);
1935 Sx = Real(1./8.) *(axp-axm) + anrmx*Real(0.5)*(bcx*bcx);
1936 Sx2 = Real(1./24.)*(axp+axm) + anrmx*Real(1./3.)*(bcx*bcx*bcx);
1940 if (anrmx > Real(0.)) {
1947 Real xmin3 = xmin*xmin*xmin;
1948 Real xmin4 = xmin3*xmin;
1949 Real xmax3 = xmax*xmax*xmax;
1950 Real xmax4 = xmax3*xmax;
1951 Sx = Real(1./8.) *(axp-axm) + (anrmx/
std::abs(anrmy))*Real(1./6.) *(xmax3-xmin3);
1952 Sx2 = Real(1./24.)*(axp+axm) + (anrmx/
std::abs(anrmy))*Real(1./12.)*(xmax4-xmin4);
1954 Real kk = -anrmx/anrmy;
1955 Real bb = bcy-kk*bcx;
1956 Sxy = Real(1./8.)*kk*kk*(xmax4-xmin4) + Real(1./3.)*kk*bb*(xmax3-xmin3)
1957 + (Real(0.25)*bb*bb-Real(1./16.))*(xmax*xmax-xmin*xmin);
1958 Sxy = std::copysign(Sxy, anrmy);
1963 Sy2 = Real(1./24.)*(aym+ayp);
1965 Sy = Real(1./8.) *(ayp-aym) + anrmy*Real(0.5)*(bcy*bcy);
1966 Sy2 = Real(1./24.)*(ayp+aym) + anrmy*Real(1./3.)*(bcy*bcy*bcy);
1969 if (anrmy > Real(0.)) {
1976 Real ymin3 = ymin*ymin*ymin;
1977 Real ymin4 = ymin3*ymin;
1978 Real ymax3 = ymax*ymax*ymax;
1979 Real ymax4 = ymax3*ymax;
1980 Sy = Real(1./8.) *(ayp-aym) + (anrmy/
std::abs(anrmx))*Real(1./6.) *(ymax3-ymin3);
1981 Sy2 = Real(1./24.)*(ayp+aym) + (anrmy/
std::abs(anrmx))*Real(1./12.)*(ymax4-ymin4);
1984 intg(i,j,0,
i_S_x ) = Sx;
1985 intg(i,j,0,
i_S_y ) = Sy;
1986 intg(i,j,0,
i_S_x2) = Sx2;
1987 intg(i,j,0,
i_S_y2) = Sy2;
1988 intg(i,j,0,i_S_xy) = Sxy;
1993 void mlndlap_set_surface_integral_eb (
int i,
int j,
int, Array4<Real>
const& sintg,
1994 Array4<EBCellFlag const>
const& flag,
1995 Array4<Real const>
const& bcen,
1996 Array4<Real const>
const& barea,
1997 Array4<Real const>
const& bnorm) noexcept
1999 using namespace nodelap_detail;
2001 if (flag(i,j,0).isCovered() || flag(i,j,0).isRegular()) {
2002 sintg(i,j,0,
i_B_x ) = Real(0.);
2003 sintg(i,j,0,
i_B_y ) = Real(0.);
2004 sintg(i,j,0,i_B_xy) = Real(0.);
2006 Real bcx = bcen(i,j,0,0);
2007 Real bcy = bcen(i,j,0,1);
2009 Real btanx = bnorm(i,j,0,1);
2010 Real btany = -bnorm(i,j,0,0);
2012 Real x0 = bcx - Real(0.5)*barea(i,j,0)*btanx;
2013 Real x1 = bcx + Real(0.5)*barea(i,j,0)*btanx;
2015 Real y0 = bcy - Real(0.5)*barea(i,j,0)*btany;
2016 Real y1 = bcy + Real(0.5)*barea(i,j,0)*btany;
2018 Real Bx = barea(i,j,0)*Real(0.5)*(x1 + x0);
2019 Real By = barea(i,j,0)*Real(0.5)*(y1 + y0);
2020 Real Bxy = barea(i,j,0)*(x0*y0 + (x0*(y1 - y0) + y0*(x1 - x0))/Real(2.) + (x1 - x0)*(y1 - y0)/Real(3.));
2022 sintg(i,j,0,
i_B_x ) = Bx;
2023 sintg(i,j,0,
i_B_y ) = By;
2024 sintg(i,j,0,i_B_xy) = Bxy;
2030 #if defined(AMREX_USE_HYPRE)
2032 template <
typename HypreInt,
typename AtomicInt>
2033 void mlndlap_fillijmat_sten_cpu (
Box const& ndbx,
2034 Array4<AtomicInt const>
const& gid,
2035 Array4<int const>
const& lid,
2036 HypreInt* ncols, HypreInt* cols,
2038 Array4<Real const>
const& sten) noexcept
2041 HypreInt nelems = 0;
2044 if (lid(i,j,k) >= 0)
2046 cols[nelems] = gid(i,j,k);
2047 mat[nelems] = sten(i,j,k,0);
2051 if (gid(i-1,j-1,k) < gidmax) {
2052 cols[nelems] = gid(i-1,j-1,k);
2053 mat[nelems] = sten(i-1,j-1,k,3);
2057 if (gid(i,j-1,k) < gidmax) {
2058 cols[nelems] = gid(i,j-1,k);
2059 mat[nelems] = sten(i,j-1,k,2);
2063 if (gid(i+1,j-1,k) < gidmax) {
2064 cols[nelems] = gid(i+1,j-1,k);
2065 mat[nelems] = sten(i ,j-1,k,3);
2069 if (gid(i-1,j,k) < gidmax) {
2070 cols[nelems] = gid(i-1,j,k);
2071 mat[nelems] = sten(i-1,j,k,1);
2075 if (gid(i+1,j,k) < gidmax) {
2076 cols[nelems] = gid(i+1,j,k);
2077 mat[nelems] = sten(i ,j,k,1);
2081 if (gid(i-1,j+1,k) < gidmax) {
2082 cols[nelems] = gid(i-1,j+1,k);
2083 mat[nelems] = sten(i-1,j ,k,3);
2087 if (gid(i,j+1,k) < gidmax) {
2088 cols[nelems] = gid(i,j+1,k);
2089 mat[nelems] = sten(i,j ,k,2);
2093 if (gid(i+1,j+1,k) < gidmax) {
2094 cols[nelems] = gid(i+1,j+1,k);
2095 mat[nelems] = sten(i ,j ,k,3);
2099 ncols[lid(i,j,k)] = nelems - nelems_old;
2104 template <
typename HypreInt,
typename AtomicInt>
2105 void mlndlap_fillijmat_aa_cpu (
Box const& ndbx,
2106 Array4<AtomicInt const>
const& gid,
2107 Array4<int const>
const& lid,
2108 HypreInt* ncols, HypreInt* cols,
2110 Array4<Real const>
const& sig,
2111 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
2112 Box const& ccdom,
bool is_rz) noexcept
2114 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
2115 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
2116 Real fxy = facx + facy;
2117 Real f2xmy = Real(2.0)*facx - facy;
2118 Real fmx2y = Real(2.0)*facy - facx;
2124 HypreInt nelems = 0;
2127 if (lid(i,j,k) >= 0)
2131 fp = facy /
static_cast<Real
>(2*i+1);
2132 fm = facy /
static_cast<Real
>(2*i-1);
2134 fp = fm = Real(0.0);
2137 HypreInt nelems_old = nelems;
2138 cols[nelems_old] = gid(i,j,k);
2142 if (nddom.contains(i-1,j-1,k)) {
2143 Real tmp = fxy*sig(i-1,j-1,k);
2145 if ( gid(i-1,j-1,k) < gidmax) {
2146 cols[nelems] = gid(i-1,j-1,k);
2152 if (nddom.contains(i,j-1,k)) {
2153 Real tmp = Real(0.0);
2154 if ( ccdom.contains(i-1,j-1,k)) {
2155 tmp += sig(i-1,j-1,k) * (fmx2y + fm);
2157 if ( ccdom.contains(i,j-1,k)) {
2158 tmp += sig(i,j-1,k) * (fmx2y - fp);
2161 if (gid(i,j-1,k) < gidmax) {
2162 cols[nelems] = gid(i,j-1,k);
2168 if (nddom.contains(i+1,j-1,k)) {
2169 Real tmp = fxy*sig(i ,j-1,k);
2171 if (gid(i+1,j-1,k) < gidmax) {
2172 cols[nelems] = gid(i+1,j-1,k);
2178 if (nddom.contains(i-1,j,k)) {
2179 Real tmp = Real(0.0);
2180 if ( ccdom.contains(i-1,j-1,k)) {
2181 tmp += f2xmy*sig(i-1,j-1,k);
2183 if ( ccdom.contains(i-1,j,k)) {
2184 tmp += f2xmy*sig(i-1,j,k);
2187 if (gid(i-1,j,k) < gidmax) {
2188 cols[nelems] = gid(i-1,j,k);
2194 if (nddom.contains(i+1,j,k)) {
2195 Real tmp = Real(0.0);
2196 if ( ccdom.contains(i ,j-1,k)) {
2197 tmp += f2xmy*sig(i ,j-1,k);
2199 if ( ccdom.contains(i ,j,k)) {
2200 tmp += f2xmy*sig(i ,j,k);
2203 if (gid(i+1,j,k) < gidmax) {
2204 cols[nelems] = gid(i+1,j,k);
2210 if (nddom.contains(i-1,j+1,k)) {
2211 Real tmp = fxy*sig(i-1,j ,k);
2213 if (gid(i-1,j+1,k) < gidmax) {
2214 cols[nelems] = gid(i-1,j+1,k);
2220 if (nddom.contains(i,j+1,k)) {
2221 Real tmp = Real(0.0);
2222 if ( ccdom.contains(i-1,j ,k)) {
2223 tmp += sig(i-1,j ,k) * (fmx2y + fm);
2225 if ( ccdom.contains(i,j ,k)) {
2226 tmp += sig(i,j ,k) * (fmx2y - fp);
2229 if (gid(i,j+1,k) < gidmax) {
2230 cols[nelems] = gid(i,j+1,k);
2236 if (nddom.contains(i+1,j+1,k)) {
2237 Real tmp = fxy*sig(i ,j ,k);
2239 if (gid(i+1,j+1,k) < gidmax) {
2240 cols[nelems] = gid(i+1,j+1,k);
2246 mat[nelems_old] = m0;
2247 ncols[lid(i,j,k)] = nelems - nelems_old;
2252 template <
typename HypreInt,
typename AtomicInt>
2253 void mlndlap_fillijmat_ha_cpu (
Box const& ndbx,
2254 Array4<AtomicInt const>
const& gid,
2255 Array4<int const>
const& lid,
2256 HypreInt* ncols, HypreInt* cols,
2258 Array4<Real const>
const& sx,
2259 Array4<Real const>
const& sy,
2260 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
2261 Box const& ccdom,
bool is_rz) noexcept
2263 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
2264 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
2270 HypreInt nelems = 0;
2273 if (lid(i,j,k) >= 0)
2277 fp = facy /
static_cast<Real
>(2*i+1);
2278 fm = facy /
static_cast<Real
>(2*i-1);
2280 fp = fm = Real(0.0);
2283 HypreInt nelems_old = nelems;
2284 cols[nelems_old] = gid(i,j,k);
2288 if (nddom.contains(i-1,j-1,k)) {
2289 Real tmp = facx*sx(i-1,j-1,k) + facy*sy(i-1,j-1,k);
2291 if ( gid(i-1,j-1,k) < gidmax) {
2292 cols[nelems] = gid(i-1,j-1,k);
2298 if (nddom.contains(i,j-1,k)) {
2299 Real tmp = Real(0.0);
2300 if ( ccdom.contains(i-1,j-1,k)) {
2301 tmp += sy(i-1,j-1,k) * (facy * Real(2.0) + fm)
2302 - sx(i-1,j-1,k) * facx;
2304 if ( ccdom.contains(i,j-1,k)) {
2305 tmp += sy(i,j-1,k) * (facy * Real(2.0) - fp)
2306 - sx(i,j-1,k) * facx;
2309 if (gid(i,j-1,k) < gidmax) {
2310 cols[nelems] = gid(i,j-1,k);
2316 if (nddom.contains(i+1,j-1,k)) {
2317 Real tmp = facx*sx(i ,j-1,k) + facy*sy(i ,j-1,k);
2319 if (gid(i+1,j-1,k) < gidmax) {
2320 cols[nelems] = gid(i+1,j-1,k);
2326 if (nddom.contains(i-1,j,k)) {
2327 Real tmp = Real(0.0);
2328 if ( ccdom.contains(i-1,j-1,k)) {
2329 tmp += sx(i-1,j-1,k) * facx*Real(2.0)
2330 - sy(i-1,j-1,k) * facy;
2332 if ( ccdom.contains(i-1,j,k)) {
2333 tmp += sx(i-1,j,k) * facx*Real(2.0)
2334 - sy(i-1,j,k) * facy;
2337 if (gid(i-1,j,k) < gidmax) {
2338 cols[nelems] = gid(i-1,j,k);
2344 if (nddom.contains(i+1,j,k)) {
2345 Real tmp = Real(0.0);
2346 if ( ccdom.contains(i ,j-1,k)) {
2347 tmp += sx(i ,j-1,k) * facx*Real(2.0)
2348 - sy(i ,j-1,k) * facy;
2350 if ( ccdom.contains(i ,j,k)) {
2351 tmp += sx(i ,j,k) * facx*Real(2.0)
2352 - sy(i ,j,k) * facy;
2355 if (gid(i+1,j,k) < gidmax) {
2356 cols[nelems] = gid(i+1,j,k);
2362 if (nddom.contains(i-1,j+1,k)) {
2363 Real tmp = facx*sx(i-1,j ,k) + facy*sy(i-1,j ,k);
2365 if (gid(i-1,j+1,k) < gidmax) {
2366 cols[nelems] = gid(i-1,j+1,k);
2372 if (nddom.contains(i,j+1,k)) {
2373 Real tmp = Real(0.0);
2374 if ( ccdom.contains(i-1,j ,k)) {
2375 tmp += sy(i-1,j ,k) * (facy*Real(2.0) + fm)
2376 - sx(i-1,j ,k) * facx;
2378 if ( ccdom.contains(i,j ,k)) {
2379 tmp += sy(i,j ,k) * (facy*Real(2.0) - fp)
2380 - sx(i,j ,k) * facx;
2383 if (gid(i,j+1,k) < gidmax) {
2384 cols[nelems] = gid(i,j+1,k);
2390 if (nddom.contains(i+1,j+1,k)) {
2391 Real tmp = facx*sx(i ,j ,k) + facy*sy(i ,j ,k);
2393 if (gid(i+1,j+1,k) < gidmax) {
2394 cols[nelems] = gid(i+1,j+1,k);
2400 mat[nelems_old] = m0;
2401 ncols[lid(i,j,k)] = nelems - nelems_old;
2406 template <
typename HypreInt,
typename AtomicInt>
2407 void mlndlap_fillijmat_cs_cpu (
Box const& ndbx,
2408 Array4<AtomicInt const>
const& gid,
2409 Array4<int const>
const& lid,
2410 HypreInt* ncols, HypreInt* cols,
2413 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
2414 Box const& ccdom,
bool is_rz) noexcept
2416 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0] * sig;
2417 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1] * sig;
2418 Real fxy = facx + facy;
2419 Real f2xmy = Real(2.0)*facx - facy;
2420 Real fmx2y = Real(2.0)*facy - facx;
2426 HypreInt nelems = 0;
2429 if (lid(i,j,k) >= 0)
2433 fp = facy /
static_cast<Real
>(2*i+1);
2434 fm = facy /
static_cast<Real
>(2*i-1);
2436 fp = fm = Real(0.0);
2439 HypreInt nelems_old = nelems;
2440 cols[nelems_old] = gid(i,j,k);
2444 if (nddom.contains(i-1,j-1,k)) {
2447 if ( gid(i-1,j-1,k) < gidmax) {
2448 cols[nelems] = gid(i-1,j-1,k);
2454 if (nddom.contains(i,j-1,k)) {
2455 Real tmp = Real(0.0);
2456 if ( ccdom.contains(i-1,j-1,k)) {
2459 if ( ccdom.contains(i,j-1,k)) {
2463 if (gid(i,j-1,k) < gidmax) {
2464 cols[nelems] = gid(i,j-1,k);
2470 if (nddom.contains(i+1,j-1,k)) {
2473 if (gid(i+1,j-1,k) < gidmax) {
2474 cols[nelems] = gid(i+1,j-1,k);
2480 if (nddom.contains(i-1,j,k)) {
2481 Real tmp = Real(0.0);
2482 if ( ccdom.contains(i-1,j-1,k)) {
2485 if ( ccdom.contains(i-1,j,k)) {
2489 if (gid(i-1,j,k) < gidmax) {
2490 cols[nelems] = gid(i-1,j,k);
2496 if (nddom.contains(i+1,j,k)) {
2497 Real tmp = Real(0.0);
2498 if ( ccdom.contains(i ,j-1,k)) {
2501 if ( ccdom.contains(i ,j,k)) {
2505 if (gid(i+1,j,k) < gidmax) {
2506 cols[nelems] = gid(i+1,j,k);
2512 if (nddom.contains(i-1,j+1,k)) {
2515 if (gid(i-1,j+1,k) < gidmax) {
2516 cols[nelems] = gid(i-1,j+1,k);
2522 if (nddom.contains(i,j+1,k)) {
2523 Real tmp = Real(0.0);
2524 if ( ccdom.contains(i-1,j ,k)) {
2527 if ( ccdom.contains(i,j ,k)) {
2531 if (gid(i,j+1,k) < gidmax) {
2532 cols[nelems] = gid(i,j+1,k);
2538 if (nddom.contains(i+1,j+1,k)) {
2541 if (gid(i+1,j+1,k) < gidmax) {
2542 cols[nelems] = gid(i+1,j+1,k);
2548 mat[nelems_old] = m0;
2549 ncols[lid(i,j,k)] = nelems - nelems_old;
2554 #ifdef AMREX_USE_GPU
2556 template <
typename HypreInt,
typename AtomicInt>
2558 void mlndlap_fillijmat_sten_gpu (
const int ps,
const int i,
const int j,
const int k,
2560 Array4<AtomicInt const>
const& gid,
2561 Array4<int const>
const& lid,
2562 HypreInt* ncols, HypreInt* cols,
2564 Array4<Real const>
const& sten) noexcept
2566 if (lid(i,j,k) >= 0)
2572 if (gid(i-1,j-1,k) < gidmax) {
2574 cols[ps] = gid(i-1,j-1,k);
2575 mat[ps] = sten(i-1,j-1,k,3);
2579 if (
offset != 0) {
return; }
2583 if (gid(i,j-1,k) < gidmax) {
2585 cols[ps] = gid(i,j-1,k);
2586 mat[ps] = sten(i,j-1,k,2);
2590 if (
offset != 0) {
return; }
2594 if (gid(i+1,j-1,k) < gidmax) {
2596 cols[ps] = gid(i+1,j-1,k);
2597 mat[ps] = sten(i ,j-1,k,3);
2601 if (
offset != 0) {
return; }
2605 if (gid(i-1,j,k) < gidmax) {
2607 cols[ps] = gid(i-1,j,k);
2608 mat[ps] = sten(i-1,j,k,1);
2612 if (
offset != 0) {
return; }
2616 if (gid(i+1,j,k) < gidmax) {
2618 cols[ps] = gid(i+1,j,k);
2619 mat[ps] = sten(i ,j,k,1);
2623 if (
offset != 0) {
return; }
2627 if (gid(i-1,j+1,k) < gidmax) {
2629 cols[ps] = gid(i-1,j+1,k);
2630 mat[ps] = sten(i-1,j ,k,3);
2634 if (
offset != 0) {
return; }
2638 if (gid(i,j+1,k) < gidmax) {
2640 cols[ps] = gid(i,j+1,k);
2641 mat[ps] = sten(i,j ,k,2);
2645 if (
offset != 0) {
return; }
2649 if (gid(i+1,j+1,k) < gidmax) {
2651 cols[ps] = gid(i+1,j+1,k);
2652 mat[ps] = sten(i ,j ,k,3);
2656 if (
offset != 0) {
return; }
2660 cols[ps] = gid(i,j,k);
2661 mat[ps] = sten(i,j,k,0);
2662 ncols[lid(i,j,k)] = nelems+1;
2666 template <
typename HypreInt,
typename AtomicInt>
2668 void mlndlap_fillijmat_aa_gpu (
const int ps,
const int i,
const int j,
const int k,
2670 Box const& ndbx, Array4<AtomicInt const>
const& gid,
2671 Array4<int const>
const& lid,
2672 HypreInt* ncols, HypreInt* cols,
2674 Array4<Real const>
const& sig,
2675 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
2676 Box const& ccdom,
bool is_rz) noexcept
2678 if (lid(i,j,k) >= 0)
2680 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
2681 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
2682 Real fxy = facx + facy;
2683 Real f2xmy = Real(2.0)*facx - facy;
2684 Real fmx2y = Real(2.0)*facy - facx;
2688 fp = facy /
static_cast<Real
>(2*i+1);
2689 fm = facy /
static_cast<Real
>(2*i-1);
2691 fp = fm = Real(0.0);
2701 if (nddom.contains(i-1,j-1,k)) {
2702 Real tmp = fxy*sig(i-1,j-1,k);
2704 if (gid(i-1,j-1,k) < gidmax) {
2706 cols[ps] = gid(i-1,j-1,k);
2712 if (
offset != 0) {
return; }
2716 if (nddom.contains(i,j-1,k)) {
2717 Real tmp = Real(0.0);
2718 if ( ccdom.contains(i-1,j-1,k)) {
2719 tmp += sig(i-1,j-1,k) * (fmx2y + fm);
2721 if ( ccdom.contains(i,j-1,k)) {
2722 tmp += sig(i,j-1,k) * (fmx2y - fp);
2725 if (gid(i,j-1,k) < gidmax) {
2727 cols[ps] = gid(i,j-1,k);
2733 if (
offset != 0) {
return; }
2737 if (nddom.contains(i+1,j-1,k)) {
2738 Real tmp = fxy*sig(i ,j-1,k);
2740 if (gid(i+1,j-1,k) < gidmax) {
2742 cols[ps] = gid(i+1,j-1,k);
2748 if (
offset != 0) {
return; }
2752 if (nddom.contains(i-1,j,k)) {
2753 Real tmp = Real(0.0);
2754 if ( ccdom.contains(i-1,j-1,k)) {
2755 tmp += f2xmy*sig(i-1,j-1,k);
2757 if ( ccdom.contains(i-1,j,k)) {
2758 tmp += f2xmy*sig(i-1,j,k);
2761 if (gid(i-1,j,k) < gidmax) {
2763 cols[ps] = gid(i-1,j,k);
2769 if (
offset != 0) {
return; }
2773 if (nddom.contains(i+1,j,k)) {
2774 Real tmp = Real(0.0);
2775 if ( ccdom.contains(i ,j-1,k)) {
2776 tmp += f2xmy*sig(i ,j-1,k);
2778 if ( ccdom.contains(i ,j,k)) {
2779 tmp += f2xmy*sig(i ,j,k);
2782 if (gid(i+1,j,k) < gidmax) {
2784 cols[ps] = gid(i+1,j,k);
2790 if (
offset != 0) {
return; }
2794 if (nddom.contains(i-1,j+1,k)) {
2795 Real tmp = fxy*sig(i-1,j ,k);
2797 if (gid(i-1,j+1,k) < gidmax) {
2799 cols[ps] = gid(i-1,j+1,k);
2805 if (
offset != 0) {
return; }
2809 if (nddom.contains(i,j+1,k)) {
2810 Real tmp = Real(0.0);
2811 if ( ccdom.contains(i-1,j ,k)) {
2812 tmp += sig(i-1,j ,k) * (fmx2y + fm);
2814 if ( ccdom.contains(i,j ,k)) {
2815 tmp += sig(i,j ,k) * (fmx2y - fp);
2818 if (gid(i,j+1,k) < gidmax) {
2820 cols[ps] = gid(i,j+1,k);
2826 if (
offset != 0) {
return; }
2830 if (nddom.contains(i+1,j+1,k)) {
2831 Real tmp = fxy*sig(i ,j ,k);
2833 if (gid(i+1,j+1,k) < gidmax) {
2835 cols[ps] = gid(i+1,j+1,k);
2841 if (
offset != 0) {
return; }
2845 cols[ps] = gid(i,j,k);
2847 ncols[lid(i,j,k)] = nelems+1;
2851 template <
typename HypreInt,
typename AtomicInt>
2853 void mlndlap_fillijmat_ha_gpu (
const int ps,
const int i,
const int j,
const int k,
2855 Box const& ndbx, Array4<AtomicInt const>
const& gid,
2856 Array4<int const>
const& lid,
2857 HypreInt* ncols, HypreInt* cols,
2859 Array4<Real const>
const& sx,
2860 Array4<Real const>
const& sy,
2861 GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
2862 Box const& ccdom,
bool is_rz) noexcept
2864 if (lid(i,j,k) >= 0)
2866 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
2867 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
2871 fp = facy /
static_cast<Real
>(2*i+1);
2872 fm = facy /
static_cast<Real
>(2*i-1);
2874 fp = fm = Real(0.0);
2884 if (nddom.contains(i-1,j-1,k)) {
2885 Real tmp = facx*sx(i-1,j-1,k) + facy*sy(i-1,j-1,k);
2887 if ( gid(i-1,j-1,k) < gidmax) {
2889 cols[ps] = gid(i-1,j-1,k);
2895 if (
offset != 0) {
return; }
2899 if (nddom.contains(i,j-1,k)) {
2900 Real tmp = Real(0.0);
2901 if ( ccdom.contains(i-1,j-1,k)) {
2902 tmp += sy(i-1,j-1,k) * (facy * Real(2.0) + fm)
2903 - sx(i-1,j-1,k) * facx;
2905 if ( ccdom.contains(i,j-1,k)) {
2906 tmp += sy(i,j-1,k) * (facy * Real(2.0) - fp)
2907 - sx(i,j-1,k) * facx;
2910 if (gid(i,j-1,k) < gidmax) {
2912 cols[ps] = gid(i,j-1,k);
2918 if (
offset != 0) {
return; }
2922 if (nddom.contains(i+1,j-1,k)) {
2923 Real tmp = facx*sx(i ,j-1,k) + facy*sy(i ,j-1,k);
2925 if (gid(i+1,j-1,k) < gidmax) {
2927 cols[ps] = gid(i+1,j-1,k);
2933 if (
offset != 0) {
return; }
2937 if (nddom.contains(i-1,j,k)) {
2938 Real tmp = Real(0.0);
2939 if ( ccdom.contains(i-1,j-1,k)) {
2940 tmp += sx(i-1,j-1,k) * facx*Real(2.0)
2941 - sy(i-1,j-1,k) * facy;
2943 if ( ccdom.contains(i-1,j,k)) {
2944 tmp += sx(i-1,j,k) * facx*Real(2.0)
2945 - sy(i-1,j,k) * facy;
2948 if (gid(i-1,j,k) < gidmax) {
2950 cols[ps] = gid(i-1,j,k);
2956 if (
offset != 0) {
return; }
2960 if (nddom.contains(i+1,j,k)) {
2961 Real tmp = Real(0.0);
2962 if ( ccdom.contains(i ,j-1,k)) {
2963 tmp += sx(i ,j-1,k) * facx*Real(2.0)
2964 - sy(i ,j-1,k) * facy;
2966 if ( ccdom.contains(i ,j,k)) {
2967 tmp += sx(i ,j,k) * facx*Real(2.0)
2968 - sy(i ,j,k) * facy;
2971 if (gid(i+1,j,k) < gidmax) {
2973 cols[ps] = gid(i+1,j,k);
2979 if (
offset != 0) {
return; }
2983 if (nddom.contains(i-1,j+1,k)) {
2984 Real tmp = facx*sx(i-1,j ,k) + facy*sy(i-1,j ,k);
2986 if (gid(i-1,j+1,k) < gidmax) {
2988 cols[ps] = gid(i-1,j+1,k);
2994 if (
offset != 0) {
return; }
2998 if (nddom.contains(i,j+1,k)) {
2999 Real tmp = Real(0.0);
3000 if ( ccdom.contains(i-1,j ,k)) {
3001 tmp += sy(i-1,j ,k) * (facy*Real(2.0) + fm)
3002 - sx(i-1,j ,k) * facx;
3004 if ( ccdom.contains(i,j ,k)) {
3005 tmp += sy(i,j ,k) * (facy*Real(2.0) - fp)
3006 - sx(i,j ,k) * facx;
3009 if (gid(i,j+1,k) < gidmax) {
3011 cols[ps] = gid(i,j+1,k);
3017 if (
offset != 0) {
return; }
3021 if (nddom.contains(i+1,j+1,k)) {
3022 Real tmp = facx*sx(i ,j ,k) + facy*sy(i ,j ,k);
3024 if (gid(i+1,j+1,k) < gidmax) {
3026 cols[ps] = gid(i+1,j+1,k);
3032 if (
offset != 0) {
return; }
3036 cols[ps] = gid(i,j,k);
3038 ncols[lid(i,j,k)] = nelems+1;
3042 template <
typename HypreInt,
typename AtomicInt>
3044 void mlndlap_fillijmat_cs_gpu (
const int ps,
const int i,
const int j,
const int k,
3046 Box const& ndbx, Array4<AtomicInt const>
const& gid,
3047 Array4<int const>
const& lid,
3048 HypreInt* ncols, HypreInt* cols,
3050 Real sig, GpuArray<Real,AMREX_SPACEDIM>
const& dxinv,
3051 Box const& ccdom,
bool is_rz) noexcept
3053 if (lid(i,j,k) >= 0)
3055 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0] * sig;
3056 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1] * sig;
3057 Real fxy = facx + facy;
3058 Real f2xmy = Real(2.0)*facx - facy;
3059 Real fmx2y = Real(2.0)*facy - facx;
3063 fp = facy /
static_cast<Real
>(2*i+1);
3064 fm = facy /
static_cast<Real
>(2*i-1);
3066 fp = fm = Real(0.0);
3077 if (nddom.contains(i-1,j-1,k)) {
3080 if ( gid(i-1,j-1,k) < gidmax) {
3082 cols[ps] = gid(i-1,j-1,k);
3088 if (
offset != 0) {
return; }
3092 if (nddom.contains(i,j-1,k)) {
3093 Real tmp = Real(0.0);
3094 if ( ccdom.contains(i-1,j-1,k)) {
3097 if ( ccdom.contains(i,j-1,k)) {
3101 if (gid(i,j-1,k) < gidmax) {
3103 cols[ps] = gid(i,j-1,k);
3109 if (
offset != 0) {
return; }
3113 if (nddom.contains(i+1,j-1,k)) {
3116 if (gid(i+1,j-1,k) < gidmax) {
3118 cols[ps] = gid(i+1,j-1,k);
3124 if (
offset != 0) {
return; }
3128 if (nddom.contains(i-1,j,k)) {
3129 Real tmp = Real(0.0);
3130 if ( ccdom.contains(i-1,j-1,k)) {
3133 if ( ccdom.contains(i-1,j,k)) {
3137 if (gid(i-1,j,k) < gidmax) {
3139 cols[ps] = gid(i-1,j,k);
3145 if (
offset != 0) {
return; }
3149 if (nddom.contains(i+1,j,k)) {
3150 Real tmp = Real(0.0);
3151 if ( ccdom.contains(i ,j-1,k)) {
3154 if ( ccdom.contains(i ,j,k)) {
3158 if (gid(i+1,j,k) < gidmax) {
3160 cols[ps] = gid(i+1,j,k);
3166 if (
offset != 0) {
return; }
3170 if (nddom.contains(i-1,j+1,k)) {
3173 if (gid(i-1,j+1,k) < gidmax) {
3175 cols[ps] = gid(i-1,j+1,k);
3181 if (
offset != 0) {
return; }
3185 if (nddom.contains(i,j+1,k)) {
3186 Real tmp = Real(0.0);
3187 if ( ccdom.contains(i-1,j ,k)) {
3190 if ( ccdom.contains(i,j ,k)) {
3194 if (gid(i,j+1,k) < gidmax) {
3196 cols[ps] = gid(i,j+1,k);
3202 if (
offset != 0) {
return; }
3206 if (nddom.contains(i+1,j+1,k)) {
3209 if (gid(i+1,j+1,k) < gidmax) {
3211 cols[ps] = gid(i+1,j+1,k);
3217 if (
offset != 0) {
return; }
3221 cols[ps] = gid(i,j,k);
3223 ncols[lid(i,j,k)] = nelems+1;
3234 return (i%2) + (j%2)*2;
3242 bool is_rz) noexcept
3246 sol(i,j,k) = Real(0.0);
3248 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
3249 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
3251 Real s0 = Real(-2.0)*(facx*(sx(i-1,j-1,k)+sx(i,j-1,k)+sx(i-1,j,k)+sx(i,j,k))
3252 +facy*(sy(i-1,j-1,k)+sy(i,j-1,k)+sy(i-1,j,k)+sy(i,j,k)));
3254 Real Ax = sol(i-1,j-1,k)*(facx*sx(i-1,j-1,k)+facy*sy(i-1,j-1,k))
3255 + sol(i+1,j-1,k)*(facx*sx(i ,j-1,k)+facy*sy(i ,j-1,k))
3256 + sol(i-1,j+1,k)*(facx*sx(i-1,j ,k)+facy*sy(i-1,j ,k))
3257 + sol(i+1,j+1,k)*(facx*sx(i ,j ,k)+facy*sy(i ,j ,k))
3258 + sol(i-1,j,k)*(Real(2.0)*facx*(sx(i-1,j-1,k)+sx(i-1,j,k))
3259 - facy*(sy(i-1,j-1,k)+sy(i-1,j,k)))
3260 + sol(i+1,j,k)*(Real(2.0)*facx*(sx(i ,j-1,k)+sx(i ,j,k))
3261 - facy*(sy(i ,j-1,k)+sy(i ,j,k)))
3262 + sol(i,j-1,k)*( -facx*(sx(i-1,j-1,k)+sx(i,j-1,k))
3263 +Real(2.0)*facy*(sy(i-1,j-1,k)+sy(i,j-1,k)))
3264 + sol(i,j+1,k)*( -facx*(sx(i-1,j ,k)+sx(i,j ,k))
3265 +Real(2.0)*facy*(sy(i-1,j ,k)+sy(i,j ,k)))
3269 Real fp = facy /
static_cast<Real
>(2*i+1);
3270 Real fm = facy /
static_cast<Real
>(2*i-1);
3271 Real frzlo = fm*sy(i-1,j-1,k)-fp*sy(i,j-1,k);
3272 Real frzhi = fm*sy(i-1,j ,k)-fp*sy(i,j ,k);
3273 s0 += - frzhi - frzlo;
3274 Ax += frzhi*(sol(i,j+1,k)-sol(i,j,k))
3275 + frzlo*(sol(i,j-1,k)-sol(i,j,k));
3278 sol(i,j,k) += (rhs(i,j,k) - Ax) / s0;
3288 bool is_rz) noexcept
3292 sol(i,j,k) = Real(0.0);
3294 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
3295 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
3296 Real fxy = facx + facy;
3297 Real f2xmy = Real(2.0)*facx - facy;
3298 Real fmx2y = Real(2.0)*facy - facx;
3300 Real s0 = (-Real(2.0))*fxy*(sig(i-1,j-1,k)+sig(i,j-1,k)+sig(i-1,j,k)+sig(i,j,k));
3301 Real Ax = sol(i-1,j-1,k)*fxy*sig(i-1,j-1,k)
3302 + sol(i+1,j-1,k)*fxy*sig(i ,j-1,k)
3303 + sol(i-1,j+1,k)*fxy*sig(i-1,j ,k)
3304 + sol(i+1,j+1,k)*fxy*sig(i ,j ,k)
3305 + sol(i-1,j,k)*f2xmy*(sig(i-1,j-1,k)+sig(i-1,j,k))
3306 + sol(i+1,j,k)*f2xmy*(sig(i ,j-1,k)+sig(i ,j,k))
3307 + sol(i,j-1,k)*fmx2y*(sig(i-1,j-1,k)+sig(i,j-1,k))
3308 + sol(i,j+1,k)*fmx2y*(sig(i-1,j ,k)+sig(i,j ,k))
3312 Real fp = facy /
static_cast<Real
>(2*i+1);
3313 Real fm = facy /
static_cast<Real
>(2*i-1);
3314 Real frzlo = fm*sig(i-1,j-1,k)-fp*sig(i,j-1,k);
3315 Real frzhi = fm*sig(i-1,j ,k)-fp*sig(i,j ,k);
3316 s0 += - frzhi - frzlo;
3317 Ax += frzhi*(sol(i,j+1,k)-sol(i,j,k))
3318 + frzlo*(sol(i,j-1,k)-sol(i,j,k));
3321 sol(i,j,k) += (rhs(i,j,k) - Ax) / s0;
3331 bool is_rz) noexcept
3335 sol(i,j,k) = Real(0.0);
3337 Real facx = Real(1.0/6.0)*dxinv[0]*dxinv[0];
3338 Real facy = Real(1.0/6.0)*dxinv[1]*dxinv[1];
3339 Real fxy = facx + facy;
3340 Real f2xmy = Real(2.0)*facx - facy;
3341 Real fmx2y = Real(2.0)*facy - facx;
3343 Real s0 = (-Real(2.0))*fxy*Real(4.);
3344 Real Ax = sol(i-1,j-1,k)*fxy
3345 + sol(i+1,j-1,k)*fxy
3346 + sol(i-1,j+1,k)*fxy
3347 + sol(i+1,j+1,k)*fxy
3348 + sol(i-1,j,k)*f2xmy*Real(2.)
3349 + sol(i+1,j,k)*f2xmy*Real(2.)
3350 + sol(i,j-1,k)*fmx2y*Real(2.)
3351 + sol(i,j+1,k)*fmx2y*Real(2.)
3355 Real fp = facy /
static_cast<Real
>(2*i+1);
3356 Real fm = facy /
static_cast<Real
>(2*i-1);
3359 s0 += - frzhi - frzlo;
3360 Ax += frzhi*(sol(i,j+1,k)-sol(i,j,k))
3361 + frzlo*(sol(i,j-1,k)-sol(i,j,k));
3364 sol(i,j,k) += (rhs(i,j,k) - Ax*sig) / (s0*sig);
3371 Array4<Real const>
const& rhs,
3372 Array4<Real const>
const& sten,
3373 Array4<int const>
const& msk,
int color) noexcept
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_DEVICE
Definition: AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
int idir
Definition: AMReX_HypreMLABecLap.cpp:1093
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
#define AMREX_LOOP_3D(bx, i, j, k, block)
Definition: AMReX_Loop.nolint.H:4
HYPRE_Int Int
Definition: AMReX_HypreNodeLap.H:36
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
static constexpr int i_S_x2
Definition: AMReX_algoim.H:15
static constexpr int i_S_y
Definition: AMReX_algoim.H:13
static constexpr int i_S_x
Definition: AMReX_algoim.H:12
static constexpr int i_B_x
Definition: AMReX_algoim.H:36
static constexpr int i_B_y
Definition: AMReX_algoim.H:37
static constexpr int i_S_y2
Definition: AMReX_algoim.H:16
@ max
Definition: AMReX_ParallelReduce.H:17
constexpr int iy
Definition: AMReX_Interp_2D_C.H:33
constexpr int ix
Definition: AMReX_Interp_2D_C.H:32
constexpr Real almostzero
Definition: AMReX_MLNodeLap_K.H:22
constexpr int crse_cell
Definition: AMReX_MLNodeLinOp_K.H:54
constexpr int crse_fine_node
Definition: AMReX_MLNodeLinOp_K.H:57
constexpr double eps
Definition: AMReX_MLNodeLap_K.H:19
constexpr Real almostone
Definition: AMReX_MLNodeLap_K.H:21
static constexpr int P
Definition: AMReX_OpenBC.H:14
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:52
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:426
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:355
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_Ax_fine_contrib_cs(int i, int j, int, Box const &ndbx, Box const &ccbx, Array4< Real > const &f, Array4< Real const > const &res, Array4< Real const > const &rhs, Array4< Real const > const &phi, Real const sig, Array4< int const > const &msk, bool is_rz, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:1157
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_divu_fine_contrib(int i, int j, int, Box const &fvbx, Box const &velbx, Array4< Real > const &rhs, Array4< Real const > const &vel, Array4< Real const > const &frhs, Array4< int const > const &msk, GpuArray< Real, AMREX_SPACEDIM > const &dxinv, bool is_rz) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:867
BoxND< AMREX_SPACEDIM > Box
Definition: AMReX_BaseFwd.H:27
AMREX_ATTRIBUTE_FLATTEN_FOR void LoopConcurrentOnCpu(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:378
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:225
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:92
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:30
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:408
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_avgdown_coeff_y(int i, int j, int k, Array4< Real > const &crse, Array4< Real const > const &fine) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:36
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:193
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & max(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:35
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:66
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:141
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:125
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:396
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:21
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:233
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:387
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:170
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition: AMReX_GpuComplex.H:356
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:357
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:84
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_sum_Ax(P const &pred, S const &sig, int i, int j, Real facx, Real facy, Array4< Real const > const &phi, bool is_rz) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:1057
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:315
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:332
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:270
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308
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:381
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real aa_interp_line_y(Array4< Real const > const &crse, Array4< Real const > const &sig, int i, int j, int ic, int jc) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:582
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:8
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:37
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real ha_interp_face_xy(Array4< Real const > const &crse, Array4< Real const > const &sigx, Array4< Real const > const &sigy, int i, int j, int ic, int jc) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:694
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:251
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:369
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:284
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:338
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:401
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:479
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > surroundingNodes(const BoxND< dim > &b, int dir) noexcept
Returns a BoxND with NODE based coordinates in direction dir that encloses BoxND b....
Definition: AMReX_Box.H:1399
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE IntVectND< dim > scale(const IntVectND< dim > &p, int s) noexcept
Returns a IntVectND obtained by multiplying each of the components of this IntVectND by s.
Definition: AMReX_IntVect.H:1006
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:448
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:312
AMREX_GPU_HOST_DEVICE AMREX_ATTRIBUTE_FLATTEN_FOR void LoopConcurrent(Dim3 lo, Dim3 hi, F const &f) noexcept
Definition: AMReX_Loop.H:150
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:414
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:458
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_sum_Df(int ii, int jj, Real facx, Real facy, Array4< Real const > const &vel, Box const &velbx, bool is_rz) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:843
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_Ax_fine_contrib_doit(S const &sig, int i, int j, Box const &ndbx, Box const &ccbx, Array4< Real > const &f, Array4< Real const > const &res, Array4< Real const > const &rhs, Array4< Real const > const &phi, Array4< int const > const &msk, bool is_rz, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:1099
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real aa_interp_face_xy(Array4< Real const > const &crse, Array4< Real const > const &sig, int i, int j, int ic, int jc) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:591
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:420
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
const int[]
Definition: AMReX_BLProfiler.cpp:1664
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:349
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:74
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:21
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:203
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:276
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlndlap_Ax_fine_contrib(int i, int j, int, Box const &ndbx, Box const &ccbx, Array4< Real > const &f, Array4< Real const > const &res, Array4< Real const > const &rhs, Array4< Real const > const &phi, Array4< Real const > const &sig, Array4< int const > const &msk, bool is_rz, GpuArray< Real, AMREX_SPACEDIM > const &dxinv) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:1143
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real aa_interp_line_x(Array4< Real const > const &crse, Array4< Real const > const &sig, int i, int j, int ic, int jc) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:573
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:391
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mlndlap_adotx_sten_doit(int i, int j, int k, Array4< Real const > const &x, Array4< Real const > const &sten) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:1507
AMREX_FORCE_INLINE void tridiagonal_solve(Array1D< T, 0, 31 > &a_ls, Array1D< T, 0, 31 > &b_ls, Array1D< T, 0, 31 > &c_ls, Array1D< T, 0, 31 > &r_ls, Array1D< T, 0, 31 > &u_ls, Array1D< T, 0, 31 > &gam, int ilen) noexcept
Definition: AMReX_MLABecLap_3D_K.H:432
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:299
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:322
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex< T > sqrt(const GpuComplex< T > &a_z) noexcept
Return the square root of a complex number.
Definition: AMReX_GpuComplex.H:373
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real neumann_scale(int i, int j, Box const &nddom, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bclo, GpuArray< LinOpBCType, AMREX_SPACEDIM > const &bchi) noexcept
Definition: AMReX_MLNodeLap_2D_K.H:930
Definition: AMReX_Array.H:161
Definition: AMReX_Array4.H:61