Chombo + EB + MF  3.2
QuadCFInterp.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _QUADCFINTERP_H_
12 #define _QUADCFINTERP_H_
13 
14 #include <iostream>
15 #include <cmath>
16 #include "SPACE.H"
17 #include <cstdlib>
18 #include "REAL.H"
19 #include "IntVect.H"
20 #include "Box.H"
21 #include "BaseFab.H"
22 #include "DisjointBoxLayout.H"
23 #include "LevelData.H"
24 #include "FArrayBox.H"
25 #include "QuadCFStencil.H"
26 #include "ProblemDomain.H"
27 #include "NamespaceHeader.H"
28 
29 class CFIVS;
31 ///Quadratic coarse-fine interpolation utility
32 /**
33  Class to fill ghost cells on coarse-fine
34  interface using quadratic interpolation
35 */
37 {
38 public:
39 
40  ///
41  /**
42  */
43  static void
45  LevelData<FArrayBox>& a_tanGrad,
46  LayoutData<CFIVS> a_loCFIVS[SpaceDim],
47  LayoutData<CFIVS> a_hiCFIVS[SpaceDim],
48  Real a_dxLevel,
49  Real a_dxCrse,
50  int a_ncomp,
51  LayoutData<TensorFineStencilSet> a_loTanStencilSets[SpaceDim],
52  LayoutData<TensorFineStencilSet> a_hiTanStencilSets[SpaceDim]);
53 
54 
55  ///
56  /**
57  */
58  static void
60  const LevelData<FArrayBox>& a_phi,
61  const DataIndex& a_DatInd,
62  int a_idir,
63  Side::LoHiSide a_hiorlo,
64  Real a_dxLevel,
65  Real a_dxCrse,
66  int a_ncomp,
67  LayoutData<TensorFineStencilSet> a_loTanStencilSets[SpaceDim],
68  LayoutData<TensorFineStencilSet> a_hiTanStencilSets[SpaceDim]);
69 
70 
71  ///
72  /**
73  */
74  static void
76  const DataIndex& a_datInd,
77  int a_idir,
78  Side::LoHiSide a_hiorlo,
79  LayoutData<CFIVS> a_loCFIVS[SpaceDim],
80  LayoutData<CFIVS> a_hiCFIVS[SpaceDim],
81  Real a_dxLevel,
82  Real a_dxCrse,
83  int a_ncomp);
84 
85  static void
87  const FArrayBox& a_phistar,
88  const DataIndex& a_datInd,
89  const int a_idir,
90  const Side::LoHiSide a_hiorlo,
91  const IntVectSet& a_interpIVS,
92  Real a_dxLevel,
93  Real a_dxCrse,
94  int a_ncomp);
95 
96  ///constructors, destructors, defines
97 
98  ///
99  /**
100  Full Constructor. makes all coarse-fine
101  information and sets internal variables
102  calls full define
103  */
104  QuadCFInterp(
105  const DisjointBoxLayout& a_fineBoxes,
106  const DisjointBoxLayout* a_coarBoxes,
107  Real a_dxFine,
108  int a_refRatio,
109  int a_nComp,
110  const Box& a_domf);
111 
112  ///
113  /**
114  Full Constructor. makes all coarse-fine
115  information and sets internal variables
116  calls full define
117  */
118  QuadCFInterp(
119  const DisjointBoxLayout& a_fineBoxes,
120  const DisjointBoxLayout* a_coarBoxes,
121  Real a_dxFine,
122  int a_refRatio,
123  int a_nComp,
124  const ProblemDomain& a_domf);
125 
126  ///
127  /**
128  Full define function. makes all coarse-fine
129  information and sets internal variables
130  */
131  void define(
132  const DisjointBoxLayout& a_fineBoxes,
133  const DisjointBoxLayout* a_coarBoxes,
134  Real a_dxFine,
135  int a_refRatio,
136  int a_nComp,
137  const ProblemDomain& a_domf);
138 
139  ///
140  /**
141  Default constructor leaves QCFI undefined.
142  */
143  QuadCFInterp();
144 
145  ///
146  virtual ~QuadCFInterp();
147 
148  ///
149  /**
150  return QCFI to undefined state
151  */
152  void clear();
153 
154  ///
155  /**
156  Coarse / Fine interpolation operator.
157  */
158  void coarseFineInterp(
159  LevelData<FArrayBox>& a_phif,
160  const LevelData<FArrayBox>& a_phic
161  );
162 
163  ///
164  /**
165  has full define function been called? return true if so
166  */
167  bool isDefined() const;
168 
169  static bool newCFInterMode;
170 
171 protected:
172  //boxes for coarse buffers
174 
175  //fake level identifier.
176  int m_level;
177 
178  //number of components
179  int m_nComp;
180 
181  //refinement ratio between levels
183 
184  //mesh spacing at fine level
186 
187  //cfstencils on low-side faces
188  //lives on fine input grid layout
190 
191  //cfstencils on high-side faces
192  //lives on fine input grid layout
194 
195 
198 
201  ///has full define function been called?
205 protected:
206 
207  /* Coarse / Fine interpolation operator.
208  using one sided differencing
209  only at a particular face
210  */
211  void coarseFineInterp(BaseFab<Real> & a_phif,
212  const BaseFab<Real> & a_phic,
213  const QuadCFStencil& a_qcfs,
214  const Side::LoHiSide a_hiorlo,
215  const int a_idir,
216  const Interval& a_variables) const;
217 
218  //get extended phi (lives next to interpivs)
219  void getPhiStar(BaseFab<Real> & a_phistar,
220  const BaseFab<Real> & a_phic,
221  const QuadCFStencil& a_qcfs,
222  const Side::LoHiSide a_hiorlo,
223  const int a_idir,
224  const Interval& a_variables) const;
225 
226  //interpolate over correct intvectset
227  void interpOnIVS(BaseFab<Real> & a_phif,
228  const BaseFab<Real> & a_phiStar,
229  const QuadCFStencil& a_qcfs,
230  const Side::LoHiSide a_hiorlo,
231  const int a_idir,
232  const Interval& a_variables) const;
233 };
234 
235 #include "NamespaceFooter.H"
236 #endif
int m_level
Definition: QuadCFInterp.H:176
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
Copier m_copier
Definition: QuadCFInterp.H:197
Real m_dxFine
Definition: QuadCFInterp.H:185
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Internal class to find parts of a box outside the valid region of a level.
Definition: CFIVS.H:37
static bool newCFInterMode
Definition: QuadCFInterp.H:169
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
DisjointBoxLayout m_inputCoarLayout
Definition: QuadCFInterp.H:200
void coarseFineInterp(LevelData< FArrayBox > &a_phif, const LevelData< FArrayBox > &a_phic)
void define(const DisjointBoxLayout &a_fineBoxes, const DisjointBoxLayout *a_coarBoxes, Real a_dxFine, int a_refRatio, int a_nComp, const ProblemDomain &a_domf)
void interpOnIVS(BaseFab< Real > &a_phif, const BaseFab< Real > &a_phiStar, const QuadCFStencil &a_qcfs, const Side::LoHiSide a_hiorlo, const int a_idir, const Interval &a_variables) const
const int SpaceDim
Definition: SPACE.H:38
bool m_isDefined
has full define function been called?
Definition: QuadCFInterp.H:202
bool m_fineCoversCoarse
Definition: QuadCFInterp.H:203
LayoutData< QuadCFStencil > m_loQCFS[SpaceDim]
Definition: QuadCFInterp.H:189
Structure for passing component ranges in code.
Definition: Interval.H:23
BoxLayout m_coarBoxes
Definition: QuadCFInterp.H:173
LayoutData< QuadCFStencil > m_hiQCFS[SpaceDim]
Definition: QuadCFInterp.H:193
double Real
Definition: REAL.H:33
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
static void homogeneousCFInterpTanGrad(LevelData< FArrayBox > &a_tanGrad, const LevelData< FArrayBox > &a_phi, const DataIndex &a_DatInd, int a_idir, Side::LoHiSide a_hiorlo, Real a_dxLevel, Real a_dxCrse, int a_ncomp, LayoutData< TensorFineStencilSet > a_loTanStencilSets[SpaceDim], LayoutData< TensorFineStencilSet > a_hiTanStencilSets[SpaceDim])
LoHiSide
Definition: LoHiSide.H:27
DisjointBoxLayout m_inputFineLayout
Definition: QuadCFInterp.H:199
Class to encapsulate fine-level tangential gradient stencil computation.
Definition: TensorFineStencilSet.H:28
static void homogeneousCFInterp(LevelData< FArrayBox > &a_phif, LevelData< FArrayBox > &a_tanGrad, LayoutData< CFIVS > a_loCFIVS[SpaceDim], LayoutData< CFIVS > a_hiCFIVS[SpaceDim], Real a_dxLevel, Real a_dxCrse, int a_ncomp, LayoutData< TensorFineStencilSet > a_loTanStencilSets[SpaceDim], LayoutData< TensorFineStencilSet > a_hiTanStencilSets[SpaceDim])
bool isDefined() const
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
int m_nComp
Definition: QuadCFInterp.H:179
static void interpPhiOnIVS(LevelData< FArrayBox > &a_phif, const FArrayBox &a_phistar, const DataIndex &a_datInd, const int a_idir, const Side::LoHiSide a_hiorlo, const IntVectSet &a_interpIVS, Real a_dxLevel, Real a_dxCrse, int a_ncomp)
ProblemDomain m_domainFine
Definition: QuadCFInterp.H:204
Definition: DataIndex.H:114
void getPhiStar(BaseFab< Real > &a_phistar, const BaseFab< Real > &a_phic, const QuadCFStencil &a_qcfs, const Side::LoHiSide a_hiorlo, const int a_idir, const Interval &a_variables) const
Definition: FArrayBox.H:45
BoxLayoutData< FArrayBox > m_coarBuffer
Definition: QuadCFInterp.H:196
class to encapsulate CF info for quadratic interpolation
Definition: QuadCFStencil.H:34
virtual ~QuadCFInterp()
int m_refRatio
Definition: QuadCFInterp.H:182
static void homogeneousCFInterpPhi(LevelData< FArrayBox > &a_phif, const DataIndex &a_datInd, int a_idir, Side::LoHiSide a_hiorlo, LayoutData< CFIVS > a_loCFIVS[SpaceDim], LayoutData< CFIVS > a_hiCFIVS[SpaceDim], Real a_dxLevel, Real a_dxCrse, int a_ncomp)
Quadratic coarse-fine interpolation utility.
Definition: QuadCFInterp.H:36