chombo-discharge
CD_CoarseInterpQuadCF.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2023 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_CoarseInterpQuadCF_H
13 #define CD_CoarseInterpQuadCF_H
14 
15 // Chombo includes
16 #include <IntVect.H>
17 #include <FArrayBox.H>
18 #include <LoHiSide.H>
19 #include <DerivStencil.H>
20 #include <DisjointBoxLayout.H>
21 
22 // Our includes
23 #include <CD_NamespaceHeader.H>
24 
33 {
34 public:
38  CoarseInterpQuadCF() noexcept;
39 
43  virtual ~CoarseInterpQuadCF() noexcept;
44 
55  virtual void
56  define(const DisjointBoxLayout& a_dblFine,
57  const ProblemDomain& a_domainCoar,
58  const DataIndex& a_dit,
59  const Box& a_fineGhostCells,
60  const int a_refRat,
61  const int a_ignoreDir) noexcept;
62 
70  virtual Real
71  computeFirstDeriv(const FArrayBox& a_coarPhi,
72  const IntVect& a_ivCoar,
73  const int a_dir,
74  const int a_coarVar) const noexcept;
75 
83  virtual Real
84  computeSecondDeriv(const FArrayBox& a_coarPhi,
85  const IntVect& a_ivCoar,
86  const int a_dir,
87  const int a_coarVar) const noexcept;
88 
95  virtual Real
96  computeMixedDeriv(const FArrayBox& a_coarPhi, const IntVect& a_ivCoar, const int a_coarVar) const noexcept;
97 
98 protected:
102  enum class FirstDerivStencil : unsigned short
103  {
104  Centered2,
105  Backward2,
106  Forward2,
107  Backward1,
108  Forward1,
109  };
110 
114  enum class SecondDerivStencil : unsigned short
115  {
116  Centered2,
117  Backward1,
118  Forward1
119  };
120 
124  enum class MixedDerivStencil : unsigned short
125  {
126  Standard,
127  Explicit
128  };
129 
134 
138  DisjointBoxLayout m_dblFine;
139 
143  ProblemDomain m_domainCoar;
144 
148  DataIndex m_dit;
149 
154 
159 
164 
168  int m_refRat;
169 
175 
179  BaseFab<FirstDerivStencil> m_firstDerivStencils[SpaceDim];
180 
184  BaseFab<SecondDerivStencil> m_secondDerivStencils[SpaceDim];
185 
189  BaseFab<MixedDerivStencil> m_mixedDerivStencils;
190 
194  BaseFab<DerivStencil> m_explicitMixedDerivStencils;
195 
200  virtual void
201  defineStencils() noexcept;
202 
207  virtual void
208  defineMixedDerivStencils() noexcept;
209 };
210 
211 #include <CD_NamespaceFooter.H>
212 
213 #endif
Class for computing the required Taylor terms for doing the orthogonal extrapolation to the ghost cel...
Definition: CD_CoarseInterpQuadCF.H:33
virtual Real computeFirstDeriv(const FArrayBox &a_coarPhi, const IntVect &a_ivCoar, const int a_dir, const int a_coarVar) const noexcept
Compute first-derivative Taylor term in direction a_dir.
Definition: CD_CoarseInterpQuadCF.cpp:208
virtual Real computeMixedDeriv(const FArrayBox &a_coarPhi, const IntVect &a_ivCoar, const int a_coarVar) const noexcept
Compute mixed-derivative Taylor term in directions orthogonal m_ignoreDir.
Definition: CD_CoarseInterpQuadCF.cpp:313
int m_tanDir1
One tangential direction.
Definition: CD_CoarseInterpQuadCF.H:158
CoarseInterpQuadCF() noexcept
Default constructor. Must subsequently call the define function.
Definition: CD_CoarseInterpQuadCF.cpp:21
bool m_isDefined
Is defined or not.
Definition: CD_CoarseInterpQuadCF.H:133
BaseFab< DerivStencil > m_explicitMixedDerivStencils
Mixed-derivative stencil. Only defined in 3D.
Definition: CD_CoarseInterpQuadCF.H:194
int m_tanDir2
One tangential direction.
Definition: CD_CoarseInterpQuadCF.H:163
int m_ignoreDir
Interpolation direction to ignore.
Definition: CD_CoarseInterpQuadCF.H:153
BaseFab< MixedDerivStencil > m_mixedDerivStencils
Identifier for whether or not we should use a standard or explicit mixed derivative stencil.
Definition: CD_CoarseInterpQuadCF.H:189
ProblemDomain m_domainCoar
Coarse domain.
Definition: CD_CoarseInterpQuadCF.H:143
FirstDerivStencil
Simple enum for holding stencil types for the first derivative.
Definition: CD_CoarseInterpQuadCF.H:103
MixedDerivStencil
Simple enum for holding stencil types for the mixed derivative.
Definition: CD_CoarseInterpQuadCF.H:125
DataIndex m_dit
Data index in the fine grid.
Definition: CD_CoarseInterpQuadCF.H:148
DisjointBoxLayout m_dblFine
Fine grids.
Definition: CD_CoarseInterpQuadCF.H:138
SecondDerivStencil
Simple enum for holding stencil types for the second derivative.
Definition: CD_CoarseInterpQuadCF.H:115
virtual Real computeSecondDeriv(const FArrayBox &a_coarPhi, const IntVect &a_ivCoar, const int a_dir, const int a_coarVar) const noexcept
Compute second-derivative Taylor term in direction a_dir.
Definition: CD_CoarseInterpQuadCF.cpp:266
int m_refRat
Refinement factor to coarse.
Definition: CD_CoarseInterpQuadCF.H:168
virtual void define(const DisjointBoxLayout &a_dblFine, const ProblemDomain &a_domainCoar, const DataIndex &a_dit, const Box &a_fineGhostCells, const int a_refRat, const int a_ignoreDir) noexcept
Define function. Puts object in usable state.
Definition: CD_CoarseInterpQuadCF.cpp:34
BaseFab< FirstDerivStencil > m_firstDerivStencils[SpaceDim]
Stencil types for first derivative.
Definition: CD_CoarseInterpQuadCF.H:179
Box m_stencilBox
Coarse-grid cells corresponding to the fine-grid ghost cells.
Definition: CD_CoarseInterpQuadCF.H:174
virtual ~CoarseInterpQuadCF() noexcept
Destructor.
Definition: CD_CoarseInterpQuadCF.cpp:28
virtual void defineStencils() noexcept
Compute all first-derivative stencils in the coarse grid cells.
Definition: CD_CoarseInterpQuadCF.cpp:84
virtual void defineMixedDerivStencils() noexcept
Compute all second-derivative stencils in the coarse grid cells.
Definition: CD_CoarseInterpQuadCF.cpp:139
BaseFab< SecondDerivStencil > m_secondDerivStencils[SpaceDim]
Second-derivative stencils (in all directions except m_dir)
Definition: CD_CoarseInterpQuadCF.H:184