1 #ifndef AMREX_MLABECLAP_1D_K_H_
2 #define AMREX_MLABECLAP_1D_K_H_
3 #include <AMReX_Config.H>
14 T alpha, T beta) noexcept
16 const T dhx = beta*dxinv[0]*dxinv[0];
17 y(i,0,0,n) = alpha*a(i,0,0)*
x(i,0,0,n)
18 - dhx * (bX(i+1,0,0,n)*(
x(i+1,0,0,n) -
x(i ,0,0,n))
19 - bX(i ,0,0,n)*(
x(i ,0,0,n) -
x(i-1,0,0,n)));
30 T alpha, T beta) noexcept
32 const T dhx = beta*dxinv[0]*dxinv[0];
33 if (osm(i,0,0) == 0) {
36 y(i,0,0,n) = alpha*a(i,0,0)*
x(i,0,0,n)
37 - dhx * (bX(i+1,0,0,n)*(
x(i+1,0,0,n) -
x(i ,0,0,n))
38 - bX(i ,0,0,n)*(
x(i ,0,0,n) -
x(i-1,0,0,n)));
48 T alpha, T beta) noexcept
50 const T dhx = beta*dxinv[0]*dxinv[0];
51 x(i,0,0,n) /= alpha*a(i,0,0) + dhx*(bX(i,0,0,n)+bX(i+1,0,0,n));
62 for (
int n = 0; n < ncomp; ++n) {
64 for (
int i = lo.x; i <= hi.x; ++i) {
65 fx(i,0,0,n) = -fac*bx(i,0,0,n)*(sol(i,0,0,n)-sol(i-1,0,0,n));
77 for (
int n = 0; n < ncomp; ++n) {
79 fx(i,0,0,n) = -fac*bx(i,0,0,n)*(sol(i,0,0,n)-sol(i-1,0,0,n));
81 fx(i,0,0,n) = -fac*bx(i,0,0,n)*(sol(i,0,0,n)-sol(i-1,0,0,n));
95 Box const& vbox,
int redblack) noexcept
97 if ((i+redblack)%2 == 0) {
101 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
102 ? f0(vlo.x,0,0,n) : T(0.0);
103 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
104 ? f1(vhi.x,0,0,n) : T(0.0);
106 T delta = dhx*(bX(i,0,0,n)*cf0 + bX(i+1,0,0,n)*cf1);
108 T gamma = alpha*a(i,0,0)
109 + dhx*( bX(i,0,0,n) + bX(i+1,0,0,n) );
111 T rho = dhx*(bX(i ,0 ,0,n)*phi(i-1,0 ,0,n)
112 + bX(i+1,0 ,0,n)*phi(i+1,0 ,0,n));
114 phi(i,0,0,n) = (rhs(i,0,0,n) + rho - phi(i,0,0,n)*delta)
119 template <
typename T>
130 Box const& vbox,
int redblack) noexcept
132 if ((i+redblack)%2 == 0) {
133 if (osm(i,0,0) == 0) {
139 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
140 ? f0(vlo.x,0,0,n) : T(0.0);
141 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
142 ? f1(vhi.x,0,0,n) : T(0.0);
144 T delta = dhx*(bX(i,0,0,n)*cf0 + bX(i+1,0,0,n)*cf1);
146 T gamma = alpha*a(i,0,0)
147 + dhx*( bX(i,0,0,n) + bX(i+1,0,0,n) );
149 T rho = dhx*(bX(i ,0 ,0,n)*phi(i-1,0 ,0,n)
150 + bX(i+1,0 ,0,n)*phi(i+1,0 ,0,n));
152 phi(i,0,0,n) = (rhs(i,0,0,n) + rho - phi(i,0,0,n)*delta)
158 template <
typename T>
169 Box const& vbox) noexcept
174 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
175 ? f0(vlo.x,0,0,n) : T(0.0);
176 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
177 ? f1(vhi.x,0,0,n) : T(0.0);
179 T delta = dhx*(bX(i,0,0,n)*cf0 + bX(i+1,0,0,n)*cf1);
181 T gamma = alpha*a(i,0,0)
182 + dhx*( bX(i,0,0,n) + bX(i+1,0,0,n) );
184 phi(i,0,0,n) += T(2.0/3.0) * (rhs(i,0,0,n) - Ax(i,0,0,n)) / (gamma - delta);
187 template <
typename T>
199 Box const& vbox) noexcept
201 if (osm(i,0,0) == 0) {
207 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
208 ? f0(vlo.x,0,0,n) : T(0.0);
209 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
210 ? f1(vhi.x,0,0,n) : T(0.0);
212 T delta = dhx*(bX(i,0,0,n)*cf0 + bX(i+1,0,0,n)*cf1);
214 T gamma = alpha*a(i,0,0)
215 + dhx*( bX(i,0,0,n) + bX(i+1,0,0,n) );
217 phi(i,0,0,n) += T(2.0/3.0) * (rhs(i,0,0,n) - Ax(i,0,0,n)) / (gamma - delta);
221 template <
typename T>
232 Box const& ,
int ,
int ) noexcept
234 amrex::Abort(
"abec_gsrb_with_line_solve not implemented in 1D");
237 template <
typename T>
240 int ncomp, T osfac) noexcept
244 for (
int n = 0; n < ncomp; ++n) {
245 for (
int i = lo.x; i <= hi.x; ++i) {
246 if ((osm(i-1,0,0)+osm(i,0,0)) == 1) {
247 bX(i,0,0,n) *= osfac;
#define AMREX_PRAGMA_SIMD
Definition: AMReX_Extension.H:80
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void overset_rescale_bcoef_x(Box const &box, Array4< T > const &bX, Array4< int const > const &osm, int ncomp, T osfac) noexcept
Definition: AMReX_MLABecLap_1D_K.H:239
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlabeclap_adotx_os(int i, int, int, int n, Array4< T > const &y, Array4< T const > const &x, Array4< T const > const &a, Array4< T const > const &bX, Array4< int const > const &osm, GpuArray< T, AMREX_SPACEDIM > const &dxinv, T alpha, T beta) noexcept
Definition: AMReX_MLABecLap_1D_K.H:24
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlabeclap_flux_x(Box const &box, Array4< T > const &fx, Array4< T const > const &sol, Array4< T const > const &bx, T fac, int ncomp) noexcept
Definition: AMReX_MLABecLap_1D_K.H:56
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void abec_gsrb_os(int i, int, int, int n, Array4< T > const &phi, Array4< T const > const &rhs, T alpha, Array4< T const > const &a, T dhx, Array4< T const > const &bX, Array4< int const > const &m0, Array4< int const > const &m1, Array4< T const > const &f0, Array4< T const > const &f1, Array4< int const > const &osm, Box const &vbox, int redblack) noexcept
Definition: AMReX_MLABecLap_1D_K.H:121
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 Dim3 lbound(Array4< T > const &a) noexcept
Definition: AMReX_Array4.H:308
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void abec_jacobi(int i, int, int, int n, Array4< T > const &phi, Array4< T const > const &rhs, Array4< T const > const &Ax, T alpha, Array4< T const > const &a, T dhx, Array4< T const > const &bX, Array4< int const > const &m0, Array4< int const > const &m1, Array4< T const > const &f0, Array4< T const > const &f1, Box const &vbox) noexcept
Definition: AMReX_MLABecLap_1D_K.H:160
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void abec_gsrb(int i, int, int, int n, Array4< T > const &phi, Array4< T const > const &rhs, T alpha, Array4< T const > const &a, T dhx, Array4< T const > const &bX, Array4< int const > const &m0, Array4< int const > const &m1, Array4< T const > const &f0, Array4< T const > const &f1, Box const &vbox, int redblack) noexcept
Definition: AMReX_MLABecLap_1D_K.H:87
AMREX_FORCE_INLINE void abec_gsrb_with_line_solve(Box const &, Array4< T > const &, Array4< T const > const &, T, Array4< T const > const &, T, Array4< T const > const &, Array4< int const > const &, Array4< int const > const &, Array4< T const > const &, Array4< T const > const &, Box const &, int, int) noexcept
Definition: AMReX_MLABecLap_1D_K.H:223
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlabeclap_normalize(int i, int, int, int n, Array4< T > const &x, Array4< T const > const &a, Array4< T const > const &bX, GpuArray< T, AMREX_SPACEDIM > const &dxinv, T alpha, T beta) noexcept
Definition: AMReX_MLABecLap_1D_K.H:44
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void abec_jacobi_os(int i, int, int, int n, Array4< T > const &phi, Array4< T const > const &rhs, Array4< T const > const &Ax, T alpha, Array4< T const > const &a, T dhx, Array4< T const > const &bX, Array4< int const > const &m0, Array4< int const > const &m1, Array4< T const > const &f0, Array4< T const > const &f1, Array4< int const > const &osm, Box const &vbox) noexcept
Definition: AMReX_MLABecLap_1D_K.H:189
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlabeclap_flux_xface(Box const &box, Array4< T > const &fx, Array4< T const > const &sol, Array4< T const > const &bx, T fac, int xlen, int ncomp) noexcept
Definition: AMReX_MLABecLap_1D_K.H:72
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlabeclap_adotx(int i, int, int, int n, Array4< T > const &y, Array4< T const > const &x, Array4< T const > const &a, Array4< T const > const &bX, GpuArray< T, AMREX_SPACEDIM > const &dxinv, T alpha, T beta) noexcept
Definition: AMReX_MLABecLap_1D_K.H:9
Definition: AMReX_Array4.H:61
Definition: AMReX_Array.H:34