Chombo + EB  3.2
PiecewiseLinearFillPatchFace.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 _PIECEWISELINEARFILLPATCHFACE_H_
12 #define _PIECEWISELINEARFILLPATCHFACE_H_
13 
14 #include <iostream>
15 #include <fstream>
16 #include "REAL.H"
17 #include "Box.H"
18 #include "FArrayBox.H"
19 #include "FluxBox.H"
20 #include "LevelData.H"
21 #include "DisjointBoxLayout.H"
22 #include "IntVectSet.H"
23 #include "ProblemDomain.H"
24 
25 #include "NamespaceHeader.H"
26 
27 /// Fills ghost cells by linear interpolation in space and time
28 
29 /**
30 Fills some fine level ghost "faces" by piecewise linear interpolation
31 from the coarse level.
32 
33 This class fills the first a_interp_radius layers of fine level
34 ghost cells that are not part of other fine level grids. It uses
35 piecewise linear interpolation from the coarse level. The slopes
36 are computed using van leer limiting if there is enough room for
37 the stencil. It drops order and uses first-order one-sided
38 differences otherwise.
39 
40 
41 */
42 
44 {
45 public:
46  ///
47  /**
48  Default constructor. User must subsequently call define().
49  */
51 
52  ///
53  /**
54  Destructor.
55  */
57 
58  ///
59  /**
60  Defining constructor.
61 
62  {\bf Arguments:}\\
63  a_fine_domain (not modified): domain of fine level. \\
64  a_coarse_domain (not modified): domain of coarse level. \\
65  a_num_comps (not modified): number of components of state vector. \\
66  a_crse_problem_domain (not modified): problem domain on the coarse level.\\
67  a_ref_ratio (not modified): refinement ratio. \\
68  a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \\
69  */
71  const DisjointBoxLayout& a_coarse_domain,
72  int a_num_comps,
73  const Box& a_crse_problem_domain,
74  int a_ref_ratio,
75  int a_interp_radius
76  );
77 
78 
79  ///
80  /**
81  Defining constructor.
82 
83  {\bf Arguments:}\\
84  a_fine_domain (not modified): domain of fine level. \\
85  a_coarse_domain (not modified): domain of coarse level. \\
86  a_num_comps (not modified): number of components of state vector. \\
87  a_crse_problem_domain (not modified): problem domain on the coarse level.\\
88  a_ref_ratio (not modified): refinement ratio. \\
89  a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \\
90  */
92  const DisjointBoxLayout& a_coarse_domain,
93  int a_num_comps,
94  const ProblemDomain& a_crse_problem_domain,
95  int a_ref_ratio,
96  int a_interp_radius
97  );
98 
99  ///
100  /**
101  Defines this object. The user may call define() once and call
102  fillInterp() multiple times with different valid data sets.
103 
104  {\bf Arguments:}\\
105  a_fine_domain (not modified): domain of fine level. \\
106  a_coarse_domain (not modified): domain of coarse level. \\
107  a_num_comps (not modified): number of components of state vector. \\
108  a_crse_problem_domain (not modified): problem domain on the coarse level.\\
109  a_ref_ratio (not modified): refinement ratio. \\
110  a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \\
111 
112  {\bf This:}\\
113  ---This object is modified.---
114 
115  */
116  void
117  define(const DisjointBoxLayout& a_fine_domain,
118  const DisjointBoxLayout& a_coarse_domain,
119  int a_num_comps,
120  const Box& a_crse_problem_domain,
121  int a_ref_ratio,
122  int a_interp_radius
123  );
124 
125 
126  ///
127  /**
128  Defines this object. The user may call define() once and call
129  fillInterp() multiple times with different valid data sets.
130 
131  {\bf Arguments:}\\
132  a_fine_domain (not modified): domain of fine level. \\
133  a_coarse_domain (not modified): domain of coarse level. \\
134  a_num_comps (not modified): number of components of state vector. \\
135  a_crse_problem_domain (not modified): problem domain on the coarse level.\\
136  a_ref_ratio (not modified): refinement ratio. \\
137  a_interp_radius (not modified): number of layers of fine ghost cells to fill by interpolation. \\
138 
139  {\bf This:}\\
140  ---This object is modified.---
141 
142  */
143  void
144  define(const DisjointBoxLayout& a_fine_domain,
145  const DisjointBoxLayout& a_coarse_domain,
146  int a_num_comps,
147  const ProblemDomain& a_crse_problem_domain,
148  int a_ref_ratio,
149  int a_interp_radius
150  );
151 
152  ///
153  /**
154  Returns true if this object was created with the defining
155  constructor or if define() has been called.
156 
157  {\bf This:}\\
158  This object is not modified.
159  */
160  bool
161  isDefined() const;
162 
163  ///
164  /**
165  This is an adaptation of the Cell-centered PiecewiseLinearFillPatch
166  class for face-centered data.
167 
168 
169  Fills the first m_interp_radius layers of fine ghost cells by
170  interpolation from the coarse level. It is an error to call if not
171  this->isDefined(). The range components to interpolate must be
172  specified. The corresponding components on the coarse and fine
173  levels may be different. It is required that a_fine_data's domain
174  is the same as was specified in the most recent call to define().
175  It is expected that the coarse and fine level's domains are
176  properly nested.
177 
178  {\bf Arguments:}\\
179  a_fine_data (modified): fine-level data being interpolated to.\\
180  a_old_coarse_data (not modified): coarse level source data at the old time.\\
181  a_new_coarse_data (not modified): coarse level source data at the new time.\\
182  a_time_interp_coef (not modified): time interpolation coefficient, in the range [0:1]. 0=old time, 1=new time.\\
183  a_src_comp (not modifed): starting coarse data component.\\
184  a_dest_comp (not modifed): starting fine data component.\\
185  a_num_comp (not modified): number of data components to be
186  interpolated.
187 
188  {\bf This:}\\
189  Well, it's complicated. As far as the user is concerned, this object
190  is not modified. See the design document if you care for details.
191 
192  */
193  void
194  fillInterp(LevelData<FluxBox>& a_fine_data,
195  const LevelData<FluxBox>& a_old_coarse_data,
196  const LevelData<FluxBox>& a_new_coarse_data,
197  Real a_time_interp_coef,
198  int a_src_comp,
199  int a_dest_comp,
200  int a_num_comp
201  );
202 
203  // debugging utilities
204  void
205  printIntVectSets() const;
206 
207 
208 protected:
209  // copy coarse data to coarsened fine work array and interpolate to
210  // fine time level
211  void
212  timeInterp(LevelData<FluxBox>& m_coarsened_fine_data,
213  const LevelData<FluxBox>& a_old_coarse_data,
214  const LevelData<FluxBox>& a_new_coarse_data,
215  Real a_time_interp_coef,
216  int a_src_comp,
217  int a_dest_comp,
218  int a_num_comp
219  );
220 
221 
222  // fill the fine interpolation sites piecewise-constantly
223  void
225  const LevelData<FluxBox>& m_coarsened_fine_data,
226  int a_src_comp,
227  int a_dest_comp,
228  int a_num_comp
229  )
230  const;
231 
232  // compute slopes in specified direction
233  void
234  computeSlopes(FArrayBox& slope_fab,
235  const FArrayBox& data_fab,
236  const IntVectSet& local_centered_interp,
237  const IntVectSet& local_lo_interp,
238  const IntVectSet& local_hi_interp,
239  int a_dir,
240  int a_src_comp,
241  int a_num_comp) const;
242 
243  // // compute slopes in specified direction
244  // void
245  // computeSlopes(int a_dir,
246  // int a_src_comp,
247  // int a_num_comp);
248 
249 
250  // increment the fine interpolation sites with linear term for the
251  // specified coordinate direction
252  void
254  const LevelData<FluxBox>& m_coarsened_fine_data,
255  int a_dir,
256  int a_src_comp,
257  int a_dest_comp,
258  int a_num_comp)
259  const;
260 
261 
262  // now do the fine interpolation normal to the face directions
263  void
265  int a_src_comp,
266  int a_dest_comp,
267  int a_num_comp)
268  const;
269 
270 
271 
272 
273 protected:
275  // the radius of the interpolation stencil. e.g. a stencil using
276  // (i-1,j), (i,j) and (i+1,j) has a radius of 1.
277  static const int s_stencil_radius;
278  // refinement ratio
280  // number of layers of fine ghost cells to fill by interpolation.
282  // // work array for coarse data in grids shaped like the fine level.
283  // LevelData<FluxBox> m_coarsened_fine_data;
284  // // work array for slopes
285  // LevelData<FluxBox> m_slopes;
286  // (FM added) coarse slope/ghost/coarsened_fine_domain
289  // problem domain on the coarse level.
291  // per-grid fine locations that you interpolate to.
293  // per-grid coarse locations that you interpolate from, by type of
294  // interpolation in the specified coordinate direction.
295  // note that there are two subscripts here -- first one
296  // refers to direction of slopes, second to direction of face
300 };
301 
302 #include "NamespaceFooter.H"
303 
304 #endif
305 
306 
void incrementLinearInterpTangential(LevelData< FluxBox > &a_fine_data, const LevelData< FluxBox > &m_coarsened_fine_data, int a_dir, int a_src_comp, int a_dest_comp, int a_num_comp) const
An irregular domain on an integer lattice.
Definition: IntVectSet.H:44
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
void define(const DisjointBoxLayout &a_fine_domain, const DisjointBoxLayout &a_coarse_domain, int a_num_comps, const Box &a_crse_problem_domain, int a_ref_ratio, int a_interp_radius)
ProblemDomain m_crse_problem_domain
Definition: PiecewiseLinearFillPatchFace.H:290
IntVect m_coarse_ghost
Definition: PiecewiseLinearFillPatchFace.H:287
const int SpaceDim
Definition: SPACE.H:38
LayoutData< IntVectSet > m_coarse_centered_interp[SpaceDim][SpaceDim]
Definition: PiecewiseLinearFillPatchFace.H:297
DisjointBoxLayout m_coarsened_fine_domain
Definition: PiecewiseLinearFillPatchFace.H:288
void timeInterp(LevelData< FluxBox > &m_coarsened_fine_data, const LevelData< FluxBox > &a_old_coarse_data, const LevelData< FluxBox > &a_new_coarse_data, Real a_time_interp_coef, int a_src_comp, int a_dest_comp, int a_num_comp)
int m_ref_ratio
Definition: PiecewiseLinearFillPatchFace.H:279
Fills ghost cells by linear interpolation in space and time.
Definition: PiecewiseLinearFillPatchFace.H:43
IntVect m_coarse_slope
Definition: PiecewiseLinearFillPatchFace.H:287
double Real
Definition: REAL.H:33
bool m_is_defined
Definition: PiecewiseLinearFillPatchFace.H:274
int m_interp_radius
Definition: PiecewiseLinearFillPatchFace.H:281
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
LayoutData< IntVectSet > m_coarse_hi_interp[SpaceDim][SpaceDim]
Definition: PiecewiseLinearFillPatchFace.H:299
void incrementLinearInterpNormal(LevelData< FluxBox > &a_fine_data, int a_src_comp, int a_dest_comp, int a_num_comp) const
void computeSlopes(FArrayBox &slope_fab, const FArrayBox &data_fab, const IntVectSet &local_centered_interp, const IntVectSet &local_lo_interp, const IntVectSet &local_hi_interp, int a_dir, int a_src_comp, int a_num_comp) const
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
void fillConstantInterp(LevelData< FluxBox > &a_fine_data, const LevelData< FluxBox > &m_coarsened_fine_data, int a_src_comp, int a_dest_comp, int a_num_comp) const
void fillInterp(LevelData< FluxBox > &a_fine_data, const LevelData< FluxBox > &a_old_coarse_data, const LevelData< FluxBox > &a_new_coarse_data, Real a_time_interp_coef, int a_src_comp, int a_dest_comp, int a_num_comp)
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
static const int s_stencil_radius
Definition: PiecewiseLinearFillPatchFace.H:277
LayoutData< IntVectSet > m_coarse_lo_interp[SpaceDim][SpaceDim]
Definition: PiecewiseLinearFillPatchFace.H:298
LayoutData< IntVectSet > m_fine_interp[SpaceDim]
Definition: PiecewiseLinearFillPatchFace.H:292