1 #ifndef AMREX_MLPOISSON_1D_K_H_
2 #define AMREX_MLPOISSON_1D_K_H_
3 #include <AMReX_Config.H>
13 y(i,0,0) = dhx * (
x(i-1,0,0) - T(2.0)*
x(i,0,0) +
x(i+1,0,0));
23 if (osm(i,0,0) == 0) {
26 y(i,0,0) = dhx * (
x(i-1,0,0) - T(2.0)*
x(i,0,0) +
x(i+1,0,0));
34 T dhx, T dx, T probxlo) noexcept
36 T rel = (probxlo + i *dx) * (probxlo + i *dx);
37 T rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
38 y(i,0,0) = dhx * (rel*
x(i-1,0,0) - (rel+rer)*
x(i,0,0) + rer*
x(i+1,0,0));
50 for (
int i = lo.x; i <= hi.x; ++i) {
51 fx(i,0,0) = dxinv*(sol(i,0,0)-sol(i-1,0,0));
59 T dx, T probxlo) noexcept
65 for (
int i = lo.x; i <= hi.x; ++i) {
66 T re = (probxlo + i*dx) * (probxlo + i*dx);
67 fx(i,0,0) = dxinv*re*(sol(i,0,0)-sol(i-1,0,0));
79 fx(i,0,0) = dxinv*(sol(i,0,0)-sol(i-1,0,0));
81 fx(i,0,0) = dxinv*(sol(i,0,0)-sol(i-1,0,0));
88 T dx, T probxlo) noexcept
93 T re = (probxlo + i*dx) * (probxlo + i*dx);
94 fx(i,0,0) = dxinv*re*(sol(i,0,0)-sol(i-1,0,0));
96 re = (probxlo + i*dx) * (probxlo + i*dx);
97 fx(i,0,0) = dxinv*re*(sol(i,0,0)-sol(i-1,0,0));
100 template <
typename T>
106 Box const& vbox,
int redblack) noexcept
111 T gamma = -dhx*T(2.0);
113 if ((i+redblack)%2 == 0) {
114 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
115 ? f0(vlo.x,0,0) : T(0.0);
116 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
117 ? f1(vhi.x,0,0) : T(0.0);
119 T g_m_d = gamma + dhx*(cf0+cf1);
121 T res = rhs(i,0,0) - gamma*phi(i,0,0)
122 - dhx*(phi(i-1,0,0) + phi(i+1,0,0));
124 phi(i,0,0) = phi(i,0,0) + res /g_m_d;
128 template <
typename T>
134 Box const& vbox,
int redblack) noexcept
139 T gamma = -dhx*T(2.0);
141 if ((i+redblack)%2 == 0) {
142 if (osm(i,0,0) == 0) {
145 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
146 ? f0(vlo.x,0,0) : T(0.0);
147 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
148 ? f1(vhi.x,0,0) : T(0.0);
150 T g_m_d = gamma + dhx*(cf0+cf1);
152 T res = rhs(i,0,0) - gamma*phi(i,0,0)
153 - dhx*(phi(i-1,0,0) + phi(i+1,0,0));
155 phi(i,0,0) = phi(i,0,0) + res /g_m_d;
160 template <
typename T>
166 Box const& vbox,
int redblack, T dx, T probxlo) noexcept
171 if ((i+redblack)%2 == 0) {
172 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
173 ? f0(vlo.x,0,0) : T(0.0);
174 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
175 ? f1(vhi.x,0,0) : T(0.0);
177 T rel = (probxlo + i *dx) * (probxlo + i *dx);
178 T rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
180 T gamma = -dhx*(rel+rer);
182 T g_m_d = gamma + dhx*(rel*cf0+rer*cf1);
184 T res = rhs(i,0,0) - gamma*phi(i,0,0)
185 - dhx*(rel*phi(i-1,0,0) + rer*phi(i+1,0,0));
187 phi(i,0,0) = phi(i,0,0) + res /g_m_d;
191 template <
typename T>
197 Box const& vbox) noexcept
202 T gamma = -dhx*T(2.0);
204 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
205 ? f0(vlo.x,0,0) : T(0.0);
206 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
207 ? f1(vhi.x,0,0) : T(0.0);
209 T g_m_d = gamma + dhx*(cf0+cf1);
211 phi(i,0,0) += T(2.0/3.0) * (rhs(i,0,0) - Ax(i,0,0)) / g_m_d;
214 template <
typename T>
220 Box const& vbox) noexcept
225 if (osm(i,0,0) == 0) {
228 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
229 ? f0(vlo.x,0,0) : T(0.0);
230 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
231 ? f1(vhi.x,0,0) : T(0.0);
233 T gamma = -dhx*T(2.0);
234 T g_m_d = gamma + dhx*(cf0+cf1);
236 phi(i,0,0) += T(2.0/3.0) * (rhs(i,0,0) - Ax(i,0,0)) / g_m_d;
240 template <
typename T>
246 Box const& vbox, T dx, T probxlo) noexcept
251 T cf0 = (i == vlo.x && m0(vlo.x-1,0,0) > 0)
252 ? f0(vlo.x,0,0) : T(0.0);
253 T cf1 = (i == vhi.x && m1(vhi.x+1,0,0) > 0)
254 ? f1(vhi.x,0,0) : T(0.0);
256 T rel = (probxlo + i *dx) * (probxlo + i *dx);
257 T rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
259 T gamma = -dhx*(rel+rer);
261 T g_m_d = gamma + dhx*(rel*cf0+rer*cf1);
263 phi(i,0,0) += T(2.0/3.0) * (rhs(i,0,0) - Ax(i,0,0)) / g_m_d;
266 template <
typename T>
269 T dhx, T dx, T probxlo) noexcept
271 T rel = (probxlo + i *dx) * (probxlo + i *dx);
272 T rer = (probxlo +(i+1)*dx) * (probxlo +(i+1)*dx);
273 x(i,0,0) /= (-dhx*(rel+rer));
#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 mlpoisson_jacobi(int i, int, int, Array4< T > const &phi, Array4< T const > const &rhs, Array4< T const > const &Ax, T dhx, Array4< T const > const &f0, Array4< int const > const &m0, Array4< T const > const &f1, Array4< int const > const &m1, Box const &vbox) noexcept
Definition: AMReX_MLPoisson_1D_K.H:193
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_adotx_m(int i, Array4< T > const &y, Array4< T const > const &x, T dhx, T dx, T probxlo) noexcept
Definition: AMReX_MLPoisson_1D_K.H:32
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_gsrb_m(int i, int, int, Array4< T > const &phi, Array4< T const > const &rhs, T dhx, Array4< T const > const &f0, Array4< int const > const &m0, Array4< T const > const &f1, Array4< int const > const &m1, Box const &vbox, int redblack, T dx, T probxlo) noexcept
Definition: AMReX_MLPoisson_1D_K.H:162
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_flux_x(Box const &box, Array4< T > const &fx, Array4< T const > const &sol, T dxinv) noexcept
Definition: AMReX_MLPoisson_1D_K.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_adotx(int i, Array4< T > const &y, Array4< T const > const &x, T dhx) noexcept
Definition: AMReX_MLPoisson_1D_K.H:9
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_flux_xface_m(Box const &box, Array4< T > const &fx, Array4< T const > const &sol, T dxinv, int xlen, T dx, T probxlo) noexcept
Definition: AMReX_MLPoisson_1D_K.H:86
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_jacobi_os(int i, int, int, Array4< T > const &phi, Array4< T const > const &rhs, Array4< T const > const &Ax, Array4< int const > const &osm, T dhx, Array4< T const > const &f0, Array4< int const > const &m0, Array4< T const > const &f1, Array4< int const > const &m1, Box const &vbox) noexcept
Definition: AMReX_MLPoisson_1D_K.H:216
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_flux_x_m(Box const &box, Array4< T > const &fx, Array4< T const > const &sol, T dxinv, T dx, T probxlo) noexcept
Definition: AMReX_MLPoisson_1D_K.H:57
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_gsrb(int i, int, int, Array4< T > const &phi, Array4< T const > const &rhs, T dhx, Array4< T const > const &f0, Array4< int const > const &m0, Array4< T const > const &f1, Array4< int const > const &m1, Box const &vbox, int redblack) noexcept
Definition: AMReX_MLPoisson_1D_K.H:102
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 mlpoisson_flux_xface(Box const &box, Array4< T > const &fx, Array4< T const > const &sol, T dxinv, int xlen) noexcept
Definition: AMReX_MLPoisson_1D_K.H:73
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_normalize(int i, int, int, Array4< T > const &x, T dhx, T dx, T probxlo) noexcept
Definition: AMReX_MLPoisson_1D_K.H:268
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_gsrb_os(int i, int, int, Array4< T > const &phi, Array4< T const > const &rhs, Array4< int const > const &osm, T dhx, Array4< T const > const &f0, Array4< int const > const &m0, Array4< T const > const &f1, Array4< int const > const &m1, Box const &vbox, int redblack) noexcept
Definition: AMReX_MLPoisson_1D_K.H:130
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_adotx_os(int i, Array4< T > const &y, Array4< T const > const &x, Array4< int const > const &osm, T dhx) noexcept
Definition: AMReX_MLPoisson_1D_K.H:18
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mlpoisson_jacobi_m(int i, int, int, Array4< T > const &phi, Array4< T const > const &rhs, Array4< T const > const &Ax, T dhx, Array4< T const > const &f0, Array4< int const > const &m0, Array4< T const > const &f1, Array4< int const > const &m1, Box const &vbox, T dx, T probxlo) noexcept
Definition: AMReX_MLPoisson_1D_K.H:242
Definition: AMReX_Array4.H:61