Chombo + EB + MF  3.2
PatchMappedConsOperator.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 _PATCHMAPPEDCONSOPERATOR_H_
12 #define _PATCHMAPPEDCONSOPERATOR_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 "MultiBlockCoordSys.H"
22 #include "MOLMappedPhysics.H"
23 #include "MOLUtilities.H"
24 #include "LevelGridMetrics.H"
25 #include "PatchConsOperator.H"
26 
27 #include "NamespaceHeader.H"
28 
29 //--Forward declarations
30 
31 template<class T> class LayoutData;
32 
33 /// Patch Mapped Cons Operator - a class for evaluating hyperbolic conservation fluxes
34 /// on mapped multiblock grids
35 
36 /**
37  */
39 {
40 public:
41  /// Constructor
42  /**
43  Object requires define() to be called before all other functions.
44  */
45  PatchMappedConsOperator(const int a_numFluxesPerField = 1);
46 
47  /// Destructor
48  /**
49  Destroys all objects created by define(). Passed in data references
50  of define() are left alone.
51  */
52  virtual ~PatchMappedConsOperator();
53 
54  /// Actual constructor.
55  /**
56  Inside the routine, we cast away const-ness on the data members
57  for the assignment. The arguments passed in are maintained const
58  (coding standards). a_refine is the refinement ratio between
59  this level and the next coarser level. For the coarsest level, an
60  empty DisjointBoxLayout is passed in for coarserDisjointBoxLayout.
61  */
62  virtual void define(const ProblemDomain& a_domain,
63  const Real& a_dx,
64  LevelGridMetrics* a_levelGridMetrics,
65  const MOLPhysics* const a_molPhysics, // MOLMappedPhysics
66  const int& a_numStates);
67 
68  /// Set the current time before calling evalRHS or addArtificialViscosity.
69  /**
70  */
71  virtual void setCurrentTime(const Real& a_currentTime);
72 
73  /// Set the current data index and box before calling
74  /** Required before calling evalRHS or addArtificialViscosity.
75  */
76  virtual void setCurrentBox(const DataIndex& a_currentDataIdx,
77  const Box& a_currentBox);
78 
79  /// Evaluate the flux at a given time.
80  virtual void evalFlux(const FArrayBox& a_UavgFab,
81  FluxBox& a_FfaceAvg,
82  FluxBox& a_FfromWfaceAvg,
83  Real a_weight,
84  bool a_setFlattening,
85  FArrayBox& a_flatteningFab);
86 
87  /// Evaluate the operator (div(flux)) at a given time.
88  virtual void evalRHS(FArrayBox& a_LofU,
89  const FluxBox& a_FfaceAvg);
90 
91  /// finds face-centered W and limits it using Colella&Sekora limiter; also solves Riemann problem
92  virtual void getFaceAvg(// we'll apply limiter to a_faceW, face-averaged primitive variables
93  FluxBox& a_faceW,
94  /// cell-averaged primitive variables
95  const FArrayBox& a_cellW,
96  const FArrayBox& a_WofUavg,
97  FArrayBox& a_flatteningFab,
98  bool a_setFlattening);
99 
100  /// sets m_unitNormalLayPtr
101  void unitNormals(const LayoutData<FluxBox> *const a_unitNormalLayPtr);
102 
103  /// sets m_maxSpeed
104  void setMaxSpeed(Real a_maxSpeed);
105 
106  /// sets whether to use artificial dissipation
107  void useArtificialDissipation(bool a_useArtificialDissipation);
108 
109  /// sets coefficient of artificial dissipation
110  void artificialDissipation(Real a_artificialDissipation);
111 
112  /// add artificial viscosity to a_Unew
113  virtual void addArtificialViscosity(FArrayBox& a_UnewFab,
114  const FArrayBox& a_UoldFab,
115  FluxBox& a_flux,
116  Real a_weight);
117 
118  /// Add artificial viscosity to a_JUnew for mapped grids
119  void addMappedArtificialViscosity(FArrayBox& a_JUnewFab,
120  const FArrayBox& a_UoldFab,
121  FluxBox& a_flux,
122  const FluxBox& a_N,
123  const FArrayBox& a_J,
124  const Box& a_box,
125  Real a_weight);
126 
127  virtual Real getMaxWaveSpeed(const FArrayBox& a_U,
128  const Box& a_bx);
129 
130 protected:
131 
132  /// may be used in derived classes just before calling Riemann solver in direction a_dir
133  virtual void preRiemann(FArrayBox& a_WLeft,
134  FArrayBox& a_WRight,
135  int a_dir,
136  const Box& a_box);
137 
138  /// may be used in derived classes just after calling Riemann solver in direction a_dir
139  virtual void postRiemann(FArrayBox& a_Wface,
140  int a_dir,
141  const Box& a_box);
142 
143  virtual void forwardBasisTransform(FArrayBox& a_W,
144  const int a_dir,
145  const Box& a_box);
146 
147  virtual void reverseBasisTransform(FArrayBox& a_W,
148  const int a_dir,
149  const Box& a_box);
150 
151  virtual void getAllFluxes(FluxBox& a_FfaceAvg,
152  FluxBox& a_FfaceCen,
153  const FluxBox& a_WfaceAvg,
154  const FluxBox& a_WfaceCen);
155 
156  virtual void fluxCorrection(FluxBox& a_fluxAvg,
157  const FArrayBox& a_UavgFab);
158 
159  // Domain on a block -- maintains ghosts cells for interpolation between blocks,
160  // but none at the domain boundary.
162 
163  // Multi-block coordinate system.
164  // NOTE: We don't "own" this, so we don't deallocate it upon destruction.
166 
168  // MOLPhysics* m_molPhysics;
169 
170  // m_levelGridMetrics is not const, because blockDomain modifies it.
172 
173  // Unit normals (for the level) if using mapped grids
175 
176  // Whether to add artificial dissipation to fluxes
178 
179  // coefficient of artificial dissipation
181 
182  // maximum speed, used with artificial dissipation
184 
185  // whether m_maxSpeed has been set
187 
188  // Current data index
190 
191 private:
192  // Disallowed for all the usual reasons
195 };
196 
197 #include "NamespaceFooter.H"
198 
199 #endif
virtual Real getMaxWaveSpeed(const FArrayBox &a_U, const Box &a_bx)
PatchMappedConsOperator & operator=(const PatchMappedConsOperator &a_input)
MOLMappedPhysics * m_molMappedPhysics
Definition: PatchMappedConsOperator.H:167
virtual ~PatchMappedConsOperator()
Destructor.
virtual void setCurrentBox(const DataIndex &a_currentDataIdx, const Box &a_currentBox)
Set the current data index and box before calling.
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Definition: MOLMappedPhysics.H:28
virtual void reverseBasisTransform(FArrayBox &a_W, const int a_dir, const Box &a_box)
Grid metrics on and between levels.
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
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 ...
bool m_useArtificialDissipation
Definition: PatchMappedConsOperator.H:177
void setMaxSpeed(Real a_maxSpeed)
sets m_maxSpeed
void unitNormals(const LayoutData< FluxBox > *const a_unitNormalLayPtr)
sets m_unitNormalLayPtr
Definition: MOLPhysics.H:37
Real m_artificialDissipation
Definition: PatchMappedConsOperator.H:180
virtual void evalFlux(const FArrayBox &a_UavgFab, FluxBox &a_FfaceAvg, FluxBox &a_FfromWfaceAvg, Real a_weight, bool a_setFlattening, FArrayBox &a_flatteningFab)
Evaluate the flux at a given time.
virtual void forwardBasisTransform(FArrayBox &a_W, const int a_dir, const Box &a_box)
virtual void define(const ProblemDomain &a_domain, const Real &a_dx, LevelGridMetrics *a_levelGridMetrics, const MOLPhysics *const a_molPhysics, const int &a_numStates)
Actual constructor.
void useArtificialDissipation(bool a_useArtificialDissipation)
sets whether to use artificial dissipation
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
virtual void setCurrentTime(const Real &a_currentTime)
Set the current time 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 ...
PatchMappedConsOperator(const int a_numFluxesPerField=1)
Constructor.
void addMappedArtificialViscosity(FArrayBox &a_JUnewFab, const FArrayBox &a_UoldFab, FluxBox &a_flux, const FluxBox &a_N, const FArrayBox &a_J, const Box &a_box, Real a_weight)
Add artificial viscosity to a_JUnew for mapped grids.
virtual void fluxCorrection(FluxBox &a_fluxAvg, const FArrayBox &a_UavgFab)
const LayoutData< FluxBox > * m_unitNormalLayPtr
Definition: PatchMappedConsOperator.H:174
Definition: PatchMappedConsOperator.H:38
double Real
Definition: REAL.H:33
Grid metrics for a level.
Definition: LevelGridMetrics.H:223
virtual void addArtificialViscosity(FArrayBox &a_UnewFab, const FArrayBox &a_UoldFab, FluxBox &a_flux, Real a_weight)
add artificial viscosity to a_Unew
Patch Cons Operator - a class for evaluating the Laplacian.
Definition: PatchConsOperator.H:30
virtual void evalRHS(FArrayBox &a_LofU, const FluxBox &a_FfaceAvg)
Evaluate the operator (div(flux)) at a given time.
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 ...
virtual interface class encapsulating multi-block mapping API
Definition: MultiBlockCoordSys.H:34
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
void artificialDissipation(Real a_artificialDissipation)
sets coefficient of artificial dissipation
const MultiBlockCoordSys * m_coordSys
Definition: PatchMappedConsOperator.H:165
Definition: DataIndex.H:114
LevelGridMetrics * m_levelGridMetrics
Definition: PatchMappedConsOperator.H:171
Definition: FArrayBox.H:45
bool m_isMaxSpeedSet
Definition: PatchMappedConsOperator.H:186
virtual void getAllFluxes(FluxBox &a_FfaceAvg, FluxBox &a_FfaceCen, const FluxBox &a_WfaceAvg, const FluxBox &a_WfaceCen)
DataIndex m_currentDataIdx
Definition: PatchMappedConsOperator.H:189
Real m_maxSpeed
Definition: PatchMappedConsOperator.H:183
ProblemDomain m_blockDomain
Definition: PatchMappedConsOperator.H:161