Chombo + EB + MF  3.2
TensorCFInterp.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 _TENSORCFINTERP_H_
12 #define _TENSORCFINTERP_H_
13 
14 #include <iostream>
15 #include <math.h>
16 #include "SPACE.H"
17 #include <stdlib.h>
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 "TensorFineStencilSet.H"
28 #include "NamespaceHeader.H"
29 
30 /// Quadratic coarse-fine interpolation utility for tensors
31 /**
32  Class to fill ghost cells on coarse-fine interface using
33  quadratic interpolation. Also computes tangential
34  derivatives
35 */
37 {
38 public:
39 
40  ///constructors, destructors, defines
41 
42  ///
43  /**
44  Full Constructor. makes all coarse-fine
45  information and sets internal variables
46  calls full define
47  */
49  const DisjointBoxLayout& a_fineBoxes,
50  const DisjointBoxLayout* a_coarBoxes,
51  Real a_dxFine,
52  int a_refRatio,
53  int a_nComp,
54  const Box& a_domf);
55 
56  ///
57  /**
58  Full Constructor. makes all coarse-fine
59  information and sets internal variables
60  calls full define
61  */
63  const DisjointBoxLayout& a_fineBoxes,
64  const DisjointBoxLayout* a_coarBoxes,
65  Real a_dxFine,
66  int a_refRatio,
67  int a_nComp,
68  const ProblemDomain& a_domf);
69 
70  ///
71  /**
72  Full define function. Makes all coarse-fine
73  information and sets internal variables
74  */
75  void define(
76  const DisjointBoxLayout& a_fineBoxes,
77  const DisjointBoxLayout* a_coarBoxes,
78  Real a_dxFine,
79  int a_refRatio,
80  int a_nComp,
81  const Box& a_domf);
82 
83  ///
84  /**
85  Full define function. makes all coarse-fine
86  information and sets internal variables
87  */
88  void define(
89  const DisjointBoxLayout& a_fineBoxes,
90  const DisjointBoxLayout* a_coarBoxes,
91  Real a_dxFine,
92  int a_refRatio,
93  int a_nComp,
94  const ProblemDomain& a_domf);
95 
96 
97  ///
98  /**
99  Default constructor leaves TCFI undefined.
100  */
101  TensorCFInterp();
102 
103  ///
104  virtual ~TensorCFInterp();
105 
106  ///
107  /**
108  return TCFI to undefined state
109  */
110  void clear();
111 
112  ///
113  /**
114  Coarse / Fine interpolation operator.
115  */
116  void coarseFineInterp(
117  LevelData<FArrayBox>& a_phif,
118  LevelData<FArrayBox>& a_gradf,
119  const LevelData<FArrayBox>& a_phic
120  );
121 
122  ///
123  /**
124  Coarse-fine interpolation operator with homogeneous BCs.
125  Does same interpolation as coarseFineInterp function,
126  but with all coarse-level data set to 0.
127  */
128  void coarseFineInterpH(
129  LevelData<FArrayBox>& a_phif,
130  LevelData<FArrayBox>& a_gradf
131  );
132 
133  ///
134  /**
135  has full define function been called? return true if so
136  */
137  bool isDefined() const;
138 
139  /// returns component in gradient for variable ivar in direction gradDir
140  /** returns ivar*SpaceDim + gradDir
141  */
142  static inline int gradIndex(int ivar, int gradDir)
143  {
144  return ivar*SpaceDim + gradDir;
145  }
146 
147 protected:
149 
150  //fake level identifier.
151  int m_level;
152 
153  //number of components
154  int m_nComp;
155 
156  //refinement ratio between levels
158 
159  //mesh spacing at fine level
161 
162  // problem domain at fine level
164 
165  //cfstencils on low-side faces
166  //lives on fine input grid layout
168 
169  //cfstencils on high-side faces
170  //lives on fine input grid layout
172 
173 
174  /// this contains info for the fine-level differencing
176 
177  ///
179 
181 
184  ///has full define function been called?
187 protected:
188 
189  /* Coarse / Fine interpolation operator.
190  using one sided differencing
191  only at a particular face
192  */
193  void coarseFineInterp(BaseFab<Real> & a_phif,
194  BaseFab<Real> & a_gradf,
195  BaseFab<Real> & a_tanGradStar,
196  const BaseFab<Real> & a_phic,
197  const QuadCFStencil& a_qcfs,
198  const Side::LoHiSide a_hiorlo,
199  const int a_idir,
200  const Interval& a_variables) const;
201 
202  //get extended phi (lives next to interpivs)
203  void getPhiStar(BaseFab<Real> & a_phistar,
204  BaseFab<Real> & a_tanGradStar,
205  const BaseFab<Real> & a_phic,
206  const QuadCFStencil& a_qcfs,
207  const Side::LoHiSide a_hiorlo,
208  const int a_idir,
209  const Interval& a_variables) const;
210 
211  //interpolate over correct intvectset
212  void interpOnIVS(BaseFab<Real> & a_phif,
213  BaseFab<Real> & a_gradf,
214  const BaseFab<Real> & a_phiStar,
215  const QuadCFStencil& a_qcfs,
216  const Side::LoHiSide a_hiorlo,
217  const int a_idir,
218  const Interval& a_variables) const;
219 
220  // compute tangential gradients
221  void computeTanGrad(BaseFab<Real>& a_gradf,
222  const BaseFab<Real>& a_phiFine,
223  const BaseFab<Real>& a_tanGradStar,
224  const TensorFineStencilSet& a_fineStencils,
225  const QuadCFStencil& a_qcfs,
226  const Side::LoHiSide& a_hiorlo,
227  const int a_idir,
228  const Interval& a_variables) const;
229 };
230 
231 #include "NamespaceFooter.H"
232 #endif
DisjointBoxLayout m_inputCoarLayout
Definition: TensorCFInterp.H:183
bool m_isDefined
has full define function been called?
Definition: TensorCFInterp.H:185
void getPhiStar(BaseFab< Real > &a_phistar, BaseFab< Real > &a_tanGradStar, const BaseFab< Real > &a_phic, const QuadCFStencil &a_qcfs, const Side::LoHiSide a_hiorlo, const int a_idir, const Interval &a_variables) const
ProblemDomain m_probDomain
Definition: TensorCFInterp.H:163
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
bool m_fineCoversCoarse
Definition: TensorCFInterp.H:186
LayoutData< QuadCFStencil > m_loQCFS[SpaceDim]
Definition: TensorCFInterp.H:167
DisjointBoxLayout m_inputFineLayout
Definition: TensorCFInterp.H:182
Real m_dxFine
Definition: TensorCFInterp.H:160
LevelData< FArrayBox > m_coarsenedFineBuffer
Definition: TensorCFInterp.H:180
Quadratic coarse-fine interpolation utility for tensors.
Definition: TensorCFInterp.H:36
static int gradIndex(int ivar, int gradDir)
returns component in gradient for variable ivar in direction gradDir
Definition: TensorCFInterp.H:142
LayoutData< QuadCFStencil > m_hiQCFS[SpaceDim]
Definition: TensorCFInterp.H:171
virtual ~TensorCFInterp()
const int SpaceDim
Definition: SPACE.H:38
DisjointBoxLayout m_coarsenedFineBoxes
Definition: TensorCFInterp.H:148
bool isDefined() const
Structure for passing component ranges in code.
Definition: Interval.H:23
void coarseFineInterpH(LevelData< FArrayBox > &a_phif, LevelData< FArrayBox > &a_gradf)
double Real
Definition: REAL.H:33
void interpOnIVS(BaseFab< Real > &a_phif, BaseFab< Real > &a_gradf, const BaseFab< Real > &a_phiStar, const QuadCFStencil &a_qcfs, const Side::LoHiSide a_hiorlo, const int a_idir, const Interval &a_variables) const
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
LoHiSide
Definition: LoHiSide.H:27
int m_level
Definition: TensorCFInterp.H:151
Class to encapsulate fine-level tangential gradient stencil computation.
Definition: TensorFineStencilSet.H:28
int m_refRatio
Definition: TensorCFInterp.H:157
void coarseFineInterp(LevelData< FArrayBox > &a_phif, LevelData< FArrayBox > &a_gradf, const LevelData< FArrayBox > &a_phic)
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
LayoutData< TensorFineStencilSet > m_hiFineStencilSets[SpaceDim]
Definition: TensorCFInterp.H:178
void define(const DisjointBoxLayout &a_fineBoxes, const DisjointBoxLayout *a_coarBoxes, Real a_dxFine, int a_refRatio, int a_nComp, const Box &a_domf)
LayoutData< TensorFineStencilSet > m_loFineStencilSets[SpaceDim]
this contains info for the fine-level differencing
Definition: TensorCFInterp.H:175
int m_nComp
Definition: TensorCFInterp.H:154
class to encapsulate CF info for quadratic interpolation
Definition: QuadCFStencil.H:34
void computeTanGrad(BaseFab< Real > &a_gradf, const BaseFab< Real > &a_phiFine, const BaseFab< Real > &a_tanGradStar, const TensorFineStencilSet &a_fineStencils, const QuadCFStencil &a_qcfs, const Side::LoHiSide &a_hiorlo, const int a_idir, const Interval &a_variables) const