1 #ifndef AMREX_EB_FLUXREGISTER_2D_C_H_
2 #define AMREX_EB_FLUXREGISTER_2D_C_H_
3 #include <AMReX_Config.H>
12 Real dtdx, Real dtdy,
int ncomp)
15 && vfrac(i,j,k) > Real(1.e-14))
17 Real volinv = Real(1.0)/vfrac(i,j,k);
20 Real tmp = dtdx*ax(i,j,k)*volinv;
21 for (
int n = 0; n < ncomp; ++n) {
22 d(i,j,k,n) -= tmp*fx(i,j,k,n);
25 Real tmp = dtdx*ax(i+1,j,k)*volinv;
26 for (
int n = 0; n < ncomp; ++n) {
27 d(i,j,k,n) += tmp*fx(i+1,j,k,n);
32 Real tmp = dtdy*ay(i,j,k)*volinv;
33 for (
int n = 0; n < ncomp; ++n) {
34 d(i,j,k,n) -= tmp*fy(i,j,k,n);
37 Real tmp = dtdy*ay(i,j+1,k)*volinv;
38 for (
int n = 0; n < ncomp; ++n) {
39 d(i,j,k,n) += tmp*fy(i,j+1,k,n);
47 Dim3 const& ratio, Real threshold) noexcept
49 Real cvol = Real(0.0);
51 for (
int jj = j*ratio.y; jj < (j+1)*ratio.y; ++jj) {
52 for (
int ii = i*ratio.x; ii < (i+1)*ratio.x; ++ii) {
53 cvol += vfrac(ii,jj,kk);
56 return (cvol > threshold) ? Real(1.0)/cvol : Real(0.0);
65 int ii = (i+1)*ratio.
x;
67 for (
int jj = j*ratio.
y; jj < (j+1)*ratio.
y; ++jj) {
68 if (
f.contains(ii,jj,kk)) {
69 fa +=
f(ii,jj,kk,n) * a(ii,jj,kk);
85 for (
int jj = j*ratio.
y; jj < (j+1)*ratio.
y; ++jj) {
86 if (
f.contains(ii,jj,kk)) {
87 fa +=
f(ii,jj,kk,n) * a(ii,jj,kk);
100 constexpr
int kk = 0;
101 int jj = (j+1)*ratio.
y;
103 for (
int ii = i*ratio.
x; ii < (i+1)*ratio.
x; ++ii) {
104 if (
f.contains(ii,jj,kk)) {
105 fa +=
f(ii,jj,kk,n) * a(ii,jj,kk);
118 constexpr
int kk = 0;
121 for (
int ii = i*ratio.
x; ii < (i+1)*ratio.
x; ++ii) {
122 if (
f.contains(ii,jj,kk)) {
123 fa +=
f(ii,jj,kk,n) * a(ii,jj,kk);
134 Dim3 const& ratio, Real threshold)
136 Real dmtot = Real(0.0);
137 constexpr
int kk = 0;
138 for (
int jj = j*ratio.
y; jj < (j+1)*ratio.
y; ++jj) {
139 for (
int ii = i*ratio.
x; ii < (i+1)*ratio.
x; ++ii) {
141 dmtot += dm(ii,jj,kk,n);
157 auto flag = ebflg(i,j,k);
158 if (flag.isRegular())
165 else if (flag.isSingleValued())
167 Real dm = s(i,j,k,n) * vfrac(i,j,k);
172 Real wtot = Real(0.0);
173 for (
int jj = -1; jj <= 1; ++jj) {
174 for (
int ii = -1; ii <= 1; ++ii) {
175 if ((ii != 0 || jj != 0) && flag.isConnected(ii,jj,0)) {
176 wtot += vfrac(i+ii,j+jj,k);
180 Real drho = dm * ((Real(1.0)-vfrac(i,j,k))/wtot);
181 for (
int jj = -1; jj <= 1; ++jj) {
182 for (
int ii = -1; ii <= 1; ++ii) {
183 if ((ii != 0 || jj != 0) && flag.isConnected(ii,jj,0)) {
199 if (msk(ic,jc,0) == 1) {
200 d(i,j,0,n) += s(ic,jc,0,n);
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
constexpr int amrex_yafluxreg_fine_cell
Definition: AMReX_YAFluxRegister_K.H:8
constexpr int amrex_yafluxreg_crse_fine_boundary_cell
Definition: AMReX_YAFluxRegister_K.H:7
AMREX_GPU_HOST_DEVICE bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition: AMReX_Box.H:204
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void Add(T *const sum, T const value) noexcept
Definition: AMReX_GpuAtomic.H:619
static int f(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:44
Definition: AMReX_Amr.cpp:49
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_rereflux_to_fine(int i, int j, int, int n, Array4< Real > const &d, Array4< Real const > const &s, Array4< int const > const &msk, Dim3 ratio)
Definition: AMReX_EBFluxRegister_2D_C.H:194
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_flux_reg_fineadd_va_xlo(int i, int j, int k, int n, Array4< Real > const &d, Array4< Real const > const &f, Array4< Real const > const &vfrac, Array4< Real const > const &a, Real fac, Dim3 const &ratio)
Definition: AMReX_EBFluxRegister_2D_C.H:60
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_flux_reg_fineadd_va_yhi(int i, int j, int k, int n, Array4< Real > const &d, Array4< Real const > const &f, Array4< Real const > const &vfrac, Array4< Real const > const &a, Real fac, Dim3 const &ratio)
Definition: AMReX_EBFluxRegister_2D_C.H:114
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real eb_flux_reg_cvol(int i, int j, Array4< Real const > const &vfrac, Dim3 const &ratio, Real threshold) noexcept
Definition: AMReX_EBFluxRegister_2D_C.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_flux_reg_fineadd_dm(int i, int j, int k, int n, Box const &dmbx, Array4< Real > const &d, Array4< Real const > const &dm, Array4< Real const > const &vfrac, Dim3 const &ratio, Real threshold)
Definition: AMReX_EBFluxRegister_2D_C.H:132
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_flux_reg_fineadd_va_ylo(int i, int j, int k, int n, Array4< Real > const &d, Array4< Real const > const &f, Array4< Real const > const &vfrac, Array4< Real const > const &a, Real fac, Dim3 const &ratio)
Definition: AMReX_EBFluxRegister_2D_C.H:96
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_flux_reg_fineadd_va_xhi(int i, int j, int k, int n, Array4< Real > const &d, Array4< Real const > const &f, Array4< Real const > const &vfrac, Array4< Real const > const &a, Real fac, Dim3 const &ratio)
Definition: AMReX_EBFluxRegister_2D_C.H:78
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_rereflux_from_crse(int i, int j, int k, int n, Box const &bx, Array4< Real > const &d, Array4< Real const > const &s, Array4< int const > const &amrflg, Array4< EBCellFlag const > const &ebflg, Array4< Real const > const &vfrac)
Definition: AMReX_EBFluxRegister_2D_C.H:151
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
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void eb_flux_reg_crseadd_va(int i, int j, int k, Array4< Real > const &d, Array4< int const > const &flag, Array4< Real const > const &fx, Array4< Real const > const &fy, Array4< Real const > const &vfrac, Array4< Real const > const &ax, Array4< Real const > const &ay, Real dtdx, Real dtdy, int ncomp)
Definition: AMReX_EBFluxRegister_2D_C.H:8
Definition: AMReX_Array4.H:61
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE T * ptr(int i, int j, int k) const noexcept
Definition: AMReX_Array4.H:149
Definition: AMReX_Dim3.H:12
int x
Definition: AMReX_Dim3.H:12
int y
Definition: AMReX_Dim3.H:12