Chombo + EB  3.2
NWOQuadCFInterp.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 _NWOQUADCFINTERP_H_
12 #define _NWOQUADCFINTERP_H_
13 
14 #include "FArrayBox.H"
15 #include "DisjointBoxLayout.H"
16 #include "LevelData.H"
17 #include "RealVect.H"
18 #include "ProblemDomain.H"
19 #include "CFIVS.H"
20 #include "NamespaceHeader.H"
21 
22 /// Fourth-order interpolation in time and space to ghost cells.
23 
24 /**
25  */
27 {
28 public:
29  /// Default constructor
30  /**
31  Object requires define() to be called before all other functions.
32  */
34  {
35  m_defined = false;
36  }
37 
38  /// Full constructor
39  NWOQuadCFInterp(/// layout at this level
40  const DisjointBoxLayout& a_thisDisjointBoxLayout,
41  /// layout at coarser level
42  const DisjointBoxLayout& a_coarserDisjointBoxLayout,
43  /// number of variables
44  const int& a_numStates,
45  /// problem domain on the coarser level
46  const ProblemDomain& a_coarseDomain,
47  /// refinement ratio between this level and the coarser level
48  const int& a_refineCoarse,
49  /// number of layers of ghost cells to fill by interpolation
50  const int& a_interpRadius)
51  {
52  define(a_thisDisjointBoxLayout, a_coarserDisjointBoxLayout,
53  a_numStates, a_coarseDomain, a_refineCoarse, a_interpRadius);
54  }
55 
56  /// Destructor
57  /**
58  Destroys all objects created by define(). Passed in data references
59  of define() are left alone.
60  */
62  {
63  }
64 
65  ///fill ghostcells as if all the coarse data were zero (useful for multigrid)
66  void
67  homogeneousCoarseFineInterp(/// interpolated solution on this level
68  LevelData<FArrayBox>& a_fineData,
69  /// solution on coarser level
70  int a_srcComp,
71  /// starting fine data component
72  int a_dstComp,
73  /// number of data components to interpolate
74  int a_numComp);
75  /// Actual constructor.
76  /**
77  Set up object.
78  */
79  void define(/// layout at this level
80  const DisjointBoxLayout& a_thisDisjointBoxLayout,
81  /// layout at coarser level
82  const DisjointBoxLayout& a_coarserDisjointBoxLayout,
83  /// number of variables
84  const int& a_numStates,
85  /// problem domain on the coarser level
86  const ProblemDomain& a_coarseDomain,
87  /// refinement ratio between this level and the coarser level
88  const int& a_refineCoarse,
89  /// number of layers of ghost cells to fill by interpolation
90  const int& a_interpRadius);
91 
92 
93 
94 
95  /// Interpolate in space only.
96  /**
97  At a fixed time, interpolate in space to ghost cells of a_fine
98  from a_coarse.
99  */
100  void coarseFineInterp(/// interpolated solution on this level
101  LevelData<FArrayBox>& a_fineData,
102  /// solution on coarser level
103  const LevelData<FArrayBox>& a_coarseData,
104  /// starting coarse data component
105  int a_srcComp,
106  /// starting fine data component
107  int a_dstComp,
108  /// number of data components to interpolate
109  int a_numComp);
110 
111 
112 
113 protected:
114 
115  /// whether define() has been called
116  bool m_defined;
117 
118  /// box layout for this level
120 
121  /// box layout for the coarse level
123 
124  /// number of layers of fine ghost cells to fill by interpolation
126 
127  /// problem domain at the coarser level
129 
130  /// refinement ratio between this level and the next coarser
132 
133  /// 1 in m_fixedDims, m_refineCoarse in other dimensions
135 
136  /// number of variables
139 
140  /// data on ghosted coarsened fine grids at intermediate time in fillInterp
142 
143  /// coarsened ghost cells of fine patches
145 
146 
147  void
148  interpOnPatch(FArrayBox& a_fineData,
149  const FArrayBox& a_coarseData,
150  const DataIndex& a_dit,
151  int a_srcComp,
152  int a_dstComp,
153  int a_numComp);
154 
155  void
156  extrapolateValue(Real & a_fineValue,
157  const Real & a_coarValue,
158  const RealVect & a_firstDerivs,
159  const RealVect & a_secondDerivs,
160  const RealVect & a_mixedDerivs,
161  const RealVect & a_distance);
162 
163  void
164  getDerivs(RealVect& firstDerivs,
165  RealVect& secondDerivs,
166  RealVect& mixedDerivs,
167  const FArrayBox & a_data,
168  const IntVect& a_ivCoar,
169  const Real & a_dx,
170  const int & a_icomp);
171 
172 
173  int getMixedIndex(int a_derivDir1, int a_derivDir2)
174  {
175  int retval;
176  //0 == xy, 1 = xz, 2 == yz
177  if(((a_derivDir1 == 0) && (a_derivDir2 == 1)) || ((a_derivDir1 == 1) && (a_derivDir2 == 0)))
178  {
179  retval = 0;
180  }
181  else if (((a_derivDir1 == 0) && (a_derivDir2 == 2)) || ((a_derivDir1 == 2) && (a_derivDir2 == 0)))
182  {
183  retval = 1;
184  }
185  else if (((a_derivDir1 == 1) && (a_derivDir2 == 2)) || ((a_derivDir1 == 2) && (a_derivDir2 == 1)))
186  {
187  retval = 2;
188  }
189  else
190  {
191  MayDay::Error("bogus arguments to getmixedindex");
192  }
193  return retval;
194  }
195 
196  void
197  getMixedDerivDirections(int & a_derivDir1, int& a_derivDir2, const int& a_index)
198  {
199  //0 == xy, 1 = xz, 2 == yz
200  if(a_index == 0)
201  {
202  a_derivDir1 = 0;
203  a_derivDir2 = 1;
204  }
205  else if(a_index == 1)
206  {
207  a_derivDir1 = 0;
208  a_derivDir2 = 2;
209  }
210  else if(a_index == 2)
211  {
212  a_derivDir1 = 1;
213  a_derivDir2 = 2;
214  }
215  else
216  {
217  MayDay::Error("bogus arguments to getmixedderivdirections");
218  }
219  }
220 private:
221 
222  // Disallowed for all the usual reasons
223  void operator=(const NWOQuadCFInterp&);
225 };
226 
227 #include "NamespaceFooter.H"
228 #endif
LayoutData< CFIVS > m_cfivs
coarsened ghost cells of fine patches
Definition: NWOQuadCFInterp.H:144
int m_numStates
number of variables
Definition: NWOQuadCFInterp.H:137
bool m_defined
whether define() has been called
Definition: NWOQuadCFInterp.H:116
IntVect m_refineVect
1 in m_fixedDims, m_refineCoarse in other dimensions
Definition: NWOQuadCFInterp.H:134
DisjointBoxLayout m_layout
box layout for this level
Definition: NWOQuadCFInterp.H:119
void homogeneousCoarseFineInterp(LevelData< FArrayBox > &a_fineData, int a_srcComp, int a_dstComp, int a_numComp)
fill ghostcells as if all the coarse data were zero (useful for multigrid)
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
int m_refineCoarse
refinement ratio between this level and the next coarser
Definition: NWOQuadCFInterp.H:131
void operator=(const NWOQuadCFInterp &)
NWOQuadCFInterp(const DisjointBoxLayout &a_thisDisjointBoxLayout, const DisjointBoxLayout &a_coarserDisjointBoxLayout, const int &a_numStates, const ProblemDomain &a_coarseDomain, const int &a_refineCoarse, const int &a_interpRadius)
Full constructor.
Definition: NWOQuadCFInterp.H:39
void getMixedDerivDirections(int &a_derivDir1, int &a_derivDir2, const int &a_index)
Definition: NWOQuadCFInterp.H:197
int getMixedIndex(int a_derivDir1, int a_derivDir2)
Definition: NWOQuadCFInterp.H:173
Fourth-order interpolation in time and space to ghost cells.
Definition: NWOQuadCFInterp.H:26
ProblemDomain m_coarseDomain
problem domain at the coarser level
Definition: NWOQuadCFInterp.H:128
NWOQuadCFInterp()
Default constructor.
Definition: NWOQuadCFInterp.H:33
~NWOQuadCFInterp()
Destructor.
Definition: NWOQuadCFInterp.H:61
double Real
Definition: REAL.H:33
void define(const DisjointBoxLayout &a_thisDisjointBoxLayout, const DisjointBoxLayout &a_coarserDisjointBoxLayout, const int &a_numStates, const ProblemDomain &a_coarseDomain, const int &a_refineCoarse, const int &a_interpRadius)
Actual constructor.
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
DisjointBoxLayout m_layoutCoarsened
Definition: NWOQuadCFInterp.H:138
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
int m_interpRadius
number of layers of fine ghost cells to fill by interpolation
Definition: NWOQuadCFInterp.H:125
Definition: DataIndex.H:112
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
void coarseFineInterp(LevelData< FArrayBox > &a_fineData, const LevelData< FArrayBox > &a_coarseData, int a_srcComp, int a_dstComp, int a_numComp)
Interpolate in space only.
void interpOnPatch(FArrayBox &a_fineData, const FArrayBox &a_coarseData, const DataIndex &a_dit, int a_srcComp, int a_dstComp, int a_numComp)
LevelData< FArrayBox > m_coarsenedFineData
data on ghosted coarsened fine grids at intermediate time in fillInterp
Definition: NWOQuadCFInterp.H:141
DisjointBoxLayout m_coarseLayout
box layout for the coarse level
Definition: NWOQuadCFInterp.H:122
void getDerivs(RealVect &firstDerivs, RealVect &secondDerivs, RealVect &mixedDerivs, const FArrayBox &a_data, const IntVect &a_ivCoar, const Real &a_dx, const int &a_icomp)
void extrapolateValue(Real &a_fineValue, const Real &a_coarValue, const RealVect &a_firstDerivs, const RealVect &a_secondDerivs, const RealVect &a_mixedDerivs, const RealVect &a_distance)