ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_AuxiliaryDiffusionFace.H
Go to the documentation of this file.
1 #ifndef ERF_AUXILIARY_DIFFUSION_FACE_H_
2 #define ERF_AUXILIARY_DIFFUSION_FACE_H_
3 
4 #include <AMReX_Array4.H>
5 #include <AMReX_GpuQualifiers.H>
6 #include <AMReX_REAL.H>
7 
8 namespace erf_auxiliary {
9 
10 /**
11  * Diffusive semantics of one nonperiodic domain face. A closed face carries no
12  * diffusive transfer. A Dirichlet face exchanges with the state held in the
13  * ghost cell beyond it, which is the value on the face, as ERF's ext_dir. A
14  * DirichletWhereInward face does so where the dry-air carrier is inward or
15  * zero and is closed where it is outward, as ERF's ext_dir_upwind.
16  */
18 
19 /** Whether one cell of a domain face exchanges; `carrier` is positive along +dir. */
20 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool
21 DiffusionFaceIsOpen (const DiffusionFaceKind kind, const bool low_face,
22  const amrex::Real carrier) noexcept
23 {
24  if (kind == DiffusionFaceKind::Dirichlet) { return true; }
26  return low_face ? carrier >= amrex::Real(0.0) : carrier <= amrex::Real(0.0);
27  }
28  return false;
29 }
30 
31 /**
32  * Whether the domain face cell (i, j, k), on the low or high face of a
33  * direction, exchanges. `carrier` is that direction's dry-air carrier on the
34  * face layout, read only on a DirichletWhereInward face. The low- and
35  * high-order diffusive rates both take their open faces from here, so a face
36  * the limiter blends is open, or closed, in both.
37  */
38 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool
39 DiffusionDomainFaceIsOpen (const bool low_face, const DiffusionFaceKind kind_lo,
40  const DiffusionFaceKind kind_hi,
41  const amrex::Array4<const amrex::Real>& carrier,
42  const int i, const int j, const int k) noexcept
43 {
44  const DiffusionFaceKind kind = low_face ? kind_lo : kind_hi;
45  const amrex::Real sign = kind == DiffusionFaceKind::DirichletWhereInward
46  ? carrier(i, j, k, 0) : amrex::Real(0.0);
47  return DiffusionFaceIsOpen(kind, low_face, sign);
48 }
49 
50 } // namespace erf_auxiliary
51 
52 #endif
Definition: ERF_AuxiliaryDiffusion.cpp:10
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool DiffusionFaceIsOpen(const DiffusionFaceKind kind, const bool low_face, const amrex::Real carrier) noexcept
Definition: ERF_AuxiliaryDiffusionFace.H:21
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool DiffusionDomainFaceIsOpen(const bool low_face, const DiffusionFaceKind kind_lo, const DiffusionFaceKind kind_hi, const amrex::Array4< const amrex::Real > &carrier, const int i, const int j, const int k) noexcept
Definition: ERF_AuxiliaryDiffusionFace.H:39
DiffusionFaceKind
Definition: ERF_AuxiliaryDiffusionFace.H:17