1 #ifndef AMREX_MF_INTERP_1D_C_H_
2 #define AMREX_MF_INTERP_1D_C_H_
13 for (
int ns = 0; ns < ncomp; ++ns) {
18 Real df = Real(2.0) * (u(i+1,0,0,nu) - u(i ,0,0,nu));
19 Real db = Real(2.0) * (u(i ,0,0,nu) - u(i-1,0,0,nu));
26 if (dc != Real(0.0)) {
31 for (
int ns = 0; ns < ncomp; ++ns) {
32 slope(i,0,0,ns) *= sfx;
45 for (
int ns = 0; ns < ncomp; ++ns) {
50 Real df = Real(2.0) * (u(i+1,0,0,nu) - u(i ,0,0,nu));
51 Real db = Real(2.0) * (u(i ,0,0,nu) - u(i-1,0,0,nu));
54 if (dc != Real(0.0)) {
60 for (
int ns = 0; ns < ncomp; ++ns) {
61 slope(i,0,0,ns) *= sfx;
70 BCRec const* bc) noexcept
76 Real df = Real(2.0) * (u(i+1,0,0,nu) - u(i ,0,0,nu));
77 Real db = Real(2.0) * (u(i ,0,0,nu) - u(i-1,0,0,nu));
81 Real alpha = Real(1.0);
82 if (sx != Real(0.0)) {
83 Real dumax =
std::abs(sx) * Real(ratio[0]-1)/Real(2*ratio[0]);
84 Real umax = u(i,0,0,nu);
85 Real umin = u(i,0,0,nu);
86 for (
int ioff = -1; ioff <= 1; ++ioff) {
90 if (dumax * alpha > (umax - u(i,0,0,nu))) {
91 alpha = (umax - u(i,0,0,nu)) / dumax;
93 if (dumax * alpha > (u(i,0,0,nu) - umin)) {
94 alpha = (u(i,0,0,nu) - umin) / dumax;
98 slope(i,0,0,ns) = sx * alpha;
105 int ccomp,
int ,
IntVect const& ratio) noexcept
108 const Real xoff = (
static_cast<Real
>(i - ic*ratio[0]) + Real(0.5)) / Real(ratio[0]) - Real(0.5);
109 fine(i,0,0,fcomp+ns) =
crse(ic,0,0,ccomp+ns)
110 + xoff *
slope(ic,0,0,ns);
117 BCRec const* bc, Real drf, Real rlo) noexcept
123 Real df = Real(2.0) * (u(i+1,0,0,nu) - u(i ,0,0,nu));
124 Real db = Real(2.0) * (u(i ,0,0,nu) - u(i-1,0,0,nu));
128 Real alpha = Real(1.0);
129 if (sx != Real(0.0)) {
130 const Real drc = drf * ratio[0];
131 const Real rcm = i * drc + rlo;
132 const Real rcp = (i+1) * drc + rlo;
133 const Real vcm = rcm*rcm*rcm;
134 const Real vcp = rcp*rcp*rcp;
135 Real rfm = i*ratio[0] * drf + rlo;
136 Real rfp = (i*ratio[0] + 1) * drf + rlo;
137 Real vfm = rfm*rfm*rfm;
138 Real vfp = rfp*rfp*rfp;
139 Real xlo = Real(0.5) * ((vfm+vfp) - (vcm+vcp)) / (vcp - vcm);
140 rfm = ((i+1)*ratio[0] - 1) * drf + rlo;
141 rfp = (i+1)*ratio[0] * drf + rlo;
144 Real xhi = Real(0.5) * ((vfm+vfp) - (vcm+vcp)) / (vcp - vcm);
147 Real umax = u(i,0,0,nu);
148 Real umin = u(i,0,0,nu);
149 for (
int ioff = -1; ioff <= 1; ++ioff) {
153 if (dumax * alpha > (umax - u(i,0,0,nu))) {
154 alpha = (umax - u(i,0,0,nu)) / dumax;
156 if (dumin * alpha > (u(i,0,0,nu) - umin)) {
157 alpha = (u(i,0,0,nu) - umin) / dumin;
161 slope(i,0,0,ns) = sx * alpha;
167 int ccomp,
int ,
IntVect const& ratio, Real drf, Real rlo) noexcept
170 const Real drc = drf * ratio[0];
171 const Real rcm = ic * drc + rlo;
172 const Real rcp = (ic+1) * drc + rlo;
173 const Real rfm = i * drf + rlo;
174 const Real rfp = (i +1) * drf + rlo;
175 const Real vcm = rcm*rcm*rcm;
176 const Real vcp = rcp*rcp*rcp;
177 const Real vfm = rfm*rfm*rfm;
178 const Real vfp = rfp*rfp*rfp;
179 const Real xoff = Real(0.5) * ((vfm+vfp) - (vcm+vcp)) / (vcp - vcm);
180 fine(i,0,0,fcomp+ns) =
crse(ic,0,0,ccomp+ns)
181 + xoff *
slope(ic,0,0,ns);
190 int ioff = i - ic*ratio[0];
193 if (ioff*2 < ratio[0]) {
195 wx = Real(ratio[0]+1+2*ioff) / Real(2*ratio[0]);
198 wx = Real(3*ratio[0]-1-2*ioff) / Real(2*ratio[0]);
200 fine(i,0,0,n+fcomp) =
201 crse(ic ,0,0,n+ccomp)* wx +
202 crse(ic+sx,0,0,n+ccomp)*(Real(1.0)-wx);
210 int ioff = i - ic*ratio[0];
212 Real rxinv = Real(1.0) / Real(ratio[0]);
213 fine(i,0,0,n+fcomp) = rxinv*(
static_cast<Real
>(ratio[0]-ioff)*
crse(ic ,0,0,n+ccomp) +
214 static_cast<Real
>( ioff)*
crse(ic+1,0,0,n+ccomp));
216 fine(i,0,0,n+fcomp) =
crse(ic,0,0,n+ccomp);
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Array4< Real > fine
Definition: AMReX_InterpFaceRegister.cpp:90
Array4< Real > slope
Definition: AMReX_InterpFaceRegister.cpp:91
Array4< Real const > crse
Definition: AMReX_InterpFaceRegister.cpp:92
Boundary Condition Records. Necessary information and functions for computing boundary conditions.
Definition: AMReX_BCRec.H:17
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_cons_lin_interp_mcslope_sph(int i, int ns, Array4< Real > const &slope, Array4< Real const > const &u, int scomp, int, Box const &domain, IntVect const &ratio, BCRec const *bc, Real drf, Real rlo) noexcept
Definition: AMReX_MFInterp_1D_C.H:114
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_bilin_interp(int i, int, int, int n, Array4< T > const &fine, int fcomp, Array4< T const > const &crse, int ccomp, IntVect const &ratio) noexcept
Definition: AMReX_MFInterp_1D_C.H:186
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_cons_lin_interp_llslope(int i, int, int, Array4< Real > const &slope, Array4< Real const > const &u, int scomp, int ncomp, Box const &domain, IntVect const &, BCRec const *bc) noexcept
Definition: AMReX_MFInterp_1D_C.H:39
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & max(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:35
AMREX_GPU_HOST_DEVICE constexpr AMREX_FORCE_INLINE const T & min(const T &a, const T &b) noexcept
Definition: AMReX_Algorithm.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_cons_lin_interp_limit_minmax_llslope(int i, int, int, Array4< Real > const &slope, Array4< Real const > const &u, int scomp, int ncomp, Box const &domain, IntVect const &ratio, BCRec const *bc) noexcept
Definition: AMReX_MFInterp_1D_C.H:7
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T abs(const GpuComplex< T > &a_z) noexcept
Return the absolute value of a complex number.
Definition: AMReX_GpuComplex.H:356
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_cons_lin_interp_mcslope(int i, int, int, int ns, Array4< Real > const &slope, Array4< Real const > const &u, int scomp, int, Box const &domain, IntVect const &ratio, BCRec const *bc) noexcept
Definition: AMReX_MFInterp_1D_C.H:66
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_cons_lin_interp(int i, int, int, int ns, Array4< Real > const &fine, int fcomp, Array4< Real const > const &slope, Array4< Real const > const &crse, int ccomp, int, IntVect const &ratio) noexcept
Definition: AMReX_MFInterp_1D_C.H:102
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
This shuts up the compiler about unused variables.
Definition: AMReX.H:111
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_nodebilin_interp(int i, int, int, int n, Array4< Real > const &fine, int fcomp, Array4< Real const > const &crse, int ccomp, IntVect const &ratio) noexcept
Definition: AMReX_MFInterp_1D_C.H:206
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real mf_compute_slopes_x(int i, int j, int k, Array4< Real const > const &u, int nu, Box const &domain, BCRec const &bc)
Definition: AMReX_MFInterp_C.H:11
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void mf_cell_cons_lin_interp_sph(int i, int ns, Array4< Real > const &fine, int fcomp, Array4< Real const > const &slope, Array4< Real const > const &crse, int ccomp, int, IntVect const &ratio, Real drf, Real rlo) noexcept
Definition: AMReX_MFInterp_1D_C.H:165
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition: AMReX_Box.H:1304
Definition: AMReX_Array4.H:61