8 #ifndef HYDRO_PPM_GODUNOV_H
9 #define HYDRO_PPM_GODUNOV_H
27 const amrex::Real sm1,
29 const amrex::Real sp1,
30 const amrex::Real )
const
33 amrex::Real d1 = sp1 - sm1;
34 amrex::Real d2 = s0 - sm2;
44 const amrex::Real sm1,
46 const amrex::Real sp1,
47 const amrex::Real sp2)
const
49 amrex::Real d1 = sp2 - s0;
50 amrex::Real d2 = sp1 - sm1;
67 const amrex::Real
m_half{amrex::Real(0.5)};
68 const amrex::Real
m_sixth{amrex::Real(1.0)/amrex::Real(6.0)};
76 amrex::Real
vanLeer(
const amrex::Real a,
const amrex::Real b,
const amrex::Real c)
const
78 constexpr amrex::Real small_qty_sq = amrex::Real(1.e-10) * amrex::Real(1.e-10);
80 amrex::Real dsc =
m_half*(b - c);
81 amrex::Real dsl = amrex::Real(amrex::Real(2.0))*(a - c);
82 amrex::Real dsr = amrex::Real(amrex::Real(2.0))*(b - a);
83 return (dsl*dsr > small_qty_sq) ?
84 std::copysign(amrex::Real(amrex::Real(1.0)), dsc)*
amrex::min(amrex::Math::abs(dsc),
amrex::min(amrex::Math::abs(dsl), amrex::Math::abs(dsr))) : amrex::Real(0.0);
90 const amrex::Real sm1,
92 const amrex::Real sp1,
93 const amrex::Real )
const
96 amrex::Real d1 =
vanLeer(s0,sp1,sm1);
97 amrex::Real d2 =
vanLeer(sm1,s0,sm2);
107 const amrex::Real sm1,
108 const amrex::Real s0,
109 const amrex::Real sp1,
110 const amrex::Real sp2)
const
113 amrex::Real d1 =
vanLeer(sp1,sp2,s0);
114 amrex::Real d2 =
vanLeer(s0,sp1,sm1);
134 }
else if (amrex::Math::abs(
sedge2-s0) >= amrex::Real(2.0)*amrex::Math::abs(
sedge1-s0)) {
135 sp_ = amrex::Real(3.0)*s0 - amrex::Real(amrex::Real(2.0))*
sedge1;
136 }
else if (amrex::Math::abs(
sedge1-s0) >= amrex::Real(2.0)*amrex::Math::abs(
sedge2-s0)) {
137 sm_ = amrex::Real(3.0)*s0 - amrex::Real(amrex::Real(2.0))*
sedge2;
158 const amrex::Real
m_half{amrex::Real(0.5)};
159 const amrex::Real
m_sixth{amrex::Real(1.0)/amrex::Real(6.0)};
169 const amrex::Real sm1,
170 const amrex::Real s0,
171 const amrex::Real sp1,
172 const amrex::Real sp2)
const
174 const amrex::Real beta1 =
175 amrex::Real(13.0) / amrex::Real(12.0) * (sm2 - amrex::Real(amrex::Real(2.0)) * sm1 + s0) * (sm2 - amrex::Real(amrex::Real(2.0)) * sm1 + s0) +
176 amrex::Real(0.25) * (sm2 - amrex::Real(4.0) * sm1 + amrex::Real(3.0) * s0) * (sm2 - amrex::Real(4.0) * sm1 + amrex::Real(3.0) * s0);
177 const amrex::Real beta2 =
178 amrex::Real(13.0) / amrex::Real(12.0) * (sm1 - amrex::Real(amrex::Real(2.0)) * s0 + sp1) * (sm1 - amrex::Real(amrex::Real(2.0)) * s0 + sp1) +
179 amrex::Real(0.25) * (sm1 - sp1) * (sm1 - sp1);
180 const amrex::Real beta3 =
181 amrex::Real(13.0) / amrex::Real(12.0) * (s0 - amrex::Real(amrex::Real(2.0)) * sp1 + sp2) * (s0 - amrex::Real(amrex::Real(2.0)) * sp1 + sp2) +
182 amrex::Real(0.25) * (amrex::Real(3.0) * s0 - amrex::Real(4.0) * sp1 + sp2) * (amrex::Real(3.0) * s0 - amrex::Real(4.0) * sp1 + sp2);
184 const amrex::Real t5 = amrex::Math::abs(beta3 - beta1);
185 const amrex::Real omega1 = amrex::Real(0.1) * (amrex::Real(amrex::Real(1.0)) + t5 / (
m_eps + beta1));
186 const amrex::Real omega2 = amrex::Real(0.6) * (amrex::Real(amrex::Real(1.0)) + t5 / (
m_eps + beta2));
187 const amrex::Real omega3 = amrex::Real(0.3) * (amrex::Real(amrex::Real(1.0)) + t5 / (
m_eps + beta3));
189 const amrex::Real omega = omega1 + omega2 + omega3;
191 const amrex::Real v_1 = amrex::Real(amrex::Real(2.0)) * sm2 - amrex::Real(7.0) * sm1 + amrex::Real(11.0) * s0;
192 const amrex::Real v_2 = -sm1 + amrex::Real(5.0) * s0 + amrex::Real(2.0) * sp1;
193 const amrex::Real v_3 = amrex::Real(amrex::Real(2.0)) * s0 + amrex::Real(5.0) * sp1 - sp2;
195 return (omega1 * v_1 + omega2 * v_2 + omega3 * v_3) / (amrex::Real(6.0) * omega);
201 const amrex::Real sm1,
202 const amrex::Real s0,
203 const amrex::Real sp1,
204 const amrex::Real sp2)
const
206 return sedge2(sp2,sp1,s0,sm1,sm2);
218 amrex::Real
m_eps{amrex::Real(1.0e-6)};
223 void SetXBCs (
const int i,
const int j,
const int k,
const int n,
224 amrex::Real &sm, amrex::Real &sp,
225 amrex::Real &sedge1, amrex::Real &sedge2,
227 const int bclo,
const int bchi,
228 const int domlo,
const int domhi)
230 using namespace amrex;
232 if (bclo == BCType::ext_dir || bclo == BCType::hoextrap)
236 sedge2 = -amrex::Real(0.2)*s(domlo-1,j,k,n) + amrex::Real(0.75)*s(domlo,j, k, n)
237 +amrex::Real(amrex::Real(0.5))*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n);
241 sm = s(domlo-1,j,k,n);
244 }
else if (i == domlo+1) {
246 sedge1 = -amrex::Real(0.2)*s(domlo-1,j,k,n) + amrex::Real(0.75)*s(domlo ,j,k,n)
247 + amrex::Real(amrex::Real(0.5))*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n);
254 if ( (sp - s(domlo+1,j,k,n))*(s(domlo+1,j,k,n) - sm) <= amrex::Real(0.0))
256 sp = s(domlo+1,j,k,n);
257 sm = s(domlo+1,j,k,n);
259 else if(amrex::Math::abs(sp - s(domlo+1,j,k,n)) >= amrex::Real(amrex::Real(2.0))*amrex::Math::abs(sm - s(domlo+1,j,k,n)))
260 sp = amrex::Real(3.0)*s(domlo+1,j,k,n) - amrex::Real(amrex::Real(2.0))*sm;
261 else if(amrex::Math::abs(sm - s(domlo+1,j,k,n)) >= amrex::Real(amrex::Real(2.0))*amrex::Math::abs(sp - s(domlo+1,j,k,n)))
262 sm = amrex::Real(3.0)*s(domlo+1,j,k,n) - amrex::Real(amrex::Real(2.0))*sp;
266 if (bchi == BCType::ext_dir || bchi == BCType::hoextrap)
270 sedge1 = -amrex::Real(0.2)*s(domhi+1,j,k,n) + amrex::Real(0.75)*s(domhi,j,k, n)
271 +amrex::Real(amrex::Real(0.5))*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n);
275 sp = s(domhi+1,j,k,n);
278 }
else if (i == domhi-1) {
280 sedge2 = -amrex::Real(0.2)*s(domhi+1,j,k,n) + amrex::Real(0.75)*s(domhi ,j,k,n)
281 +amrex::Real(amrex::Real(0.5))*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n);
288 if( (sp - s(domhi-1,j,k,n))*(s(domhi-1,j,k,n) - sm) <= amrex::Real(0.0))
290 sp = s(domhi-1,j,k,n);
291 sm = s(domhi-1,j,k,n);
293 else if(amrex::Math::abs(sp - s(domhi-1,j,k,n)) >= 2.*amrex::Math::abs(sm - s(domhi-1,j,k,n)))
294 sp = amrex::Real(3.0)*s(domhi-1,j,k,n) - amrex::Real(amrex::Real(2.0))*sm;
295 else if(amrex::Math::abs(sm - s(domhi-1,j,k,n)) >= 2.*amrex::Math::abs(sp - s(domhi-1,j,k,n)))
296 sm = amrex::Real(3.0)*s(domhi-1,j,k,n) - amrex::Real(amrex::Real(2.0))*sp;
302 void SetYBCs (
const int i,
const int j,
const int k,
const int n,
303 amrex::Real &sm, amrex::Real &sp,
304 amrex::Real &sedge1, amrex::Real &sedge2,
306 const int bclo,
const int bchi,
307 const int domlo,
const int domhi)
309 using namespace amrex;
311 if (bclo == BCType::ext_dir || bclo == BCType::hoextrap)
315 sedge2 = -amrex::Real(0.2)*s(i,domlo-1,k,n) + amrex::Real(0.75)*s(i,domlo ,k,n)
316 +amrex::Real(amrex::Real(0.5))*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n);
320 sm = s(i,domlo-1,k,n);
323 }
else if (j == domlo+1) {
325 sedge1 = -amrex::Real(0.2)*s(i,domlo-1,k,n) + amrex::Real(0.75)*s(i,domlo ,k,n)
326 +amrex::Real(amrex::Real(0.5))*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n);
333 if ( (sp - s(i,domlo+1,k,n))*(s(i,domlo+1,k,n) - sm) <= amrex::Real(0.0))
335 sp = s(i,domlo+1,k,n);
336 sm = s(i,domlo+1,k,n);
338 else if(amrex::Math::abs(sp - s(i,domlo+1,k,n)) >= amrex::Real(amrex::Real(2.0))*amrex::Math::abs(sm - s(i,domlo+1,k,n)))
339 sp = amrex::Real(3.0)*s(i,domlo+1,k,n) - amrex::Real(amrex::Real(2.0))*sm;
340 else if(amrex::Math::abs(sm - s(i,domlo+1,k,n)) >= amrex::Real(amrex::Real(2.0))*amrex::Math::abs(sp - s(i,domlo+1,k,n)))
341 sm = amrex::Real(3.0)*s(i,domlo+1,k,n) - amrex::Real(amrex::Real(2.0))*sp;
345 if (bchi == BCType::ext_dir || bchi == BCType::hoextrap)
349 sedge1 = -amrex::Real(0.2)*s(i,domhi+1,k,n) + amrex::Real(0.75)*s(i,domhi ,k,n)
350 +amrex::Real(amrex::Real(0.5))*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n);
354 sp = s(i,domhi+1,k, n);
357 }
else if (j == domhi-1) {
359 sedge2 = -amrex::Real(0.2)*s(i,domhi+1,k,n) + amrex::Real(0.75)*s(i,domhi ,k,n)
360 +amrex::Real(amrex::Real(0.5))*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n);
367 if( (sp - s(i,domhi-1,k,n))*(s(i,domhi-1,k,n) - sm) <= amrex::Real(0.0)){
368 sp = s(i,domhi-1,k,n);
369 sm = s(i,domhi-1,k,n);
371 else if(amrex::Math::abs(sp - s(i,domhi-1,k,n)) >= 2.*amrex::Math::abs(sm - s(i,domhi-1,k,n)))
372 sp = amrex::Real(3.0)*s(i,domhi-1,k,n) - amrex::Real(amrex::Real(2.0))*sm;
374 else if(amrex::Math::abs(sm - s(i,domhi-1,k,n)) >= 2.*amrex::Math::abs(sp - s(i,domhi-1,k,n)))
375 sm = amrex::Real(3.0)*s(i,domhi-1,k,n) - amrex::Real(amrex::Real(2.0))*sp;
380 #if (AMREX_SPACEDIM==3)
382 void SetZBCs (
const int i,
const int j,
const int k,
const int n,
383 amrex::Real &sm, amrex::Real &sp,
384 amrex::Real &sedge1, amrex::Real &sedge2,
386 const int bclo,
const int bchi,
387 const int domlo,
const int domhi)
389 using namespace amrex;
391 if (bclo == BCType::ext_dir || bclo == BCType::hoextrap)
396 sedge2 = -amrex::Real(0.2)*s(i,j,domlo-1,n) + amrex::Real(0.75)*s(i,j,domlo ,n)
397 +amrex::Real(amrex::Real(0.5))*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n);
401 sm = s(i,j,domlo-1,n);
404 }
else if (k == domlo+1) {
406 sedge1 = -amrex::Real(0.2)*s(i,j,domlo-1,n) + amrex::Real(0.75)*s(i,j,domlo ,n)
407 +amrex::Real(amrex::Real(0.5))*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n);
414 if ( (sp - s(i,j,domlo+1,n))*(s(i,j,domlo+1,n) - sm) <= 0. )
416 sp = s(i,j,domlo+1,n);
417 sm = s(i,j,domlo+1,n);
419 else if(amrex::Math::abs(sp - s(i,j,domlo+1,n)) >= 2.*amrex::Math::abs(sm - s(i,j,domlo+1,n)))
420 sp = amrex::Real(3.0)*s(i,j,domlo+1,n) - amrex::Real(amrex::Real(2.0))*sm;
422 else if(amrex::Math::abs(sm - s(i,j,domlo+1,n)) >= 2.*amrex::Math::abs(sp - s(i,j,domlo+1,n)))
423 sm = amrex::Real(3.0)*s(i,j,domlo+1,n) - amrex::Real(amrex::Real(2.0))*sp;
427 if (bchi == BCType::ext_dir || bchi == BCType::hoextrap)
431 sedge1 = -amrex::Real(0.2)*s(i,j,domhi+1,n) + amrex::Real(0.75)*s(i,j,domhi ,n)
432 +amrex::Real(amrex::Real(0.5))*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n);
436 sp = s(i,j,domhi+1,n);
439 }
else if (k == domhi-1) {
441 sedge2 = -amrex::Real(0.2)*s(i,j,domhi+1,n) + amrex::Real(0.75)*s(i,j,domhi ,n)
442 +amrex::Real(amrex::Real(0.5))*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n);
449 if ( (sp - s(i,j,domhi-1,n))*(s(i,j,domhi-1,n) - sm) <= 0. )
451 sp = s(i,j,domhi-1,n);
452 sm = s(i,j,domhi-1,n);
454 else if(amrex::Math::abs(sp - s(i,j,domhi-1,n)) >= 2.*amrex::Math::abs(sm - s(i,j,domhi-1,n)))
455 sp = amrex::Real(3.0)*s(i,j,domhi-1,n) - amrex::Real(amrex::Real(2.0))*sm;
457 else if(amrex::Math::abs(sm - s(i,j,domhi-1,n)) >= 2.*amrex::Math::abs(sp - s(i,j,domhi-1,n)))
458 sm = amrex::Real(3.0)*s(i,j,domhi-1,n) - amrex::Real(amrex::Real(2.0))*sp;
469 template <
typename Limiter>
472 const amrex::Real dtdx,
const amrex::Real v_ad,
476 const amrex::BCRec bc,
const int domlo,
const int domhi,
477 const Limiter& limiter)
479 constexpr amrex::Real m_half{amrex::Real(0.5)};
480 constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)};
482 amrex::Real sm2 = S(i-2,j,k,n);
483 amrex::Real sm1 = S(i-1,j,k,n);
484 amrex::Real s0 = S(i ,j,k,n);
485 amrex::Real sp1 = S(i+1,j,k,n);
486 amrex::Real sp2 = S(i+2,j,k,n);
488 amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2);
489 amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2);
492 amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2);
494 SetXBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.
lo(0), bc.
hi(0), domlo, domhi);
496 amrex::Real s6 = amrex::Real(6.0)*s0 - amrex::Real(3.0)*(sm + sp);
498 amrex::Real sigma = amrex::Math::abs(v_ad)*dtdx;
502 Ip(i,j,k,n) = sp - (m_half*sigma)*((sp-sm) - (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigma)*s6);
503 Im(i,j,k,n) = S(i,j,k,n);
507 Ip(i,j,k,n) = S(i,j,k,n);
508 Im(i,j,k,n) = sm + (m_half*sigma)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigma)*s6);
511 Ip(i,j,k,n) = S(i,j,k,n);
512 Im(i,j,k,n) = S(i,j,k,n);
516 template <
typename Limiter>
519 const amrex::Real dtdy,
const amrex::Real v_ad,
523 const amrex::BCRec bc,
const int domlo,
const int domhi,
524 const Limiter& limiter)
526 constexpr amrex::Real m_half{amrex::Real(0.5)};
527 constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)};
529 amrex::Real sm2 = S(i,j-2,k,n);
530 amrex::Real sm1 = S(i,j-1,k,n);
531 amrex::Real s0 = S(i,j ,k,n);
532 amrex::Real sp1 = S(i,j+1,k,n);
533 amrex::Real sp2 = S(i,j+2,k,n);
535 amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2);
536 amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2);
539 amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2);
541 SetYBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.
lo(1), bc.
hi(1), domlo, domhi);
543 amrex::Real s6 = amrex::Real(6.0)*s0 - amrex::Real(3.0)*(sm + sp);
545 amrex::Real sigma = amrex::Math::abs(v_ad)*dtdy;
549 Ip(i,j,k,n) = sp - (m_half*sigma)*((sp-sm) - (amrex::Real(1.0) - m_two3rds*sigma)*s6);
550 Im(i,j,k,n) = S(i,j,k,n);
554 Ip(i,j,k,n) = S(i,j,k,n);
555 Im(i,j,k,n) = sm + (m_half*sigma)*((sp-sm) + (amrex::Real(1.0) - m_two3rds*sigma)*s6);
558 Ip(i,j,k,n) = S(i,j,k,n);
559 Im(i,j,k,n) = S(i,j,k,n);
563 #if (AMREX_SPACEDIM==3)
564 template <
typename Limiter>
566 void PredictVelOnZFace (
const int i,
const int j,
const int k,
const int n,
567 const amrex::Real dtdz,
const amrex::Real v_ad,
571 const amrex::BCRec bc,
const int domlo,
const int domhi,
572 const Limiter& limiter)
574 constexpr amrex::Real m_half{amrex::Real(0.5)};
575 constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)};
577 amrex::Real sm2 = S(i,j,k-2,n);
578 amrex::Real sm1 = S(i,j,k-1,n);
579 amrex::Real s0 = S(i,j,k ,n);
580 amrex::Real sp1 = S(i,j,k+1,n);
581 amrex::Real sp2 = S(i,j,k+2,n);
583 amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2);
584 amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2);
587 amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2);
589 SetZBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.
lo(2), bc.
hi(2), domlo, domhi);
591 amrex::Real s6 = amrex::Real(6.0)*s0 - amrex::Real(3.0)*(sm + sp);
593 amrex::Real sigma = amrex::Math::abs(v_ad)*dtdz;
597 Ip(i,j,k,n) = sp - (m_half*sigma)*((sp-sm) - (amrex::Real(1.0) - m_two3rds*sigma)*s6);
598 Im(i,j,k,n) = S(i,j,k,n);
602 Ip(i,j,k,n) = S(i,j,k,n);
603 Im(i,j,k,n) = sm + (m_half*sigma)*((sp-sm) + (amrex::Real(1.0) - m_two3rds*sigma)*s6);
606 Ip(i,j,k,n) = S(i,j,k,n);
607 Im(i,j,k,n) = S(i,j,k,n);
616 template <
typename Limiter>
619 const amrex::Real dt,
const amrex::Real dx,
620 amrex::Real& Im, amrex::Real& Ip,
624 const int domlo,
const int domhi,
625 const Limiter& limiter)
628 using namespace amrex;
630 constexpr amrex::Real m_half{amrex::Real(0.5)};
631 constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)};
633 amrex::Real sm2 = S(i-2,j,k,n);
634 amrex::Real sm1 = S(i-1,j,k,n);
635 amrex::Real s0 = S(i ,j,k,n);
636 amrex::Real sp1 = S(i+1,j,k,n);
637 amrex::Real sp2 = S(i+2,j,k,n);
639 amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2);
640 amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2);
643 amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2);
645 SetXBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.
lo(0), bc.
hi(0), domlo, domhi);
647 amrex::Real s6 = 6.0*s0 - 3.0*(sm + sp);
649 amrex::Real sigmap = amrex::Math::abs(vel_edge(i+1,j,k))*dt/dx;
650 amrex::Real sigmam = amrex::Math::abs(vel_edge(i ,j,k))*dt/dx;
653 Ip = sp - (m_half*sigmap)*((sp - sm) - (amrex::Real(amrex::Real(1.0)) -m_two3rds*sigmap)*s6);
658 Im = sm + (m_half*sigmam)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigmam)*s6);
663 template <
typename Limiter>
667 const amrex::Real dt,
const amrex::Real dx,
668 amrex::Real& Im, amrex::Real& Ip,
672 const int domlo,
const int domhi,
673 const Limiter& limiter)
676 using namespace amrex;
678 constexpr amrex::Real m_half{amrex::Real(0.5)};
679 constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)};
681 amrex::Real sm2 = S(i,j-2,k,n);
682 amrex::Real sm1 = S(i,j-1,k,n);
683 amrex::Real s0 = S(i,j ,k,n);
684 amrex::Real sp1 = S(i,j+1,k,n);
685 amrex::Real sp2 = S(i,j+2,k,n);
687 amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2);
688 amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2);
691 amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2);
693 SetYBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.
lo(1), bc.
hi(1), domlo, domhi);
695 amrex::Real s6 = 6.0*s0- 3.0*(sm + sp);
697 amrex::Real sigmap = amrex::Math::abs(vel_edge(i,j+1,k))*dt/dx;
698 amrex::Real sigmam = amrex::Math::abs(vel_edge(i,j ,k))*dt/dx;
701 Ip = sp - (m_half*sigmap)*((sp - sm) - (amrex::Real(amrex::Real(1.0)) -m_two3rds*sigmap)*s6);
706 Im = sm + (m_half*sigmam)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigmam)*s6);
713 #if (AMREX_SPACEDIM==3)
714 template <
typename Limiter>
716 void PredictStateOnZFace (
const int i,
const int j,
const int k,
const int n,
717 const amrex::Real dt,
const amrex::Real dx,
718 amrex::Real& Im, amrex::Real& Ip,
722 const int domlo,
const int domhi,
723 const Limiter& limiter)
726 using namespace amrex;
728 constexpr amrex::Real m_half{amrex::Real(0.5)};
729 constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)};
731 amrex::Real sm2 = S(i,j,k-2,n);
732 amrex::Real sm1 = S(i,j,k-1,n);
733 amrex::Real s0 = S(i,j,k ,n);
734 amrex::Real sp1 = S(i,j,k+1,n);
735 amrex::Real sp2 = S(i,j,k+2,n);
737 amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2);
738 amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2);
741 amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2);
743 SetZBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.
lo(2), bc.
hi(2), domlo, domhi);
745 amrex::Real s6 = 6.0*s0- 3.0*(sm + sp);
746 amrex::Real sigmap = amrex::Math::abs(vel_edge(i,j,k+1))*dt/dx;
747 amrex::Real sigmam = amrex::Math::abs(vel_edge(i,j,k ))*dt/dx;
750 Ip = sp - (m_half*sigmap)*((sp-sm) - (amrex::Real(amrex::Real(1.0)) -m_two3rds*sigmap)*s6);
755 Im = sm + (m_half*sigmam)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigmam)*s6);
762 template <
typename Limiter>
775 const Limiter& limiter)
783 amrex::Real l_dtdy = dt / dx[1];,
784 amrex::Real l_dtdz = dt / dx[2];);
789 PredictVelOnXFace(i,j,k,n,l_dtdx,vel(i,j,k,0),q,Imx,Ipx,pbc[n],dlo.
x,dhi.
x,limiter);
790 PredictVelOnYFace(i,j,k,n,l_dtdy,vel(i,j,k,1),q,Imy,Ipy,pbc[n],dlo.
y,dhi.
y,limiter);
791 #if (AMREX_SPACEDIM==3)
792 PredictVelOnZFace(i,j,k,n,l_dtdz,vel(i,j,k,2),q,Imz,Ipz,pbc[n],dlo.
z,dhi.
z,limiter);
797 template <
typename Limiter>
813 const Limiter& limiter)
826 PPM::PredictStateOnXFace(i, j, k, n, l_dt, dx, Imx(i,j,k,n), Ipx(i,j,k,n),
827 q, umac, pbc[n], dlo.
x, dhi.
x,limiter);
828 PPM::PredictStateOnYFace(i, j, k, n, l_dt, dy, Imy(i,j,k,n), Ipy(i,j,k,n),
829 q, vmac, pbc[n], dlo.
y, dhi.
y,limiter);
830 #if (AMREX_SPACEDIM==3)
831 PPM::PredictStateOnZFace(i, j, k, n, l_dt, dz, Imz(i,j,k,n), Ipz(i,j,k,n),
832 q, wmac, pbc[n], dlo.
z, dhi.
z,limiter);
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define AMREX_D_TERM(a, b, c)
#define AMREX_D_DECL(a, b, c)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const int * hi() const &noexcept
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE const int * lo() const &noexcept
GpuArray< Real, AMREX_SPACEDIM > CellSizeArray() const noexcept
const Real * CellSize() const noexcept
const Box & Domain() const noexcept
static constexpr amrex::Real small_vel
Definition: hydro_constants.H:37
Definition: hydro_godunov_ppm.H:15
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PredictVelOnXFace(const int i, const int j, const int k, const int n, const amrex::Real dtdx, const amrex::Real v_ad, const amrex::Array4< const amrex::Real > &S, const amrex::Array4< amrex::Real > &Im, const amrex::Array4< amrex::Real > &Ip, const amrex::BCRec bc, const int domlo, const int domhi, const Limiter &limiter)
Definition: hydro_godunov_ppm.H:471
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PredictStateOnXFace(const int i, const int j, const int k, const int n, const amrex::Real dt, const amrex::Real dx, amrex::Real &Im, amrex::Real &Ip, const amrex::Array4< const amrex::Real > &S, const amrex::Array4< const amrex::Real > &vel_edge, const amrex::BCRec bc, const int domlo, const int domhi, const Limiter &limiter)
Definition: hydro_godunov_ppm.H:618
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetYBCs(const int i, const int j, const int k, const int n, amrex::Real &sm, amrex::Real &sp, amrex::Real &sedge1, amrex::Real &sedge2, const amrex::Array4< const amrex::Real > &s, const int bclo, const int bchi, const int domlo, const int domhi)
Definition: hydro_godunov_ppm.H:302
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PredictVelOnYFace(const int i, const int j, const int k, const int n, const amrex::Real dtdy, const amrex::Real v_ad, const amrex::Array4< const amrex::Real > &S, const amrex::Array4< amrex::Real > &Im, const amrex::Array4< amrex::Real > &Ip, const amrex::BCRec bc, const int domlo, const int domhi, const Limiter &limiter)
Definition: hydro_godunov_ppm.H:518
void PredictStateOnFaces(amrex::Box const &bx, AMREX_D_DECL(amrex::Array4< amrex::Real > const &Imx, amrex::Array4< amrex::Real > const &Imy, amrex::Array4< amrex::Real > const &Imz), AMREX_D_DECL(amrex::Array4< amrex::Real > const &Ipx, amrex::Array4< amrex::Real > const &Ipy, amrex::Array4< amrex::Real > const &Ipz), AMREX_D_DECL(amrex::Array4< amrex::Real const > const &umac, amrex::Array4< amrex::Real const > const &vmac, amrex::Array4< amrex::Real const > const &wmac), amrex::Array4< amrex::Real const > const &q, amrex::Geometry geom, amrex::Real l_dt, amrex::BCRec const *pbc, const int ncomp, const Limiter &limiter)
Definition: hydro_godunov_ppm.H:798
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetXBCs(const int i, const int j, const int k, const int n, amrex::Real &sm, amrex::Real &sp, amrex::Real &sedge1, amrex::Real &sedge2, const amrex::Array4< const amrex::Real > &s, const int bclo, const int bchi, const int domlo, const int domhi)
Definition: hydro_godunov_ppm.H:223
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void PredictStateOnYFace(const int i, const int j, const int k, const int n, const amrex::Real dt, const amrex::Real dx, amrex::Real &Im, amrex::Real &Ip, const amrex::Array4< const amrex::Real > &S, const amrex::Array4< const amrex::Real > &vel_edge, const amrex::BCRec bc, const int domlo, const int domhi, const Limiter &limiter)
Definition: hydro_godunov_ppm.H:666
void PredictVelOnFaces(amrex::Box const &bx, AMREX_D_DECL(amrex::Array4< amrex::Real > const &Imx, amrex::Array4< amrex::Real > const &Imy, amrex::Array4< amrex::Real > const &Imz), AMREX_D_DECL(amrex::Array4< amrex::Real > const &Ipx, amrex::Array4< amrex::Real > const &Ipy, amrex::Array4< amrex::Real > const &Ipz), amrex::Array4< amrex::Real const > const &q, amrex::Array4< amrex::Real const > const &vel, amrex::Geometry geom, amrex::Real dt, amrex::BCRec const *pbc, const Limiter &limiter)
Definition: hydro_godunov_ppm.H:763
limiters
Definition: hydro_godunov_ppm.H:17
@ VanLeer
Definition: hydro_godunov_ppm.H:17
@ WENOZ
Definition: hydro_godunov_ppm.H:17
@ NoLimiter
Definition: hydro_godunov_ppm.H:17
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & max(const T &a, const T &b) noexcept
constexpr AMREX_GPU_HOST_DEVICE GpuTuple< Args &... > Tie(Args &... args) noexcept
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
constexpr AMREX_GPU_HOST_DEVICE GpuTuple< detail::tuple_decay_t< Ts >... > makeTuple(Ts &&... args)
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 ubound(Array4< T > const &a) noexcept
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Dim3 lbound(Array4< T > const &a) noexcept
std::enable_if_t< std::is_integral< T >::value > ParallelFor(TypeList< CTOs... >, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition: hydro_godunov_ppm.H:19
const amrex::Real m_sixth
Definition: hydro_godunov_ppm.H:68
const amrex::Real m_half
Definition: hydro_godunov_ppm.H:67
static AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::GpuTuple< amrex::Real, amrex::Real > sm_sp(const amrex::Real, const amrex::Real sedge1, const amrex::Real sedge2)
Definition: hydro_godunov_ppm.H:60
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sedge2(const amrex::Real, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, const amrex::Real sp2) const
Definition: hydro_godunov_ppm.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sedge1(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, const amrex::Real) const
Definition: hydro_godunov_ppm.H:26
Definition: hydro_godunov_ppm.H:71
const amrex::Real m_sixth
Definition: hydro_godunov_ppm.H:159
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sedge1(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, const amrex::Real) const
Definition: hydro_godunov_ppm.H:89
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real vanLeer(const amrex::Real a, const amrex::Real b, const amrex::Real c) const
Definition: hydro_godunov_ppm.H:76
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sedge2(const amrex::Real, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, const amrex::Real sp2) const
Definition: hydro_godunov_ppm.H:106
static AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::GpuTuple< amrex::Real, amrex::Real > sm_sp(const amrex::Real s0, const amrex::Real sedge1, const amrex::Real sedge2)
Definition: hydro_godunov_ppm.H:124
const amrex::Real m_half
Definition: hydro_godunov_ppm.H:158
Definition: hydro_godunov_ppm.H:162
amrex::Real m_eps
Definition: hydro_godunov_ppm.H:218
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sedge2(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, const amrex::Real sp2) const
Definition: hydro_godunov_ppm.H:168
static AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::GpuTuple< amrex::Real, amrex::Real > sm_sp(const amrex::Real, const amrex::Real sedge1, const amrex::Real sedge2)
Definition: hydro_godunov_ppm.H:211
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real sedge1(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, const amrex::Real sp2) const
Definition: hydro_godunov_ppm.H:200