Block-Structured AMR Software Framework
AMReX_FluxReg_1D_C.H
Go to the documentation of this file.
1 #ifndef AMREX_FLUXREG_1D_C_H_
2 #define AMREX_FLUXREG_1D_C_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_FArrayBox.H>
6 
7 namespace amrex {
8 
9 
25 AMREX_GPU_HOST_DEVICE inline void
26 fluxreg_fineadd (Box const& bx, Array4<Real> const& reg, const int rcomp,
27  Array4<Real const> const& flx, const int fcomp, const int ncomp,
28  const int /*dir*/, Dim3 const& ratio, const Real mult) noexcept
29 {
30  const auto lo = amrex::lbound(bx);
31  const int ic = lo.x;
32  const int i = ic*ratio.x;
33  for (int n = 0; n < ncomp; ++n) {
34  reg(ic,0,0,n+rcomp) += mult * flx(i,0,0,n+fcomp);
35  }
36 }
37 
38 
55 AMREX_GPU_HOST_DEVICE inline void
56 fluxreg_fineareaadd (Box const& bx, Array4<Real> const& reg, const int rcomp,
57  Array4<Real const> const& area,
58  Array4<Real const> const& flx, const int fcomp, const int ncomp,
59  const int /*dir*/, Dim3 const& ratio, const Real mult) noexcept
60 {
61  const auto lo = amrex::lbound(bx);
62  const int ic = lo.x;
63  const int i = ic*ratio.x;
64  for (int n = 0; n < ncomp; ++n) {
65  reg(ic,0,0,n+rcomp) += mult * area(i,0,0) * flx(i,0,0,n+fcomp);
66  }
67 }
68 
69 AMREX_GPU_HOST_DEVICE inline void
70 fluxreg_reflux (Box const& bx, Array4<Real> const& s, const int scomp,
71  Array4<Real const> const& f, Array4<Real const> const& v,
72  const int ncomp, const Real mult, const Orientation face) noexcept
73 {
74  const auto lo = amrex::lbound(bx);
75  const auto hi = amrex::ubound(bx);
76  if (face.isLow()) {
77  for (int n = 0; n < ncomp; ++n) {
78  for (int i = lo.x; i <= hi.x; ++i) {
79  s(i,0,0,n+scomp) += -mult*f(i+1,0,0,n)/v(i,0,0);
80  }
81  }
82  } else {
83  for (int n = 0; n < ncomp; ++n) {
84  for (int i = lo.x; i <= hi.x; ++i) {
85  s(i,0,0,n+scomp) += mult*f(i,0,0,n)/v(i,0,0);
86  }
87  }
88  }
89 }
90 
91 }
92 
93 #endif
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
Encapsulation of the Orientation of the Faces of a Box.
Definition: AMReX_Orientation.H:29
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 void fluxreg_fineadd(Box const &bx, Array4< Real > const &reg, const int rcomp, Array4< Real const > const &flx, const int fcomp, const int ncomp, const int, Dim3 const &ratio, const Real mult) noexcept
Add fine grid flux to flux register. Flux array is a fine grid edge based object, Register is a coars...
Definition: AMReX_FluxReg_1D_C.H:26
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 void fluxreg_fineareaadd(Box const &bx, Array4< Real > const &reg, const int rcomp, Array4< Real const > const &area, Array4< Real const > const &flx, const int fcomp, const int ncomp, const int, Dim3 const &ratio, const Real mult) noexcept
Add fine grid flux times area to flux register. Flux array is a fine grid edge based object,...
Definition: AMReX_FluxReg_1D_C.H:56
AMREX_GPU_HOST_DEVICE void fluxreg_reflux(Box const &bx, Array4< Real > const &s, const int scomp, Array4< Real const > const &f, Array4< Real const > const &v, const int ncomp, const Real mult, const Orientation face) noexcept
Definition: AMReX_FluxReg_1D_C.H:70
Definition: AMReX_Array4.H:61
Definition: AMReX_Dim3.H:12