multiphaseEuler.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::solvers::multiphaseEuler
26 
27 Description
28  Solver module for a system of any number of compressible fluid phases with a
29  common pressure, but otherwise separate properties. The type of phase model
30  is run time selectable and can optionally represent multiple species and
31  in-phase reactions. The phase system is also run time selectable and can
32  optionally represent different types of momentum, heat and mass transfer.
33 
34  Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
35  pseudo-transient and steady simulations.
36 
37  Optional fvModels and fvConstraints are provided to enhance the simulation
38  in many ways including adding various sources, Lagrangian
39  particles, surface film etc. and constraining or limiting the solution.
40 
41 SourceFiles
42  multiphaseEuler.C
43 
44 See also
45  Foam::solvers::compressibleVoF
46  Foam::solvers::fluidSolver
47  Foam::solvers::incompressibleFluid
48 
49 \*---------------------------------------------------------------------------*/
50 
51 #ifndef multiphaseEuler_H
52 #define multiphaseEuler_H
53 
54 #include "fluidSolver.H"
55 #include "phaseSystem.H"
57 #include "buoyancy.H"
58 #include "pressureReference.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace solvers
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class multiphaseEuler Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class multiphaseEuler
72 :
73  public fluidSolver
74 {
75 
76 protected:
77 
78  // Controls
79 
80  //- Cell/face momentum equation switch
81  // Defaults to false, i.e. uses the cell momentum equation
83 
84  //- Cell/face drag correction for cell momentum corrector
85  // Defaults to false
87 
88  //- Partial elimination drag contribution optimisation
89  // Defaults to false
91 
92  //- Number of energy correctors
93  // Used to improve stability of phase-change sibulations
94  // Defaults to 1
96 
97 
98  //- Optional LTS reciprocal time-step field
100 
101  //- Optional LTS reciprocal face time-step field
103 
104  //- Buoyancy force
106 
107 
108  // Phase properties
109 
111 
113 
115 
117 
118 
119  // Thermophysical properties
120 
122 
123  //- Reference to the buoyant pressure for buoyant cases
124  // otherwise to the pressure
126 
127 
128  // Pressure reference
129 
130  //- Pressure reference
132 
133 
134  // Optional models
135 
136  const IOMRFZoneList& MRF;
137 
138 
139  // Cached temporary fields
140 
141  //- Temporary phase momentum matrices
142  // shared between the momentum predictor and pressure corrector
144 
145  //- Temporary storage for the reciprocal momentum equation diagonal
146  // Used by the phase-fraction predictor and pressure corrector
148 
149  //- Temporary storage for the reciprocal momentum equation diagonal
150  // Used by the phase-fraction predictor and face pressure corrector
152 
153  //- Stored divU from the previous mesh so that it can be
154  // mapped and used in correctPhi to ensure the corrected phi
155  // has the same divergence
157 
158  //- Read controls
159  void readControls();
160 
161 
162 private:
163 
164  // Private Member Functions
165 
166  //- Set rDeltaT for LTS
167  virtual void setRDeltaT();
168 
169  //- Correct the cached Courant numbers
170  void correctCoNum();
171 
172  //- Composition predictor
173  // called in prePredictor() after phase-fraction prediction
174  void compositionPredictor();
175 
176  //- Energy and temperature predictor
177  void energyPredictor();
178 
179  //- Cell-based momentum equation predictor
180  void cellMomentumPredictor();
181 
182  //- Face-based momentum equation predictor
183  void faceMomentumPredictor();
184 
185  //- Cell-based pressure equation predictor
186  void cellPressureCorrector();
187 
188  //- Face-based pressure equation predictor
189  void facePressureCorrector();
190 
191  //- Return the list of pressure equation compressibility contributions
192  PtrList<fvScalarMatrix> compressibilityEqns
193  (
194  const PtrList<volScalarField>& dmdts,
195  const PtrList<volScalarField>& d2mdtdps
196  ) const;
197 
198 
199 public:
200 
201  // Public Data
202 
203  //- Reference to the multiphase fluid
204  const phaseSystem& fluid;
205 
206  //- Reference to the phases
208 
209  //- Reference to the pressure field
210  const volScalarField& p;
211 
212  //- Reference to the mass-flux field
213  const surfaceScalarField& phi;
214 
215 
216  //- Runtime type information
217  TypeName("multiphaseEuler");
218 
219 
220  // Constructors
221 
222  //- Construct from region mesh
224 
225  //- Disallow default bitwise copy construction
226  multiphaseEuler(const multiphaseEuler&) = delete;
227 
228 
229  //- Destructor
230  virtual ~multiphaseEuler();
231 
232 
233  // Member Functions
234 
235  //- Called at the start of the time-step, before the PIMPLE loop
236  virtual void preSolve();
237 
238  //- Called at the start of the PIMPLE loop to move the mesh
239  virtual void moveMesh();
240 
241  //- Called at the start of the PIMPLE loop
242  virtual void prePredictor();
243 
244  //- Construct and optionally solve the momentum equation
245  virtual void momentumPredictor();
246 
247  //- Construct and solve the energy equation,
248  // convert to temperature
249  // and update thermophysical and transport properties
250  virtual void thermophysicalPredictor();
251 
252  //- Construct and solve the pressure equation in the PISO loop
253  virtual void pressureCorrector();
254 
255  //- Correct the momentum and thermophysical transport modelling
256  virtual void postCorrector();
257 
258  //- Called after the PIMPLE loop at the end of the time-step
259  virtual void postSolve();
260 
261 
262  // Member Operators
263 
264  //- Disallow default bitwise assignment
265  void operator=(const multiphaseEuler&) = delete;
266 };
267 
268 
269 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270 
271 } // End namespace solvers
272 } // End namespace Foam
273 
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 
276 #endif
277 
278 // ************************************************************************* //
Generic GeometricField class.
List of MRF zones with IO functionality. MRF zones are specified by a list of dictionary entries,...
Definition: IOMRFZoneList.H:68
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Class to represent a system of phases and model interfacial transfers between them.
Definition: phaseSystem.H:73
Provides controls for the pressure reference in closed-volume simulations.
const fvMesh & mesh
Region mesh.
Definition: solver.H:94
Buoyancy related data for the Foam::solvers::isothermalFluid solver module when solving buoyant cases...
Definition: buoyancy.H:70
Base solver module for fluid solvers.
Definition: fluidSolver.H:62
Solver module for a system of any number of compressible fluid phases with a common pressure,...
virtual void thermophysicalPredictor()
Construct and solve the energy equation,.
volScalarField & p_rgh
Reference to the buoyant pressure for buoyant cases.
const surfaceScalarField & phi
Reference to the mass-flux field.
virtual void prePredictor()
Called at the start of the PIMPLE loop.
virtual void postSolve()
Called after the PIMPLE loop at the end of the time-step.
solvers::buoyancy buoyancy
Buoyancy force.
int nEnergyCorrectors
Number of energy correctors.
tmp< volScalarField > trDeltaT
Optional LTS reciprocal time-step field.
phaseSystem::phaseModelList & phases_
virtual void moveMesh()
Called at the start of the PIMPLE loop to move the mesh.
Definition: moveMesh.C:32
TypeName("multiphaseEuler")
Runtime type information.
Switch partialElimination
Partial elimination drag contribution optimisation.
autoPtr< volScalarField > divU
Stored divU from the previous mesh so that it can be.
PtrList< fvVectorMatrix > UEqns
Temporary phase momentum matrices.
virtual void pressureCorrector()
Construct and solve the pressure equation in the PISO loop.
virtual void postCorrector()
Correct the momentum and thermophysical transport modelling.
virtual void momentumPredictor()
Construct and optionally solve the momentum equation.
void readControls()
Read controls.
Switch faceMomentum
Cell/face momentum equation switch.
Switch dragCorrection
Cell/face drag correction for cell momentum corrector.
PtrList< surfaceScalarField > rAUfs
Temporary storage for the reciprocal momentum equation diagonal.
PtrList< volScalarField > rAUs
Temporary storage for the reciprocal momentum equation diagonal.
autoPtr< phaseSystem > fluidPtr_
Foam::pressureReference pressureReference
Pressure reference.
tmp< surfaceScalarField > trDeltaTf
Optional LTS reciprocal face time-step field.
virtual void preSolve()
Called at the start of the time-step, before the PIMPLE loop.
const phaseSystem::phaseModelList & phases
Reference to the phases.
void operator=(const multiphaseEuler &)=delete
Disallow default bitwise assignment.
virtual ~multiphaseEuler()
Destructor.
const volScalarField & p
Reference to the pressure field.
multiphaseEuler(fvMesh &mesh)
Construct from region mesh.
const phaseSystem & fluid
Reference to the multiphase fluid.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.