diff --git a/Godunov/hydro_godunov_ppm.H b/Godunov/hydro_godunov_ppm.H index 1d30e8cb4..7089a88c4 100644 --- a/Godunov/hydro_godunov_ppm.H +++ b/Godunov/hydro_godunov_ppm.H @@ -20,109 +20,100 @@ static constexpr int default_limiter = VanLeer; struct nolimiter { - explicit nolimiter() = default; - - [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real + static amrex::Real sedge1(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, - const amrex::Real /*sp2*/) const + const amrex::Real /*sp2*/) { - amrex::Real d1 = sp1 - sm1; - amrex::Real d2 = s0 - sm2; + amrex::Real d1 = amrex::Real(0.5) * (sp1 - sm1); + amrex::Real d2 = amrex::Real(0.5) * (s0 - sm2); - amrex::Real sedge = m_half*(s0 + sm1) - m_sixth*(d1 - d2); - return amrex::min(amrex::max(sedge, amrex::min(s0, sm1)),amrex::max(s0,sm1)); + amrex::Real sedge = amrex::Real(0.5)*(s0 + sm1) - amrex::Real(1./6.)*(d1 - d2); + return sedge; } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real + static amrex::Real sedge2(const amrex::Real /*sm2*/, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, - const amrex::Real sp2) const + const amrex::Real sp2) { - amrex::Real d1 = sp2 - s0; - amrex::Real d2 = sp1 - sm1; - - amrex::Real sedge = m_half*(sp1 + s0) - m_sixth*(d1 - d2); - return amrex::min(amrex::max(sedge, amrex::min(s0, sp1)),amrex::max(s0,sp1)); - + amrex::Real d1 = amrex::Real(0.5) * (sp2 - s0); + amrex::Real d2 = amrex::Real(0.5) * (sp1 - sm1); + amrex::Real sedge = amrex::Real(0.5)*(sp1 + s0) - amrex::Real(1./6.)*(d1 - d2); + return sedge; } - [[nodiscard]] AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE - amrex::GpuTuple + [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::GpuTuple sm_sp(const amrex::Real /*s0*/, const amrex::Real sedge1, const amrex::Real sedge2) { return amrex::makeTuple(sedge1, sedge2); } - - const amrex::Real m_half{amrex::Real(0.5)}; - const amrex::Real m_sixth{amrex::Real(1.0)/amrex::Real(6.0)}; }; struct vanleer { - explicit vanleer() = default; - [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real vanLeer(const amrex::Real a, const amrex::Real b, const amrex::Real c) const + static amrex::Real vanLeer(const amrex::Real a, const amrex::Real b, const amrex::Real c) { - constexpr amrex::Real small_qty_sq = amrex::Real(1.e-10) * amrex::Real(1.e-10); + constexpr auto small_qty_sq = amrex::Real(1.e-10) * amrex::Real(1.e-10); - amrex::Real dsc = m_half*(b - c); - amrex::Real dsl = amrex::Real(amrex::Real(2.0))*(a - c); - amrex::Real dsr = amrex::Real(amrex::Real(2.0))*(b - a); + amrex::Real dsc = amrex::Real(0.5)*(b - c); + amrex::Real dsl = amrex::Real(2.0)*(a - c); + amrex::Real dsr = amrex::Real(2.0)*(b - a); return (dsl*dsr > small_qty_sq) ? - 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); + std::copysign(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); } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real + static amrex::Real sedge1(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, - const amrex::Real /*sp2*/) const + const amrex::Real /*sp2*/) { amrex::Real d1 = vanLeer(s0,sp1,sm1); amrex::Real d2 = vanLeer(sm1,s0,sm2); - amrex::Real sedge = m_half*(s0 + sm1) - m_sixth*(d1 - d2); + amrex::Real sedge = amrex::Real(0.5)*(s0 + sm1) - amrex::Real(1./6.)*(d1 - d2); return amrex::min(amrex::max(sedge, amrex::min(s0, sm1)),amrex::max(s0,sm1)); } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real + static amrex::Real sedge2(const amrex::Real /*sm2*/, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, - const amrex::Real sp2) const + const amrex::Real sp2) { amrex::Real d1 = vanLeer(sp1,sp2,s0); amrex::Real d2 = vanLeer(s0,sp1,sm1); - amrex::Real sedge = m_half*(sp1 + s0) - m_sixth*(d1 - d2); + amrex::Real sedge = amrex::Real(0.5)*(sp1 + s0) - amrex::Real(1./6.)*(d1 - d2); return amrex::min(amrex::max(sedge, amrex::min(s0, sp1)),amrex::max(s0,sp1)); } - [[nodiscard]] AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE - amrex::GpuTuple + [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::GpuTuple sm_sp(const amrex::Real s0, const amrex::Real sedge1, const amrex::Real sedge2) @@ -134,9 +125,9 @@ struct vanleer { sm_ = s0; sp_ = s0; } else if (amrex::Math::abs(sedge2-s0) >= amrex::Real(2.0)*amrex::Math::abs(sedge1-s0)) { - sp_ = amrex::Real(3.0)*s0 - amrex::Real(amrex::Real(2.0))*sedge1; + sp_ = amrex::Real(3.0)*s0 - amrex::Real(2.0)*sedge1; } else if (amrex::Math::abs(sedge1-s0) >= amrex::Real(2.0)*amrex::Math::abs(sedge2-s0)) { - sm_ = amrex::Real(3.0)*s0 - amrex::Real(amrex::Real(2.0))*sedge2; + sm_ = amrex::Real(3.0)*s0 - amrex::Real(2.0)*sedge2; } return amrex::makeTuple(sm_,sp_); @@ -147,80 +138,76 @@ struct vanleer { // } // amrex::Real sm_ = sedge1; // amrex::Real sp_ = sedge2; -// if (amrex::Math::abs(sedge2-s0) >= amrex::Real(amrex::Real(2.0))*amrex::Math::abs(sedge1-s0)) { -// sp_ = amrex::Real(3.0)*s0 - amrex::Real(amrex::Real(2.0))*sedge1; +// if (amrex::Math::abs(sedge2-s0) >= amrex::Real(2.0)*amrex::Math::abs(sedge1-s0)) { +// sp_ = amrex::Real(3.0)*s0 - amrex::Real(2.0)*sedge1; // } -// if (amrex::Math::abs(sedge1-s0) >= amrex::Real(amrex::Real(2.0))*amrex::Math::abs(sedge2-s0)) { -// sm_ = amrex::Real(3.0)*s0 - amrex::Real(amrex::Real(2.0))*sedge2; +// if (amrex::Math::abs(sedge1-s0) >= amrex::Real(2.0)*amrex::Math::abs(sedge2-s0)) { +// sm_ = amrex::Real(3.0)*s0 - amrex::Real(2.0)*sedge2; // } // return amrex::makeTuple(sm_,sp_); } - - const amrex::Real m_half{amrex::Real(0.5)}; - const amrex::Real m_sixth{amrex::Real(1.0)/amrex::Real(6.0)}; }; struct wenoz { - explicit wenoz()= default; - [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real + static amrex::Real sedge2(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, - const amrex::Real sp2) const + const amrex::Real sp2) { + constexpr auto eps = amrex::Real(1.0e-6); + const amrex::Real beta1 = - 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) + + amrex::Real(13.0) / amrex::Real(12.0) * (sm2 - amrex::Real(2.0) * sm1 + s0) * (sm2 - amrex::Real(2.0) * sm1 + s0) + 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); const amrex::Real beta2 = - 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) + + amrex::Real(13.0) / amrex::Real(12.0) * (sm1 - amrex::Real(2.0) * s0 + sp1) * (sm1 - amrex::Real(2.0) * s0 + sp1) + amrex::Real(0.25) * (sm1 - sp1) * (sm1 - sp1); const amrex::Real beta3 = - 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) + + amrex::Real(13.0) / amrex::Real(12.0) * (s0 - amrex::Real(2.0) * sp1 + sp2) * (s0 - amrex::Real(2.0) * sp1 + sp2) + 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); const amrex::Real t5 = amrex::Math::abs(beta3 - beta1); - const amrex::Real omega1 = amrex::Real(0.1) * (amrex::Real(amrex::Real(1.0)) + t5 / (m_eps + beta1)); - const amrex::Real omega2 = amrex::Real(0.6) * (amrex::Real(amrex::Real(1.0)) + t5 / (m_eps + beta2)); - const amrex::Real omega3 = amrex::Real(0.3) * (amrex::Real(amrex::Real(1.0)) + t5 / (m_eps + beta3)); + const amrex::Real omega1 = amrex::Real(0.1) * (amrex::Real(1.0) + t5 / (eps + beta1)); + const amrex::Real omega2 = amrex::Real(0.6) * (amrex::Real(1.0) + t5 / (eps + beta2)); + const amrex::Real omega3 = amrex::Real(0.3) * (amrex::Real(1.0) + t5 / (eps + beta3)); const amrex::Real omega = omega1 + omega2 + omega3; - const amrex::Real v_1 = amrex::Real(amrex::Real(2.0)) * sm2 - amrex::Real(7.0) * sm1 + amrex::Real(11.0) * s0; + const amrex::Real v_1 = amrex::Real(2.0) * sm2 - amrex::Real(7.0) * sm1 + amrex::Real(11.0) * s0; const amrex::Real v_2 = -sm1 + amrex::Real(5.0) * s0 + amrex::Real(2.0) * sp1; - const amrex::Real v_3 = amrex::Real(amrex::Real(2.0)) * s0 + amrex::Real(5.0) * sp1 - sp2; + const amrex::Real v_3 = amrex::Real(2.0) * s0 + amrex::Real(5.0) * sp1 - sp2; return (omega1 * v_1 + omega2 * v_2 + omega3 * v_3) / (amrex::Real(6.0) * omega); } [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE - amrex::Real + static amrex::Real sedge1(const amrex::Real sm2, const amrex::Real sm1, const amrex::Real s0, const amrex::Real sp1, - const amrex::Real sp2) const + const amrex::Real sp2) { return sedge2(sp2,sp1,s0,sm1,sm2); // NOLINT(readability-suspicious-call-argument) } - [[nodiscard]] AMREX_GPU_HOST_DEVICE static AMREX_FORCE_INLINE - amrex::GpuTuple + [[nodiscard]] AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE + static amrex::GpuTuple sm_sp(const amrex::Real /*s0*/, - const amrex::Real sedge1, - const amrex::Real sedge2) + const amrex::Real sedge1, + const amrex::Real sedge2) { return amrex::makeTuple(sedge1, sedge2); } - - amrex::Real m_eps{amrex::Real(1.0e-6)}; }; +template 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, @@ -236,9 +223,11 @@ void SetXBCs ( const int i, const int j, const int k, const int n, if (i == domlo) { sedge2 = -amrex::Real(0.2)*s(domlo-1,j,k,n) + amrex::Real(0.75)*s(domlo,j, k, n) - +amrex::Real(amrex::Real(0.5))*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n); - sedge2 = amrex::max(sedge2, amrex::min(s(domlo+1,j,k,n), s(domlo,j,k,n))); - sedge2 = amrex::min(sedge2, amrex::max(s(domlo+1,j,k,n), s(domlo,j,k,n))); + +amrex::Real(0.5)*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n); + if constexpr (! std::is_same_v) { + sedge2 = amrex::max(sedge2, amrex::min(s(domlo+1,j,k,n), s(domlo,j,k,n))); + sedge2 = amrex::min(sedge2, amrex::max(s(domlo+1,j,k,n), s(domlo,j,k,n))); + } sm = s(domlo-1,j,k,n); sp = sedge2; @@ -246,22 +235,26 @@ void SetXBCs ( const int i, const int j, const int k, const int n, } else if (i == domlo+1) { sedge1 = -amrex::Real(0.2)*s(domlo-1,j,k,n) + amrex::Real(0.75)*s(domlo ,j,k,n) - + amrex::Real(amrex::Real(0.5))*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n); - sedge1 = amrex::max(sedge1, amrex::min(s(domlo+1,j,k,n), s(domlo,j,k,n))); - sedge1 = amrex::min(sedge1, amrex::max(s(domlo+1,j,k,n), s(domlo,j,k,n))); + + amrex::Real(0.5)*s(domlo+1,j,k,n) - amrex::Real(0.05)*s(domlo+2,j,k,n); + if constexpr (! std::is_same_v) { + sedge1 = amrex::max(sedge1, amrex::min(s(domlo+1,j,k,n), s(domlo,j,k,n))); + sedge1 = amrex::min(sedge1, amrex::max(s(domlo+1,j,k,n), s(domlo,j,k,n))); + } sp = sedge2; sm = sedge1; - if ( (sp - s(domlo+1,j,k,n))*(s(domlo+1,j,k,n) - sm) <= amrex::Real(0.0)) - { - sp = s(domlo+1,j,k,n); - sm = s(domlo+1,j,k,n); + if constexpr (! std::is_same_v) { + if ( (sp - s(domlo+1,j,k,n))*(s(domlo+1,j,k,n) - sm) <= amrex::Real(0.0)) + { + sp = s(domlo+1,j,k,n); + sm = s(domlo+1,j,k,n); + } else if(amrex::Math::abs(sp - s(domlo+1,j,k,n)) >= amrex::Real(2.0)*amrex::Math::abs(sm - s(domlo+1,j,k,n))) { + sp = amrex::Real(3.0)*s(domlo+1,j,k,n) - amrex::Real(2.0)*sm; + } else if(amrex::Math::abs(sm - s(domlo+1,j,k,n)) >= amrex::Real(2.0)*amrex::Math::abs(sp - s(domlo+1,j,k,n))) { + sm = amrex::Real(3.0)*s(domlo+1,j,k,n) - amrex::Real(2.0)*sp; + } } - 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))) - sp = amrex::Real(3.0)*s(domlo+1,j,k,n) - amrex::Real(amrex::Real(2.0))*sm; - 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))) - sm = amrex::Real(3.0)*s(domlo+1,j,k,n) - amrex::Real(amrex::Real(2.0))*sp; } } @@ -270,9 +263,11 @@ void SetXBCs ( const int i, const int j, const int k, const int n, if (i == domhi) { sedge1 = -amrex::Real(0.2)*s(domhi+1,j,k,n) + amrex::Real(0.75)*s(domhi,j,k, n) - +amrex::Real(amrex::Real(0.5))*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n); - sedge1 = amrex::max(sedge1, amrex::min(s(domhi-1,j,k,n), s(domhi,j,k,n))); - sedge1 = amrex::min(sedge1, amrex::max(s(domhi-1,j,k,n), s(domhi,j,k,n))); + +amrex::Real(0.5)*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n); + if constexpr (! std::is_same_v) { + sedge1 = amrex::max(sedge1, amrex::min(s(domhi-1,j,k,n), s(domhi,j,k,n))); + sedge1 = amrex::min(sedge1, amrex::max(s(domhi-1,j,k,n), s(domhi,j,k,n))); + } sp = s(domhi+1,j,k,n); sm = sedge1; @@ -280,26 +275,31 @@ void SetXBCs ( const int i, const int j, const int k, const int n, } else if (i == domhi-1) { sedge2 = -amrex::Real(0.2)*s(domhi+1,j,k,n) + amrex::Real(0.75)*s(domhi ,j,k,n) - +amrex::Real(amrex::Real(0.5))*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n); - sedge2 = amrex::max(sedge2, amrex::min(s(domhi-1,j,k,n), s(domhi,j,k,n))); - sedge2 = amrex::min(sedge2, amrex::max(s(domhi-1,j,k,n), s(domhi,j,k,n))); + +amrex::Real(0.5)*s(domhi-1,j,k,n) - amrex::Real(0.05)*s(domhi-2,j,k,n); + if constexpr (! std::is_same_v) { + sedge2 = amrex::max(sedge2, amrex::min(s(domhi-1,j,k,n), s(domhi,j,k,n))); + sedge2 = amrex::min(sedge2, amrex::max(s(domhi-1,j,k,n), s(domhi,j,k,n))); + } sp = sedge2; sm = sedge1; - if( (sp - s(domhi-1,j,k,n))*(s(domhi-1,j,k,n) - sm) <= amrex::Real(0.0)) - { - sp = s(domhi-1,j,k,n); - sm = s(domhi-1,j,k,n); + if constexpr (! std::is_same_v) { + if( (sp - s(domhi-1,j,k,n))*(s(domhi-1,j,k,n) - sm) <= amrex::Real(0.0)) + { + sp = s(domhi-1,j,k,n); + sm = s(domhi-1,j,k,n); + } else if(amrex::Math::abs(sp - s(domhi-1,j,k,n)) >= 2.*amrex::Math::abs(sm - s(domhi-1,j,k,n))) { + sp = amrex::Real(3.0)*s(domhi-1,j,k,n) - amrex::Real(2.0)*sm; + } else if(amrex::Math::abs(sm - s(domhi-1,j,k,n)) >= 2.*amrex::Math::abs(sp - s(domhi-1,j,k,n))) { + sm = amrex::Real(3.0)*s(domhi-1,j,k,n) - amrex::Real(2.0)*sp; + } } - else if(amrex::Math::abs(sp - s(domhi-1,j,k,n)) >= 2.*amrex::Math::abs(sm - s(domhi-1,j,k,n))) - sp = amrex::Real(3.0)*s(domhi-1,j,k,n) - amrex::Real(amrex::Real(2.0))*sm; - else if(amrex::Math::abs(sm - s(domhi-1,j,k,n)) >= 2.*amrex::Math::abs(sp - s(domhi-1,j,k,n))) - sm = amrex::Real(3.0)*s(domhi-1,j,k,n) - amrex::Real(amrex::Real(2.0))*sp; } } } +template 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, @@ -315,9 +315,11 @@ void SetYBCs ( const int i, const int j, const int k, const int n, if (j == domlo) { sedge2 = -amrex::Real(0.2)*s(i,domlo-1,k,n) + amrex::Real(0.75)*s(i,domlo ,k,n) - +amrex::Real(amrex::Real(0.5))*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n); - sedge2 = amrex::max(sedge2, amrex::min(s(i,domlo+1,k,n), s(i,domlo,k,n))); - sedge2 = amrex::min(sedge2, amrex::max(s(i,domlo+1,k,n), s(i,domlo,k,n))); + +amrex::Real(0.5)*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n); + if constexpr (! std::is_same_v) { + sedge2 = amrex::max(sedge2, amrex::min(s(i,domlo+1,k,n), s(i,domlo,k,n))); + sedge2 = amrex::min(sedge2, amrex::max(s(i,domlo+1,k,n), s(i,domlo,k,n))); + } sm = s(i,domlo-1,k,n); sp = sedge2; @@ -325,22 +327,26 @@ void SetYBCs ( const int i, const int j, const int k, const int n, } else if (j == domlo+1) { sedge1 = -amrex::Real(0.2)*s(i,domlo-1,k,n) + amrex::Real(0.75)*s(i,domlo ,k,n) - +amrex::Real(amrex::Real(0.5))*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n); - sedge1 = amrex::max(sedge1, amrex::min(s(i,domlo+1,k,n), s(i,domlo,k,n))); - sedge1 = amrex::min(sedge1, amrex::max(s(i,domlo+1,k,n), s(i,domlo,k,n))); + +amrex::Real(0.5)*s(i,domlo+1,k,n) - amrex::Real(0.05)*s(i,domlo+2,k,n); + if constexpr (! std::is_same_v) { + sedge1 = amrex::max(sedge1, amrex::min(s(i,domlo+1,k,n), s(i,domlo,k,n))); + sedge1 = amrex::min(sedge1, amrex::max(s(i,domlo+1,k,n), s(i,domlo,k,n))); + } sp = sedge2; sm = sedge1; - if ( (sp - s(i,domlo+1,k,n))*(s(i,domlo+1,k,n) - sm) <= amrex::Real(0.0)) - { - sp = s(i,domlo+1,k,n); - sm = s(i,domlo+1,k,n); + if constexpr (! std::is_same_v) { + if ( (sp - s(i,domlo+1,k,n))*(s(i,domlo+1,k,n) - sm) <= amrex::Real(0.0)) + { + sp = s(i,domlo+1,k,n); + sm = s(i,domlo+1,k,n); + } else if(amrex::Math::abs(sp - s(i,domlo+1,k,n)) >= amrex::Real(2.0)*amrex::Math::abs(sm - s(i,domlo+1,k,n))) { + sp = amrex::Real(3.0)*s(i,domlo+1,k,n) - amrex::Real(2.0)*sm; + } else if(amrex::Math::abs(sm - s(i,domlo+1,k,n)) >= amrex::Real(2.0)*amrex::Math::abs(sp - s(i,domlo+1,k,n))) { + sm = amrex::Real(3.0)*s(i,domlo+1,k,n) - amrex::Real(2.0)*sp; + } } - 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))) - sp = amrex::Real(3.0)*s(i,domlo+1,k,n) - amrex::Real(amrex::Real(2.0))*sm; - 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))) - sm = amrex::Real(3.0)*s(i,domlo+1,k,n) - amrex::Real(amrex::Real(2.0))*sp; } } @@ -349,9 +355,11 @@ void SetYBCs ( const int i, const int j, const int k, const int n, if (j == domhi) { sedge1 = -amrex::Real(0.2)*s(i,domhi+1,k,n) + amrex::Real(0.75)*s(i,domhi ,k,n) - +amrex::Real(amrex::Real(0.5))*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n); - sedge1 = amrex::max(sedge1, amrex::min(s(i,domhi-1,k,n), s(i,domhi,k,n))); - sedge1 = amrex::min(sedge1, amrex::max(s(i,domhi-1,k,n), s(i,domhi,k,n))); + +amrex::Real(0.5)*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n); + if constexpr (! std::is_same_v) { + sedge1 = amrex::max(sedge1, amrex::min(s(i,domhi-1,k,n), s(i,domhi,k,n))); + sedge1 = amrex::min(sedge1, amrex::max(s(i,domhi-1,k,n), s(i,domhi,k,n))); + } sp = s(i,domhi+1,k, n); sm = sedge1; @@ -359,27 +367,31 @@ void SetYBCs ( const int i, const int j, const int k, const int n, } else if (j == domhi-1) { sedge2 = -amrex::Real(0.2)*s(i,domhi+1,k,n) + amrex::Real(0.75)*s(i,domhi ,k,n) - +amrex::Real(amrex::Real(0.5))*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n); - sedge2 = amrex::max(sedge2, amrex::min(s(i,domhi-1,k,n), s(i,domhi,k,n))); - sedge2 = amrex::min(sedge2, amrex::max(s(i,domhi-1,k,n), s(i,domhi,k,n))); + +amrex::Real(0.5)*s(i,domhi-1,k,n) - amrex::Real(0.05)*s(i,domhi-2,k,n); + if constexpr (! std::is_same_v) { + sedge2 = amrex::max(sedge2, amrex::min(s(i,domhi-1,k,n), s(i,domhi,k,n))); + sedge2 = amrex::min(sedge2, amrex::max(s(i,domhi-1,k,n), s(i,domhi,k,n))); + } sp = sedge2; sm = sedge1; - if( (sp - s(i,domhi-1,k,n))*(s(i,domhi-1,k,n) - sm) <= amrex::Real(0.0)){ - sp = s(i,domhi-1,k,n); - sm = s(i,domhi-1,k,n); + if constexpr (! std::is_same_v) { + if( (sp - s(i,domhi-1,k,n))*(s(i,domhi-1,k,n) - sm) <= amrex::Real(0.0)){ + sp = s(i,domhi-1,k,n); + sm = s(i,domhi-1,k,n); + } else if(amrex::Math::abs(sp - s(i,domhi-1,k,n)) >= 2.*amrex::Math::abs(sm - s(i,domhi-1,k,n))) { + sp = amrex::Real(3.0)*s(i,domhi-1,k,n) - amrex::Real(2.0)*sm; + } else if(amrex::Math::abs(sm - s(i,domhi-1,k,n)) >= 2.*amrex::Math::abs(sp - s(i,domhi-1,k,n))) { + sm = amrex::Real(3.0)*s(i,domhi-1,k,n) - amrex::Real(2.0)*sp; + } } - else if(amrex::Math::abs(sp - s(i,domhi-1,k,n)) >= 2.*amrex::Math::abs(sm - s(i,domhi-1,k,n))) - sp = amrex::Real(3.0)*s(i,domhi-1,k,n) - amrex::Real(amrex::Real(2.0))*sm; - - else if(amrex::Math::abs(sm - s(i,domhi-1,k,n)) >= 2.*amrex::Math::abs(sp - s(i,domhi-1,k,n))) - sm = amrex::Real(3.0)*s(i,domhi-1,k,n) - amrex::Real(amrex::Real(2.0))*sp; } } } #if (AMREX_SPACEDIM==3) +template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void SetZBCs ( const int i, const int j, const int k, const int n, amrex::Real &sm, amrex::Real &sp, @@ -392,13 +404,14 @@ void SetZBCs ( const int i, const int j, const int k, const int n, if (bclo == BCType::ext_dir || bclo == BCType::hoextrap) { - if (k == domlo) { sedge2 = -amrex::Real(0.2)*s(i,j,domlo-1,n) + amrex::Real(0.75)*s(i,j,domlo ,n) - +amrex::Real(amrex::Real(0.5))*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n); - sedge2 = amrex::max(sedge2, amrex::min(s(i,j,domlo+1,n), s(i,j,domlo,n))); - sedge2 = amrex::min(sedge2, amrex::max(s(i,j,domlo+1,n), s(i,j,domlo,n))); + +amrex::Real(0.5)*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n); + if constexpr (! std::is_same_v) { + sedge2 = amrex::max(sedge2, amrex::min(s(i,j,domlo+1,n), s(i,j,domlo,n))); + sedge2 = amrex::min(sedge2, amrex::max(s(i,j,domlo+1,n), s(i,j,domlo,n))); + } sm = s(i,j,domlo-1,n); sp = sedge2; @@ -406,23 +419,26 @@ void SetZBCs ( const int i, const int j, const int k, const int n, } else if (k == domlo+1) { sedge1 = -amrex::Real(0.2)*s(i,j,domlo-1,n) + amrex::Real(0.75)*s(i,j,domlo ,n) - +amrex::Real(amrex::Real(0.5))*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n); - sedge1 = amrex::max(sedge1, amrex::min(s(i,j,domlo+1,n), s(i,j,domlo,n))); - sedge1 = amrex::min(sedge1, amrex::max(s(i,j,domlo+1,n), s(i,j,domlo,n))); + +amrex::Real(0.5)*s(i,j,domlo+1,n) - amrex::Real(0.05)*s(i,j,domlo+2,n); + if constexpr (! std::is_same_v) { + sedge1 = amrex::max(sedge1, amrex::min(s(i,j,domlo+1,n), s(i,j,domlo,n))); + sedge1 = amrex::min(sedge1, amrex::max(s(i,j,domlo+1,n), s(i,j,domlo,n))); + } sp = sedge2; sm = sedge1; - if ( (sp - s(i,j,domlo+1,n))*(s(i,j,domlo+1,n) - sm) <= 0. ) - { - sp = s(i,j,domlo+1,n); - sm = s(i,j,domlo+1,n); + if constexpr (! std::is_same_v) { + if ( (sp - s(i,j,domlo+1,n))*(s(i,j,domlo+1,n) - sm) <= 0. ) + { + sp = s(i,j,domlo+1,n); + sm = s(i,j,domlo+1,n); + } else if(amrex::Math::abs(sp - s(i,j,domlo+1,n)) >= 2.*amrex::Math::abs(sm - s(i,j,domlo+1,n))) { + sp = amrex::Real(3.0)*s(i,j,domlo+1,n) - amrex::Real(2.0)*sm; + } else if(amrex::Math::abs(sm - s(i,j,domlo+1,n)) >= 2.*amrex::Math::abs(sp - s(i,j,domlo+1,n))) { + sm = amrex::Real(3.0)*s(i,j,domlo+1,n) - amrex::Real(2.0)*sp; + } } - else if(amrex::Math::abs(sp - s(i,j,domlo+1,n)) >= 2.*amrex::Math::abs(sm - s(i,j,domlo+1,n))) - sp = amrex::Real(3.0)*s(i,j,domlo+1,n) - amrex::Real(amrex::Real(2.0))*sm; - - else if(amrex::Math::abs(sm - s(i,j,domlo+1,n)) >= 2.*amrex::Math::abs(sp - s(i,j,domlo+1,n))) - sm = amrex::Real(3.0)*s(i,j,domlo+1,n) - amrex::Real(amrex::Real(2.0))*sp; } } @@ -431,9 +447,11 @@ void SetZBCs ( const int i, const int j, const int k, const int n, if (k == domhi) { sedge1 = -amrex::Real(0.2)*s(i,j,domhi+1,n) + amrex::Real(0.75)*s(i,j,domhi ,n) - +amrex::Real(amrex::Real(0.5))*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n); - sedge1 = amrex::max(sedge1, amrex::min(s(i,j,domhi-1,n), s(i,j,domhi,n))); - sedge1 = amrex::min(sedge1, amrex::max(s(i,j,domhi-1,n), s(i,j,domhi,n))); + +amrex::Real(0.5)*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n); + if constexpr (! std::is_same_v) { + sedge1 = amrex::max(sedge1, amrex::min(s(i,j,domhi-1,n), s(i,j,domhi,n))); + sedge1 = amrex::min(sedge1, amrex::max(s(i,j,domhi-1,n), s(i,j,domhi,n))); + } sp = s(i,j,domhi+1,n); sm = sedge1; @@ -441,23 +459,26 @@ void SetZBCs ( const int i, const int j, const int k, const int n, } else if (k == domhi-1) { sedge2 = -amrex::Real(0.2)*s(i,j,domhi+1,n) + amrex::Real(0.75)*s(i,j,domhi ,n) - +amrex::Real(amrex::Real(0.5))*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n); - sedge2 = amrex::max(sedge2, amrex::min(s(i,j,domhi-1,n), s(i,j,domhi,n))); - sedge2 = amrex::min(sedge2, amrex::max(s(i,j,domhi-1,n), s(i,j,domhi,n))); + +amrex::Real(0.5)*s(i,j,domhi-1,n) - amrex::Real(0.05)*s(i,j,domhi-2,n); + if constexpr (! std::is_same_v) { + sedge2 = amrex::max(sedge2, amrex::min(s(i,j,domhi-1,n), s(i,j,domhi,n))); + sedge2 = amrex::min(sedge2, amrex::max(s(i,j,domhi-1,n), s(i,j,domhi,n))); + } sp = sedge2; sm = sedge1; - if ( (sp - s(i,j,domhi-1,n))*(s(i,j,domhi-1,n) - sm) <= 0. ) - { - sp = s(i,j,domhi-1,n); - sm = s(i,j,domhi-1,n); + if constexpr (! std::is_same_v) { + if ( (sp - s(i,j,domhi-1,n))*(s(i,j,domhi-1,n) - sm) <= 0. ) + { + sp = s(i,j,domhi-1,n); + sm = s(i,j,domhi-1,n); + } else if(amrex::Math::abs(sp - s(i,j,domhi-1,n)) >= 2.*amrex::Math::abs(sm - s(i,j,domhi-1,n))) { + sp = amrex::Real(3.0)*s(i,j,domhi-1,n) - amrex::Real(2.0)*sm; + } else if(amrex::Math::abs(sm - s(i,j,domhi-1,n)) >= 2.*amrex::Math::abs(sp - s(i,j,domhi-1,n))) { + sm = amrex::Real(3.0)*s(i,j,domhi-1,n) - amrex::Real(2.0)*sp; + } } - else if(amrex::Math::abs(sp - s(i,j,domhi-1,n)) >= 2.*amrex::Math::abs(sm - s(i,j,domhi-1,n))) - sp = amrex::Real(3.0)*s(i,j,domhi-1,n) - amrex::Real(amrex::Real(2.0))*sm; - - else if(amrex::Math::abs(sm - s(i,j,domhi-1,n)) >= 2.*amrex::Math::abs(sp - s(i,j,domhi-1,n))) - sm = amrex::Real(3.0)*s(i,j,domhi-1,n) - amrex::Real(amrex::Real(2.0))*sp; } } @@ -476,10 +497,10 @@ void PredictVelOnXFace ( const int i, const int j, const int k, const int n, const amrex::Array4 &Im, const amrex::Array4 &Ip, const amrex::BCRec bc, const int domlo, const int domhi, - const Limiter& limiter) + const Limiter& /*limiter*/) { - constexpr amrex::Real m_half{amrex::Real(0.5)}; - constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)}; + constexpr auto half{amrex::Real(0.5)}; + constexpr auto two3rds{amrex::Real(2.0/3.0)}; amrex::Real sm2 = S(i-2,j,k,n); amrex::Real sm1 = S(i-1,j,k,n); @@ -487,13 +508,13 @@ void PredictVelOnXFace ( const int i, const int j, const int k, const int n, amrex::Real sp1 = S(i+1,j,k,n); amrex::Real sp2 = S(i+2,j,k,n); - amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2); - amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge1 = Limiter::sedge1(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge2 = Limiter::sedge2(sm2,sm1,s0,sp1,sp2); amrex::Real sm, sp; - amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2); + amrex::Tie(sm,sp) = Limiter::sm_sp(s0,sedge1,sedge2); - SetXBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(0), bc.hi(0), domlo, domhi); + SetXBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(0), bc.hi(0), domlo, domhi); amrex::Real s6 = amrex::Real(6.0)*s0 - amrex::Real(3.0)*(sm + sp); @@ -501,13 +522,13 @@ void PredictVelOnXFace ( const int i, const int j, const int k, const int n, if (v_ad > small_vel) { - Ip(i,j,k,n) = sp - (m_half*sigma)*((sp-sm) - (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigma)*s6); + Ip(i,j,k,n) = sp - (half*sigma)*((sp-sm) - (amrex::Real(1.0) - two3rds*sigma)*s6); Im(i,j,k,n) = S(i,j,k,n); } else if (v_ad < -small_vel) { Ip(i,j,k,n) = S(i,j,k,n); - Im(i,j,k,n) = sm + (m_half*sigma)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigma)*s6); + Im(i,j,k,n) = sm + (half*sigma)*((sp-sm) + (amrex::Real(1.0) - two3rds*sigma)*s6); } else { Ip(i,j,k,n) = S(i,j,k,n); @@ -523,10 +544,10 @@ void PredictVelOnYFace ( const int i, const int j, const int k, const int n, const amrex::Array4 &Im, const amrex::Array4 &Ip, const amrex::BCRec bc, const int domlo, const int domhi, - const Limiter& limiter) + const Limiter& /*limiter*/) { - constexpr amrex::Real m_half{amrex::Real(0.5)}; - constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)}; + constexpr auto half{amrex::Real(0.5)}; + constexpr auto two3rds{amrex::Real(2.0/3.0)}; amrex::Real sm2 = S(i,j-2,k,n); amrex::Real sm1 = S(i,j-1,k,n); @@ -534,13 +555,13 @@ void PredictVelOnYFace ( const int i, const int j, const int k, const int n, amrex::Real sp1 = S(i,j+1,k,n); amrex::Real sp2 = S(i,j+2,k,n); - amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2); - amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge1 = Limiter::sedge1(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge2 = Limiter::sedge2(sm2,sm1,s0,sp1,sp2); amrex::Real sm, sp; - amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2); + amrex::Tie(sm,sp) = Limiter::sm_sp(s0,sedge1,sedge2); - SetYBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(1), bc.hi(1), domlo, domhi); + SetYBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(1), bc.hi(1), domlo, domhi); amrex::Real s6 = amrex::Real(6.0)*s0 - amrex::Real(3.0)*(sm + sp); @@ -548,13 +569,13 @@ void PredictVelOnYFace ( const int i, const int j, const int k, const int n, if (v_ad > small_vel) { - Ip(i,j,k,n) = sp - (m_half*sigma)*((sp-sm) - (amrex::Real(1.0) - m_two3rds*sigma)*s6); + Ip(i,j,k,n) = sp - (half*sigma)*((sp-sm) - (amrex::Real(1.0) - two3rds*sigma)*s6); Im(i,j,k,n) = S(i,j,k,n); } else if (v_ad < -small_vel) { Ip(i,j,k,n) = S(i,j,k,n); - Im(i,j,k,n) = sm + (m_half*sigma)*((sp-sm) + (amrex::Real(1.0) - m_two3rds*sigma)*s6); + Im(i,j,k,n) = sm + (half*sigma)*((sp-sm) + (amrex::Real(1.0) - two3rds*sigma)*s6); } else { Ip(i,j,k,n) = S(i,j,k,n); @@ -571,10 +592,10 @@ void PredictVelOnZFace ( const int i, const int j, const int k, const int n, const amrex::Array4 &Im, const amrex::Array4 &Ip, const amrex::BCRec bc, const int domlo, const int domhi, - const Limiter& limiter) + const Limiter& /*limiter*/) { - constexpr amrex::Real m_half{amrex::Real(0.5)}; - constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)}; + constexpr auto half{amrex::Real(0.5)}; + constexpr auto two3rds{amrex::Real(2.0/3.0)}; amrex::Real sm2 = S(i,j,k-2,n); amrex::Real sm1 = S(i,j,k-1,n); @@ -582,13 +603,13 @@ void PredictVelOnZFace ( const int i, const int j, const int k, const int n, amrex::Real sp1 = S(i,j,k+1,n); amrex::Real sp2 = S(i,j,k+2,n); - amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2); - amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge1 = Limiter::sedge1(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge2 = Limiter::sedge2(sm2,sm1,s0,sp1,sp2); amrex::Real sm, sp; - amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2); + amrex::Tie(sm,sp) = Limiter::sm_sp(s0,sedge1,sedge2); - SetZBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(2), bc.hi(2), domlo, domhi); + SetZBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(2), bc.hi(2), domlo, domhi); amrex::Real s6 = amrex::Real(6.0)*s0 - amrex::Real(3.0)*(sm + sp); @@ -596,13 +617,13 @@ void PredictVelOnZFace ( const int i, const int j, const int k, const int n, if (v_ad > small_vel) { - Ip(i,j,k,n) = sp - (m_half*sigma)*((sp-sm) - (amrex::Real(1.0) - m_two3rds*sigma)*s6); + Ip(i,j,k,n) = sp - (half*sigma)*((sp-sm) - (amrex::Real(1.0) - two3rds*sigma)*s6); Im(i,j,k,n) = S(i,j,k,n); } else if (v_ad < -small_vel) { Ip(i,j,k,n) = S(i,j,k,n); - Im(i,j,k,n) = sm + (m_half*sigma)*((sp-sm) + (amrex::Real(1.0) - m_two3rds*sigma)*s6); + Im(i,j,k,n) = sm + (half*sigma)*((sp-sm) + (amrex::Real(1.0) - two3rds*sigma)*s6); } else { Ip(i,j,k,n) = S(i,j,k,n); @@ -624,13 +645,10 @@ void PredictStateOnXFace ( const int i, const int j, const int k, const int n, const amrex::Array4 &vel_edge, const amrex::BCRec bc, const int domlo, const int domhi, - const Limiter& limiter) + const Limiter& /*limiter*/) { - { - using namespace amrex; - - constexpr amrex::Real m_half{amrex::Real(0.5)}; - constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)}; + constexpr auto half{amrex::Real(0.5)}; + constexpr auto two3rds{amrex::Real(2.0/3.0)}; amrex::Real sm2 = S(i-2,j,k,n); amrex::Real sm1 = S(i-1,j,k,n); @@ -638,13 +656,13 @@ void PredictStateOnXFace ( const int i, const int j, const int k, const int n, amrex::Real sp1 = S(i+1,j,k,n); amrex::Real sp2 = S(i+2,j,k,n); - amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2); - amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge1 = Limiter::sedge1(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge2 = Limiter::sedge2(sm2,sm1,s0,sp1,sp2); amrex::Real sm, sp; - amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2); + amrex::Tie(sm,sp) = Limiter::sm_sp(s0,sedge1,sedge2); - SetXBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(0), bc.hi(0), domlo, domhi); + SetXBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(0), bc.hi(0), domlo, domhi); amrex::Real s6 = 6.0*s0 - 3.0*(sm + sp); @@ -652,18 +670,17 @@ void PredictStateOnXFace ( const int i, const int j, const int k, const int n, amrex::Real sigmam = amrex::Math::abs(vel_edge(i ,j,k))*dt/dx; if (vel_edge(i+1,j,k) > small_vel) - Ip = sp - (m_half*sigmap)*((sp - sm) - (amrex::Real(amrex::Real(1.0)) -m_two3rds*sigmap)*s6); + Ip = sp - (half*sigmap)*((sp - sm) - (amrex::Real(1.0) -two3rds*sigmap)*s6); else Ip = S(i,j,k,n); if(vel_edge(i,j,k) < -small_vel) - Im = sm + (m_half*sigmam)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigmam)*s6); + Im = sm + (half*sigmam)*((sp-sm) + (amrex::Real(1.0) - two3rds*sigmam)*s6); else Im = S(i,j,k,n); - } } -template +template 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, @@ -672,13 +689,10 @@ void PredictStateOnYFace ( const int i, const int j, const int k, const int n, const amrex::Array4 &vel_edge, const amrex::BCRec bc, const int domlo, const int domhi, - const Limiter& limiter) + const Limiter& /*limiter*/) { - { - using namespace amrex; - - constexpr amrex::Real m_half{amrex::Real(0.5)}; - constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)}; + constexpr auto half{amrex::Real(0.5)}; + constexpr auto two3rds{amrex::Real(2.0/3.0)}; amrex::Real sm2 = S(i,j-2,k,n); amrex::Real sm1 = S(i,j-1,k,n); @@ -686,13 +700,13 @@ void PredictStateOnYFace ( const int i, const int j, const int k, const int n, amrex::Real sp1 = S(i,j+1,k,n); amrex::Real sp2 = S(i,j+2,k,n); - amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2); - amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge1 = Limiter::sedge1(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge2 = Limiter::sedge2(sm2,sm1,s0,sp1,sp2); amrex::Real sm, sp; - amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2); + amrex::Tie(sm,sp) = Limiter::sm_sp(s0,sedge1,sedge2); - SetYBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(1), bc.hi(1), domlo, domhi); + SetYBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(1), bc.hi(1), domlo, domhi); amrex::Real s6 = 6.0*s0- 3.0*(sm + sp); @@ -700,15 +714,14 @@ void PredictStateOnYFace ( const int i, const int j, const int k, const int n, amrex::Real sigmam = amrex::Math::abs(vel_edge(i,j ,k))*dt/dx; if (vel_edge(i,j+1,k) > small_vel) - Ip = sp - (m_half*sigmap)*((sp - sm) - (amrex::Real(amrex::Real(1.0)) -m_two3rds*sigmap)*s6); + Ip = sp - (half*sigmap)*((sp - sm) - (amrex::Real(1.0) -two3rds*sigmap)*s6); else Ip = S(i,j,k,n); if (vel_edge(i,j,k) < -small_vel) - Im = sm + (m_half*sigmam)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigmam)*s6); + Im = sm + (half*sigmam)*((sp-sm) + (amrex::Real(1.0) - two3rds*sigmam)*s6); else Im = S(i,j,k,n); - } } @@ -722,13 +735,11 @@ void PredictStateOnZFace ( const int i, const int j, const int k, const int n, const amrex::Array4 &vel_edge, const amrex::BCRec bc, const int domlo, const int domhi, - const Limiter& limiter) + const Limiter& /*limiter*/) { - { - using namespace amrex; - constexpr amrex::Real m_half{amrex::Real(0.5)}; - constexpr amrex::Real m_two3rds{amrex::Real(2.0/3.0)}; + constexpr auto half{amrex::Real(0.5)}; + constexpr auto two3rds{amrex::Real(2.0/3.0)}; amrex::Real sm2 = S(i,j,k-2,n); amrex::Real sm1 = S(i,j,k-1,n); @@ -736,28 +747,27 @@ void PredictStateOnZFace ( const int i, const int j, const int k, const int n, amrex::Real sp1 = S(i,j,k+1,n); amrex::Real sp2 = S(i,j,k+2,n); - amrex::Real sedge1 = limiter.sedge1(sm2,sm1,s0,sp1,sp2); - amrex::Real sedge2 = limiter.sedge2(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge1 = Limiter::sedge1(sm2,sm1,s0,sp1,sp2); + amrex::Real sedge2 = Limiter::sedge2(sm2,sm1,s0,sp1,sp2); amrex::Real sm, sp; - amrex::Tie(sm,sp) = limiter.sm_sp(s0,sedge1,sedge2); + amrex::Tie(sm,sp) = Limiter::sm_sp(s0,sedge1,sedge2); - SetZBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(2), bc.hi(2), domlo, domhi); + SetZBCs(i, j, k, n, sm, sp, sedge1, sedge2, S, bc.lo(2), bc.hi(2), domlo, domhi); amrex::Real s6 = 6.0*s0- 3.0*(sm + sp); amrex::Real sigmap = amrex::Math::abs(vel_edge(i,j,k+1))*dt/dx; amrex::Real sigmam = amrex::Math::abs(vel_edge(i,j,k ))*dt/dx; if(vel_edge(i,j,k+1) > small_vel) - Ip = sp - (m_half*sigmap)*((sp-sm) - (amrex::Real(amrex::Real(1.0)) -m_two3rds*sigmap)*s6); + Ip = sp - (half*sigmap)*((sp-sm) - (amrex::Real(1.0) -two3rds*sigmap)*s6); else Ip = S(i,j,k,n); if(vel_edge(i,j,k) < -small_vel) - Im = sm + (m_half*sigmam)*((sp-sm) + (amrex::Real(amrex::Real(1.0)) - m_two3rds*sigmam)*s6); + Im = sm + (half*sigmam)*((sp-sm) + (amrex::Real(1.0) - two3rds*sigmam)*s6); else Im = S(i,j,k,n); - } } #endif