Block-Structured AMR Software Framework
 
Loading...
Searching...
No Matches
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#if (AMREX_SPACEDIM == 1)
6
7#include <AMReX_FArrayBox.H>
8
9namespace amrex {
10
11
27AMREX_GPU_HOST_DEVICE inline void
28fluxreg_fineadd (Box const& bx, Array4<Real> const& reg, const int rcomp,
29 Array4<Real const> const& flx, const int fcomp, const int ncomp,
30 const int /*dir*/, Dim3 const& ratio, const Real mult) noexcept
31{
32 const auto lo = amrex::lbound(bx);
33 const int ic = lo.x;
34 const int i = ic*ratio.x;
35 for (int n = 0; n < ncomp; ++n) {
36 reg(ic,0,0,n+rcomp) += mult * flx(i,0,0,n+fcomp);
37 }
38}
39
40
57AMREX_GPU_HOST_DEVICE inline void
58fluxreg_fineareaadd (Box const& bx, Array4<Real> const& reg, const int rcomp,
59 Array4<Real const> const& area,
60 Array4<Real const> const& flx, const int fcomp, const int ncomp,
61 const int /*dir*/, Dim3 const& ratio, const Real mult) noexcept
62{
63 const auto lo = amrex::lbound(bx);
64 const int ic = lo.x;
65 const int i = ic*ratio.x;
66 for (int n = 0; n < ncomp; ++n) {
67 reg(ic,0,0,n+rcomp) += mult * area(i,0,0) * flx(i,0,0,n+fcomp);
68 }
69}
70
71AMREX_GPU_HOST_DEVICE inline void
72fluxreg_reflux (Box const& bx, Array4<Real> const& s, const int scomp,
73 Array4<Real const> const& f, Array4<Real const> const& v,
74 const int ncomp, const Real mult, const Orientation face) noexcept
75{
76 const auto lo = amrex::lbound(bx);
77 const auto hi = amrex::ubound(bx);
78 if (face.isLow()) {
79 for (int n = 0; n < ncomp; ++n) {
80 for (int i = lo.x; i <= hi.x; ++i) {
81 s(i,0,0,n+scomp) += -mult*f(i+1,0,0,n)/v(i,0,0);
82 }
83 }
84 } else {
85 for (int n = 0; n < ncomp; ++n) {
86 for (int i = lo.x; i <= hi.x; ++i) {
87 s(i,0,0,n+scomp) += mult*f(i,0,0,n)/v(i,0,0);
88 }
89 }
90 }
91}
92
93}
94
95#endif
96
97#endif
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
Definition AMReX_Amr.cpp:49
__host__ __device__ Dim3 ubound(Array4< T > const &a) noexcept
Definition AMReX_Array4.H:319
__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_3D_C.H:185
BoxND< 3 > Box
Definition AMReX_BaseFwd.H:27
__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 dir, 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_3D_C.H:27
__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 dir, 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_3D_C.H:113
__host__ __device__ Dim3 lbound(Array4< T > const &a) noexcept
Definition AMReX_Array4.H:312