Chombo + EB + MF  3.2
PatchConsOperator.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 _PATCHCONSOPERATOR_H_
12 #define _PATCHCONSOPERATOR_H_
13 
14 // Original design: Phil Colella
15 // Original implementation:
16 // Implementation date:
17 
18 #include "FArrayBox.H"
19 #include "FluxBox.H"
20 #include "ProblemDomain.H"
21 #include "MOLPhysics.H"
22 #include "MOLUtilities.H"
23 
24 #include "NamespaceHeader.H"
25 
26 /// Patch Cons Operator - a class for evaluating the Laplacian.
27 
28 /**
29  */
31 {
32 public:
33  /// Default constructor
34  /**
35  Object requires define() to be called before all other functions.
36  */
38 
39  /// Destructor
40  /**
41  Destroys all objects created by define(). Passed in data references
42  of define() are left alone.
43  */
44  virtual ~PatchConsOperator();
45 
46  /// Actual constructor.
47  /**
48  Inside the routine, we cast away const-ness on the data members
49  for the assignment. The arguments passed in are maintained const
50  (coding standards). a_refine is the refinement ratio between
51  this level and the next coarser level. For the coarsest level, an
52  empty DisjointBoxLayout is passed in for coarserDisjointBoxLayout.
53  */
54  virtual void define(const ProblemDomain& a_domain,
55  const Real& a_dx,
56  const MOLPhysics* const a_molPhysics,
57  const int& a_numStates);
58 
59  /// Set the current time before calling evalRHS or addArtificialViscosity.
60  /**
61  */
62  virtual void setCurrentTime(const Real& a_currentTime);
63 
64  /// Set the current box before calling evalRHS or addArtificialViscosity.
65  /**
66  */
67  virtual void setCurrentBox(const Box& a_currentBox);
68 
69  /// Evaluate the normal flux.
70  virtual void getNormalFlux(FluxBox& a_FfaceAvg,
71  const FArrayBox& a_UavgFab,
72  Real a_weight,
73  bool a_setFlattening,
74  FArrayBox& a_flatteningFab);
75 
76  /// update solution -- soln += dt*rhs (required by LevelRK4)
77  virtual void updateODE(FArrayBox& a_solnFab,
78  const FArrayBox& a_rhsFab,
79  Real a_dt);
80 
81  /// finds face-centered W and limits it using Colella&Sekora limiter; also solves Riemann problem
82  virtual void getFaceAvg(// we'll apply limiter to a_faceW, face-averaged primitive variables
83  FluxBox& a_faceW,
84  /// cell-averaged primitive variables
85  const FArrayBox& a_cellW,
86  const FArrayBox& a_WofUavg,
87  FArrayBox& a_flatteningFab,
88  bool a_setFlattening);
89 
90  /// set spatial order of accuracy
91  /*
92  Can be 2 or 4 (default)
93  */
94  void spaceOrder(int a_spaceOrder);
95 
96 
97  /// if true, limit face values
98  void limitFaceValues(bool a_limitFaceValues);
99 
100  // sets whether to use high-order limiter
101  void highOrderLimiter(bool a_highOrderLimiter);
102 
103  /// sets whether to flatten extrapolations to faces
104  void useFlattening(bool a_useFlattening);
105 
106  /// sets m_noPPM
107  void noPPM(bool a_noPPM);
108 
109  /// sets m_doDeconvolution
110  void doDeconvolution(bool a_doDeconvolution);
111 
112  /// sets m_doFaceDeconvolution
113  void doFaceDeconvolution(bool a_doFaceDeconvolution);
114 
115  /// sets whether to use artificial viscosity (from divergence)
116  void useArtificialViscosity(bool a_useArtificialViscosity);
117 
118  /// sets coefficient of artificial viscosity (from divergence)
119  void artificialViscosity(Real a_artificialViscosity);
120 
121  /// sets m_numGhost, the number of ghost cells
122  void numGhost(int a_numGhost);
123 
124  /// add artificial viscosity to a_Unew
125  virtual void addArtificialViscosity(FArrayBox& a_UnewFab,
126  const FArrayBox& a_UoldFab,
127  FluxBox& a_flux,
128  Real a_weight);
129 
130  virtual void getFluxDivergence(FArrayBox& a_LofU,
131  const FluxBox& a_FfaceAvg);
132 
133  /// Is the object completely defined
134  /**
135  Return true if the object is completely defined.
136  */
137  virtual bool isDefined() const;
138 
139 protected:
140 
141  /// may be used in derived classes just before calling Riemann solver in direction a_dir
142  virtual void preRiemann(FArrayBox& a_WLeft,
143  FArrayBox& a_WRight,
144  int a_dir,
145  const Box& a_box);
146 
147  /// may be used in derived classes just after calling Riemann solver in direction a_dir
148  virtual void postRiemann(FArrayBox& a_Wface,
149  int a_dir,
150  const Box& a_box);
151 
152  virtual void getAllFluxes(FluxBox& a_FfaceAvg,
153  FluxBox& a_FfaceCen,
154  const FluxBox& a_WfaceAvg,
155  const FluxBox& a_WfaceCen);
156 
157  // may be used by derived classes
158  virtual void reduceFlux(FluxBox& a_FfaceAvg,
159  FluxBox& a_FfaceForGrad);
160 
161  // define() has been called
163 
164  // Grid spacing
166 
167  // Problem domain - index space for this level
169 
171 
173 
174  // spatial order of accuracy
176 
177  // if true, limit face values
179 
180  // if true, use high-order limiter
182 
183  // if true, use flattening
185 
186  // Number of conservative fluxes and other face centered quantities
188 
191 
193 
194  // Flags for the existence of coarser and finer levels, respectively
197 
198  // Avoid PPM? Default false.
199  bool m_noPPM;
200 
201  // Do deconvolution? Default yes.
203 
204  // Do face deconvolution? Default yes.
206 
207  // use artificial viscosity (from divergence)?
209 
210  // coefficient of artificial viscosity (from divergence)
212 
213  // Current time and has it been set
216 
217  // Current box and has it been set
220 
221 private:
222  // Disallowed for all the usual reasons
223  void operator=(const PatchConsOperator& a_input);
224 
225  // Disallowed for all the usual reasons
226  PatchConsOperator(const PatchConsOperator& a_input);
227 };
228 
229 #include "NamespaceFooter.H"
230 
231 #endif
virtual void updateODE(FArrayBox &a_solnFab, const FArrayBox &a_rhsFab, Real a_dt)
update solution – soln += dt*rhs (required by LevelRK4)
void spaceOrder(int a_spaceOrder)
set spatial order of accuracy
bool m_hasCoarser
Definition: PatchConsOperator.H:195
Real m_artificialViscosity
Definition: PatchConsOperator.H:211
virtual void define(const ProblemDomain &a_domain, const Real &a_dx, const MOLPhysics *const a_molPhysics, const int &a_numStates)
Actual constructor.
void limitFaceValues(bool a_limitFaceValues)
if true, limit face values
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
bool m_limitFaceValues
Definition: PatchConsOperator.H:178
int m_numFluxes
Definition: PatchConsOperator.H:187
int m_numFluxesPerField
Definition: PatchConsOperator.H:192
Definition: MOLUtilities.H:32
virtual void addArtificialViscosity(FArrayBox &a_UnewFab, const FArrayBox &a_UoldFab, FluxBox &a_flux, Real a_weight)
add artificial viscosity to a_Unew
virtual bool isDefined() const
Is the object completely defined.
virtual void preRiemann(FArrayBox &a_WLeft, FArrayBox &a_WRight, int a_dir, const Box &a_box)
may be used in derived classes just before calling Riemann solver in direction a_dir ...
void noPPM(bool a_noPPM)
sets m_noPPM
Definition: MOLPhysics.H:37
void doFaceDeconvolution(bool a_doFaceDeconvolution)
sets m_doFaceDeconvolution
int m_numGhost
Definition: PatchConsOperator.H:189
ProblemDomain m_domain
Definition: PatchConsOperator.H:168
MOLUtilities m_util
Definition: PatchConsOperator.H:172
void numGhost(int a_numGhost)
sets m_numGhost, the number of ghost cells
int m_numFields
Definition: PatchConsOperator.H:190
virtual void setCurrentBox(const Box &a_currentBox)
Set the current box before calling evalRHS or addArtificialViscosity.
virtual void getFaceAvg(FluxBox &a_faceW, const FArrayBox &a_cellW, const FArrayBox &a_WofUavg, FArrayBox &a_flatteningFab, bool a_setFlattening)
finds face-centered W and limits it using Colella&Sekora limiter; also solves Riemann problem ...
bool m_hasFiner
Definition: PatchConsOperator.H:196
Real m_currentTime
Definition: PatchConsOperator.H:214
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
bool m_noPPM
Definition: PatchConsOperator.H:199
void doDeconvolution(bool a_doDeconvolution)
sets m_doDeconvolution
virtual void setCurrentTime(const Real &a_currentTime)
Set the current time before calling evalRHS or addArtificialViscosity.
void highOrderLimiter(bool a_highOrderLimiter)
PatchConsOperator()
Default constructor.
Real m_dx
Definition: PatchConsOperator.H:165
void useArtificialViscosity(bool a_useArtificialViscosity)
sets whether to use artificial viscosity (from divergence)
bool m_doFaceDeconvolution
Definition: PatchConsOperator.H:205
int m_spaceOrder
Definition: PatchConsOperator.H:175
double Real
Definition: REAL.H:33
Patch Cons Operator - a class for evaluating the Laplacian.
Definition: PatchConsOperator.H:30
void operator=(const PatchConsOperator &a_input)
bool m_isCurrentTimeSet
Definition: PatchConsOperator.H:215
void artificialViscosity(Real a_artificialViscosity)
sets coefficient of artificial viscosity (from divergence)
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
bool m_highOrderLimiter
Definition: PatchConsOperator.H:181
bool m_useArtificialViscosity
Definition: PatchConsOperator.H:208
virtual void getFluxDivergence(FArrayBox &a_LofU, const FluxBox &a_FfaceAvg)
virtual void reduceFlux(FluxBox &a_FfaceAvg, FluxBox &a_FfaceForGrad)
Definition: FArrayBox.H:45
bool m_isDefined
Definition: PatchConsOperator.H:162
virtual ~PatchConsOperator()
Destructor.
bool m_isCurrentBoxSet
Definition: PatchConsOperator.H:219
virtual void getNormalFlux(FluxBox &a_FfaceAvg, const FArrayBox &a_UavgFab, Real a_weight, bool a_setFlattening, FArrayBox &a_flatteningFab)
Evaluate the normal flux.
void useFlattening(bool a_useFlattening)
sets whether to flatten extrapolations to faces
bool m_doDeconvolution
Definition: PatchConsOperator.H:202
virtual void postRiemann(FArrayBox &a_Wface, int a_dir, const Box &a_box)
may be used in derived classes just after calling Riemann solver in direction a_dir ...
MOLPhysics * m_molPhysics
Definition: PatchConsOperator.H:170
virtual void getAllFluxes(FluxBox &a_FfaceAvg, FluxBox &a_FfaceCen, const FluxBox &a_WfaceAvg, const FluxBox &a_WfaceCen)
Box m_currentBox
Definition: PatchConsOperator.H:218
bool m_useFlattening
Definition: PatchConsOperator.H:184