1 #ifndef AMREX_MLALAP_1D_K_H_
2 #define AMREX_MLALAP_1D_K_H_
3 #include <AMReX_Config.H>
13 RT alpha, RT beta,
int ncomp) noexcept
15 const RT dhx = beta*dxinv[0]*dxinv[0];
20 for (
int n = 0; n < ncomp; ++n) {
22 for (
int i = lo.x; i <= hi.x; ++i) {
23 y(i,0,0,n) = alpha*a(i,0,0,n)*
x(i,0,0,n)
24 - dhx * (
x(i+1,0,0,n) - RT(2.)*
x(i,0,0,n) +
x(i-1,0,0,n));
29 template <
typename RT>
36 RT dx, RT probxlo,
int ncomp) noexcept
38 const RT dhx = beta*dxinv[0]*dxinv[0];
43 for (
int n = 0; n < ncomp; ++n) {
45 for (
int i = lo.x; i <= hi.x; ++i) {
46 RT rel = (probxlo + i *dx) * (probxlo + i *dx);
47 RT rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
48 RT rc = (probxlo +(i+RT(.5))*dx) * (probxlo +(i+RT(.5))*dx);
49 y(i,0,0,n) = alpha*a(i,0,0,n)*
x(i,0,0,n)*rc
50 - dhx * (rer*(
x(i+1,0,0,n) -
x(i ,0,0,n))
51 - rel*(
x(i ,0,0,n) -
x(i-1,0,0,n)));
56 template <
typename RT>
61 RT alpha, RT beta,
int ncomp) noexcept
63 const RT dhx = beta*dxinv[0]*dxinv[0];
68 for (
int n = 0; n < ncomp; ++n) {
70 for (
int i = lo.x; i <= hi.x; ++i) {
71 x(i,0,0,n) /= alpha*a(i,0,0,n) + dhx*RT(2.0);
76 template <
typename RT>
81 RT alpha, RT beta, RT dx, RT probxlo,
int ncomp) noexcept
83 const RT dhx = beta*dxinv[0]*dxinv[0];
88 for (
int n = 0; n < ncomp; ++n) {
90 for (
int i = lo.x; i <= hi.x; ++i) {
91 RT rel = (probxlo + i *dx) * (probxlo + i *dx);
92 RT rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
93 RT rc = (probxlo +(i+RT(.5))*dx) * (probxlo +(i+RT(.5))*dx);
94 x(i,0,0,n) /= alpha*a(i,0,0,n)*rc + dhx*(rel+rer);
99 template <
typename RT>
107 for (
int n = 0; n < ncomp; ++n) {
109 for (
int i = lo.x; i <= hi.x; ++i) {
110 fx(i,0,0,n) = -fac*(sol(i,0,0,n)-sol(i-1,0,0,n));
115 template <
typename RT>
119 RT dx, RT probxlo,
int ncomp) noexcept
124 for (
int n = 0; n < ncomp; ++n) {
126 for (
int i = lo.x; i <= hi.x; ++i) {
127 RT re = (probxlo + i*dx) * (probxlo + i*dx);
128 fx(i,0,0,n) = -fac*re*(sol(i,0,0,n)-sol(i-1,0,0,n));
133 template <
typename RT>
140 for (
int n = 0; n < ncomp; ++n) {
142 fx(i,0,0,n) = -fac*(sol(i,0,0,n)-sol(i-1,0,0,n));
144 fx(i,0,0,n) = -fac*(sol(i,0,0,n)-sol(i-1,0,0,n));
148 template <
typename RT>
152 RT dx, RT probxlo,
int ncomp) noexcept
156 for (
int n = 0; n < ncomp; ++n) {
158 RT re = (probxlo + i*dx) * (probxlo + i*dx);
159 fx(i,0,0,n) = -fac*re*(sol(i,0,0,n)-sol(i-1,0,0,n));
161 re = (probxlo + i*dx) * (probxlo + i*dx);
162 fx(i,0,0,n) = -fac*re*(sol(i,0,0,n)-sol(i-1,0,0,n));
166 template <
typename RT>
173 Box const& vbox,
int redblack,
int ncomp) noexcept
180 for (
int n = 0; n < ncomp; ++n) {
182 for (
int i = lo.x; i <= hi.x; ++i) {
183 if ((i+redblack)%2 == 0) {
184 RT cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
185 ? f0(vlo.x,0,0,n) : RT(0.0);
186 RT cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
187 ? f1(vhi.x,0,0,n) : RT(0.0);
189 RT delta = dhx*(cf0+cf1);
191 RT gamma = alpha*a(i,0,0,n) + dhx*RT(2.0);
193 RT rho = dhx*(phi(i-1,0,0,n) + phi(i+1,0,0,n));
195 phi(i,0,0,n) = (rhs(i,0,0,n) + rho - phi(i,0,0,n)*delta)
202 template <
typename RT>
209 Box const& vbox,
int redblack,
210 RT dx, RT probxlo,
int ncomp)
217 for (
int n = 0; n < ncomp; ++n) {
219 for (
int i = lo.x; i <= hi.x; ++i) {
220 if ((i+redblack)%2 == 0) {
221 RT cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
222 ? f0(vlo.x,0,0,n) : RT(0.0);
223 RT cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
224 ? f1(vhi.x,0,0,n) : RT(0.0);
226 RT rel = (probxlo + i *dx) * (probxlo + i *dx);
227 RT rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
228 RT rc = (probxlo +(i+RT(.5))*dx) * (probxlo +(i+RT(.5))*dx);
230 RT delta = dhx*(rel*cf0 + rer*cf1);
232 RT gamma = alpha*a(i,0,0,n)*rc + dhx*(rel+rer);
234 RT rho = dhx*(rel*phi(i-1,0,0,n) + rer*phi(i+1,0,0,n));
236 phi(i,0,0,n) = (rhs(i,0,0,n) + rho - phi(i,0,0,n)*delta)
#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 mlalap_flux_x(Box const &box, Array4< RT > const &fx, Array4< RT const > const &sol, RT fac, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:101
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_normalize(Box const &box, Array4< RT > const &x, Array4< RT const > const &a, GpuArray< RT, AMREX_SPACEDIM > const &dxinv, RT alpha, RT beta, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:58
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_gsrb(Box const &box, Array4< RT > const &phi, Array4< RT const > const &rhs, RT alpha, RT dhx, Array4< RT const > const &a, Array4< RT const > const &f0, Array4< int const > const &m0, Array4< RT const > const &f1, Array4< int const > const &m1, Box const &vbox, int redblack, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:168
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_adotx_m(Box const &box, Array4< RT > const &y, Array4< RT const > const &x, Array4< RT const > const &a, GpuArray< RT, AMREX_SPACEDIM > const &dxinv, RT alpha, RT beta, RT dx, RT probxlo, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:31
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_adotx(Box const &box, Array4< RT > const &y, Array4< RT const > const &x, Array4< RT const > const &a, GpuArray< RT, AMREX_SPACEDIM > const &dxinv, RT alpha, RT beta, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:9
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 mlalap_flux_xface_m(Box const &box, Array4< RT > const &fx, Array4< RT const > const &sol, RT fac, int xlen, RT dx, RT probxlo, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:150
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_flux_x_m(Box const &box, Array4< RT > const &fx, Array4< RT const > const &sol, RT fac, RT dx, RT probxlo, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:117
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_flux_xface(Box const &box, Array4< RT > const &fx, Array4< RT const > const &sol, RT fac, int xlen, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:135
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_gsrb_m(Box const &box, Array4< RT > const &phi, Array4< RT const > const &rhs, RT alpha, RT dhx, Array4< RT const > const &a, Array4< RT const > const &f0, Array4< int const > const &m0, Array4< RT const > const &f1, Array4< int const > const &m1, Box const &vbox, int redblack, RT dx, RT probxlo, int ncomp)
Definition: AMReX_MLALap_1D_K.H:204
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlalap_normalize_m(Box const &box, Array4< RT > const &x, Array4< RT const > const &a, GpuArray< RT, AMREX_SPACEDIM > const &dxinv, RT alpha, RT beta, RT dx, RT probxlo, int ncomp) noexcept
Definition: AMReX_MLALap_1D_K.H:78
Definition: AMReX_Array4.H:61
Definition: AMReX_Array.H:34