Block-Structured AMR Software Framework
AMReX_Habec_K.H
Go to the documentation of this file.
1 #ifndef AMREX_Habec_K_H_
2 #define AMREX_Habec_K_H_
3 #include <AMReX_Config.H>
4 
5 #include <AMReX_LO_BCTYPES.H>
6 #include <AMReX_FArrayBox.H>
7 #include <AMReX_IArrayBox.H>
8 
9 namespace amrex::detail {
11  void comp_bf (Real& bf1, Real& bf2, Real sb, Real h, int bct, Real bcl, int bho)
12  {
13  Real fac = sb / (h*h);
14  if (bct == AMREX_LO_DIRICHLET) {
15  Real h2 = Real(0.5)*h;
16  if (bho >= 1) {
17  Real h3 = Real(3.0)*h2;
18  bf1 = fac*((h3 - bcl)/(bcl + h2) - Real(1.0));
19  bf2 = fac*(bcl - h2)/(bcl + h3);
20  } else {
21  bf1 = fac*( h/(bcl + h2) - Real(1.0));
22  bf2 = Real(0.0);
23  }
24  } else if (bct == AMREX_LO_NEUMANN) {
25  bf1 = -fac;
26  bf2 = Real(0.0);
27  } else {
28  bf1 = bf2 = Real(0.0);
29  AMREX_ASSERT_WITH_MESSAGE(false,"hpmat: unsupported boundary type");
30  }
31  }
32 
34  void comp_bflo (Real& bf1, Real& bf2, Real& bflo, Real sb, Real h, int bct, Real bcl, int bho)
35  {
36  Real fac = sb / (h*h);
37  if (bct == AMREX_LO_DIRICHLET) {
38  Real h2 = Real(0.5)*h;
39  bflo = fac * ( h / (bcl + h2) - Real(1.0));
40  if (bho >= 1) {
41  Real h3 = Real(3.0)*h2;
42  bf1 = fac*((h3 - bcl)/(bcl + h2) - Real(1.0));
43  bf2 = fac*(bcl - h2)/(bcl + h3);
44  } else {
45  bf1 = bflo;
46  bf2 = Real(0.0);
47  }
48  } else if (bct == AMREX_LO_NEUMANN) {
49  bflo = -fac;
50  bf1 = -fac;
51  bf2 = Real(0.0);
52  } else {
53  bf1 = bf2 = bflo = Real(0.0);
54  AMREX_ASSERT_WITH_MESSAGE(false,"hpmat: unsupported boundary type");
55  }
56  }
57 }
58 
59 #if (AMREX_SPACEDIM == 2)
60 #include <AMReX_Habec_2D_K.H>
61 #elif (AMREX_SPACEDIM == 3)
62 #include <AMReX_Habec_3D_K.H>
63 #endif
64 
65 #endif
#define AMREX_ASSERT_WITH_MESSAGE(EX, MSG)
Definition: AMReX_BLassert.H:37
#define AMREX_FORCE_INLINE
Definition: AMReX_Extension.H:119
#define AMREX_GPU_HOST_DEVICE
Definition: AMReX_GpuQualifiers.H:20
#define AMREX_LO_NEUMANN
Definition: AMReX_LO_BCTYPES.H:6
#define AMREX_LO_DIRICHLET
Definition: AMReX_LO_BCTYPES.H:5
Definition: AMReX_FillPatchUtil_I.H:7
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void comp_bf(Real &bf1, Real &bf2, Real sb, Real h, int bct, Real bcl, int bho)
Definition: AMReX_Habec_K.H:11
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void comp_bflo(Real &bf1, Real &bf2, Real &bflo, Real sb, Real h, int bct, Real bcl, int bho)
Definition: AMReX_Habec_K.H:34