Chombo + EB + MF  3.2
LevelMappedConsOperator.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 _LEVELMAPPEDCONSOPERATOR_H_
12 #define _LEVELMAPPEDCONSOPERATOR_H_
13 
14 // Original design: Phil Colella
15 // Original implementation:
16 // Implementation date:
17 
18 #include "Tuple.H"
19 #include "FArrayBox.H"
20 #include "FluxBox.H"
21 #include "ProblemDomain.H"
22 #include "DisjointBoxLayout.H"
23 #include "LevelData.H"
24 #include "LevelFluxRegister.H"
25 #include "MOLPhysics.H"
27 #include "TimeInterpolatorRK4.H"
28 #include "LevelSourceTerm.H"
29 #include "LevelConsOperator.H"
30 
31 #include "NamespaceHeader.H"
32 
33 //--Forward declarations
34 
35 class LevelGridMetrics;
37 class BlockRegister;
38 
39 //! \class LevelMappedConsOperator
40 //! This class defines a flux divergence operator for hyperbolic conservation
41 //! laws on a single refinement level of a set of structured grids.
43 {
44 public:
45 
46  /// Default constructor
48 
49  /// Constructs a Level operator with the given PatchMappedConsOperator instance.
51 
52  /// Destructor
53  virtual ~LevelMappedConsOperator();
54 
55 
56 /*==============================================================================
57  * Member functions
58  *============================================================================*/
59 
60  /// Define the object so that time stepping can begin (actual constructor)
61  virtual void define(LevelGridMetrics *const a_levelGridMetricsPtr,
62  LevelData<FArrayBox> *const a_UPtr,
63  const Copier *const a_UExchangeCopierPtr,
64  const Copier *const a_JUExchangeCopierPtr,
65  const DisjointBoxLayout* a_coarserGrids,
66  const ProblemDomain& a_domain,
67  const int a_numGhost,
68  const int a_numInterpolatorCrFnGhost,
69  const int a_refineCoarse,
70  const Real a_dx,
71  const MOLPhysics* const a_molPhysics,
72  const int a_numStates,
73  const bool a_hasCoarser);
74 
75  /// Define indices in to the metrics matrix
76  void defineMetricsIndices(const NewFourthOrderCoordSys *const a_coordSysPtr);
77 
78  /// Find unit normals for applying the Riemann problem on mapped grids
80 
81  /// Evaluate the operator \f$(-div(F))\f$ at a given time.
82  virtual void evalRHS(LevelData<FArrayBox>& a_LofU,
84  LevelFluxRegister& a_finerFluxRegister,
85  LevelFluxRegister& a_coarserFluxRegister,
86  const LevelData<FArrayBox>& a_JUcoarseOld,
87  const Real& a_timeCoarseOld,
88  const LevelData<FArrayBox>& a_JUcoarseNew,
89  const Real& a_timeCoarseNew,
90  Real a_time,
91  Real a_fluxweight);
92 
93 
94 
95  /// sets whether to use source term
96  void useSourceTerm(bool a_useSourceTerm);
97 
98  /// add artificial viscosity to a_Unew
99  virtual void addArtificialViscosity(
100  LevelData<FArrayBox>& a_Unew,
101  const LevelData<FArrayBox>& a_Uold,
102  LevelFluxRegister& a_finerFluxRegister,
103  LevelFluxRegister& a_coarserFluxRegister,
104  Real a_oldTime,
105  Real a_weight);
106 
107  /// update a_finerFluxRegister and a_coarserFluxRegister
108  virtual void updateFluxTotalsAndRegisters(
109  FluxBox& a_Fface,
110  LevelFluxRegister& a_finerFluxRegister,
111  LevelFluxRegister& a_coarserFluxRegister,
112  const DataIndex& a_dataIndex,
113  Real a_weight);
114 
115  /// Return time interpolator object within patch-fill object.
117 
118  /// fill in ghost cells of a_U to RK4 intermediates
119  virtual void fillGhostsRK4AndComputeU(
120  LevelData<FArrayBox>& a_JU,
121  const Real& a_time,
122  int a_stage,
123  const Real& a_timeCoarseOld,
124  const Real& a_timeCoarseNew);
125 
126  /// set source term object
127  void setSourceTerm(LevelSourceTerm* a_sourceTermPtr);
128 
129  /// sets whether to use artificial dissipation
130  void useArtificialDissipation(bool a_useArtificialDissipation);
131 
132  /// sets coefficient of artificial dissipation
133  void artificialDissipation(Real a_artificialDissipation);
134 
135 protected:
136 
137  /// sets m_flattening
138  virtual void defineFlattening();
139 
140  /// sets m_patchMappedConsOperator
141  virtual void definePatch(const MOLPhysics* const a_molPhysics);
142 
143  virtual void setPatchIndex(const DataIndex& a_ind) const;
144 
145 //--Multiblock only (defined in LevelMappedConsOperator_MB.cpp)
146 
147  /// Define members required for multiblock grids
148  void defineMultiblockMbrs();
149 
150  /// Sets single-valued fluxes at block boundaries
151  // Using the contents of a BlockRegister, set the single-valued
152  // fluxes at block boundaries.
153  void setCommonFlux(LevelData<FluxBox>& a_flux,
154  const BlockRegister& a_blockRegister) const;
155 
156 //--End multiblock only
157 
158  /// return maximum speed from m_UPtr
159  virtual Real getMaxSpeed();
160 
161 private:
162 
163  // Disallowed for all the usual reasons
164  void operator=(const LevelMappedConsOperator&);
166 
167 
168 /*==============================================================================
169  * Data members
170  *============================================================================*/
171 
172 protected:
173 
174  // Metrics for the level
176 
177  // <U>
179 
180  // Unit normals for applying Riemann solvers on mapped grids
182 
183  // Exchange copier for <U>
185 
186  // Exchange copier for <JU>
188 
189  // Patch integrator
191 
192  // The time interpolator
194 
195  // Indexing of metrics components [face direction][component]
197 
198 
199  // A velocity interval, if it exists in the conserved variables
201 
202  // Interval within fluxes of vector components
204 
205  // m_levelGridMetricsPtr->getBoxes() grown by 1 then intersected with domain
207 
208  // use source term? Default false. If true, in m_sourceTermPtr.
210 
211  // Source term
213 
214  // use artificial dissipation? Default false.
216 
217  // coefficient of artificial dissipation
219 
220 //--Multiblock only
221 
223 };
224 
225 #include "NamespaceFooter.H"
226 
227 #endif
bool m_useArtificialDissipation
Definition: LevelMappedConsOperator.H:215
void useArtificialDissipation(bool a_useArtificialDissipation)
sets whether to use artificial dissipation
Interval m_velocityIntv
Definition: LevelMappedConsOperator.H:200
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Class to hold data on a mapped multiblock domain block boundary.
Definition: BlockRegister.H:27
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
virtual Real getMaxSpeed()
return maximum speed from m_UPtr
virtual void setPatchIndex(const DataIndex &a_ind) const
void defineMultiblockMbrs()
Define members required for multiblock grids.
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:152
Virtual base class encapsulating mapped-grid coordinate systems.
Definition: NewFourthOrderCoordSys.H:77
const Copier * m_JUExchangeCopierPtr
Definition: LevelMappedConsOperator.H:187
virtual void evalRHS(LevelData< FArrayBox > &a_LofU, LevelData< FArrayBox > &a_JU, LevelFluxRegister &a_finerFluxRegister, LevelFluxRegister &a_coarserFluxRegister, const LevelData< FArrayBox > &a_JUcoarseOld, const Real &a_timeCoarseOld, const LevelData< FArrayBox > &a_JUcoarseNew, const Real &a_timeCoarseNew, Real a_time, Real a_fluxweight)
Evaluate the operator at a given time.
Tuple< LayoutData< IntVectSet >, 2 *SpaceDim > m_facesToFill
Definition: LevelMappedConsOperator.H:222
Definition: MOLPhysics.H:37
void artificialDissipation(Real a_artificialDissipation)
sets coefficient of artificial dissipation
Interval m_vectorFluxIntv
Definition: LevelMappedConsOperator.H:203
virtual ~LevelMappedConsOperator()
Destructor.
virtual void fillGhostsRK4AndComputeU(LevelData< FArrayBox > &a_JU, const Real &a_time, int a_stage, const Real &a_timeCoarseOld, const Real &a_timeCoarseNew)
fill in ghost cells of a_U to RK4 intermediates
TimeInterpolatorRK4 & getTimeInterpolator()
Return time interpolator object within patch-fill object.
const int SpaceDim
Definition: SPACE.H:38
void operator=(const LevelMappedConsOperator &)
void defineMetricsIndices(const NewFourthOrderCoordSys *const a_coordSysPtr)
Define indices in to the metrics matrix.
void useSourceTerm(bool a_useSourceTerm)
sets whether to use source term
LevelSourceTerm * m_sourceTermPtr
Definition: LevelMappedConsOperator.H:212
LevelData< FArrayBox > * m_UPtr
Definition: LevelMappedConsOperator.H:178
A FArrayBox-like container for face-centered fluxes.
Definition: FluxBox.H:22
LevelGridMetrics * m_levelGridMetricsPtr
Definition: LevelMappedConsOperator.H:175
Structure for passing component ranges in code.
Definition: Interval.H:23
Definition: PatchMappedConsOperator.H:38
bool m_useSourceTerm
Definition: LevelMappedConsOperator.H:209
double Real
Definition: REAL.H:33
Grid metrics for a level.
Definition: LevelGridMetrics.H:223
LevelMappedConsOperator()
Default constructor.
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
PatchMappedConsOperator * m_patchMappedConsOperatorPtr
Definition: LevelMappedConsOperator.H:190
Time interpolator class using 4th-order Runge-Kutta.
Definition: TimeInterpolatorRK4.H:24
virtual void addArtificialViscosity(LevelData< FArrayBox > &a_Unew, const LevelData< FArrayBox > &a_Uold, LevelFluxRegister &a_finerFluxRegister, LevelFluxRegister &a_coarserFluxRegister, Real a_oldTime, Real a_weight)
add artificial viscosity to a_Unew
Definition: LevelMappedConsOperator.H:42
LevelFluxRegister-A class to encapsulate a levels worth of flux registers.
Definition: LevelFluxRegister.H:29
virtual void updateFluxTotalsAndRegisters(FluxBox &a_Fface, LevelFluxRegister &a_finerFluxRegister, LevelFluxRegister &a_coarserFluxRegister, const DataIndex &a_dataIndex, Real a_weight)
update a_finerFluxRegister and a_coarserFluxRegister
Real m_artificialDissipation
Definition: LevelMappedConsOperator.H:218
Definition: DataIndex.H:114
void setSourceTerm(LevelSourceTerm *a_sourceTermPtr)
set source term object
Level Cons Operator - a class for evaluating the Laplacian.
Definition: LevelConsOperator.H:35
Definition: LevelSourceTerm.H:21
void defineUnitNormals(LevelData< FluxBox > &a_NLev)
Find unit normals for applying the Riemann problem on mapped grids.
BoxLayout m_grow1inDomainLayout
Definition: LevelMappedConsOperator.H:206
Tuple< IntVect, SpaceDim > m_metricTermComponents
Definition: LevelMappedConsOperator.H:196
const Copier * m_UExchangeCopierPtr
Definition: LevelMappedConsOperator.H:184
virtual void definePatch(const MOLPhysics *const a_molPhysics)
sets m_patchMappedConsOperator
virtual void define(LevelGridMetrics *const a_levelGridMetricsPtr, LevelData< FArrayBox > *const a_UPtr, const Copier *const a_UExchangeCopierPtr, const Copier *const a_JUExchangeCopierPtr, const DisjointBoxLayout *a_coarserGrids, const ProblemDomain &a_domain, const int a_numGhost, const int a_numInterpolatorCrFnGhost, const int a_refineCoarse, const Real a_dx, const MOLPhysics *const a_molPhysics, const int a_numStates, const bool a_hasCoarser)
Define the object so that time stepping can begin (actual constructor)
void setCommonFlux(LevelData< FluxBox > &a_flux, const BlockRegister &a_blockRegister) const
Sets single-valued fluxes at block boundaries.
LayoutData< FluxBox > m_unitNormalLay
Definition: LevelMappedConsOperator.H:181
virtual void defineFlattening()
sets m_flattening
TimeInterpolatorRK4 m_timeInterpolator
Definition: LevelMappedConsOperator.H:193