isothermalFluid.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::isothermalFluid
26 
27 Description
28  Solver module for steady or transient turbulent flow of compressible
29  isothermal fluids with optional mesh motion and change.
30 
31  Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
32  pseudo-transient and steady simulations.
33 
34  Optional fvModels and fvConstraints are provided to enhance the simulation
35  in many ways including adding various sources, Lagrangian
36  particles, surface film etc. and constraining or limiting the solution.
37 
38  Reference:
39  \verbatim
40  Greenshields, C. J., & Weller, H. G. (2022).
41  Notes on Computational Fluid Dynamics: General Principles.
42  CFD Direct Ltd.: Reading, UK.
43  \endverbatim
44 
45 SourceFiles
46  isothermalFluid.C
47 
48 See also
49  Foam::solvers::fluidSolver
50  Foam::solvers::incompressibleFluid
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef isothermalFluid_H
55 #define isothermalFluid_H
56 
57 #include "fluidSolver.H"
58 #include "fluidThermo.H"
60 #include "buoyancy.H"
61 #include "pressureReference.H"
62 #include "IOMRFZoneList.H"
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 namespace Foam
67 {
68 namespace solvers
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class isothermalFluid Declaration
73 \*---------------------------------------------------------------------------*/
74 
75 class isothermalFluid
76 :
77  public fluidSolver
78 {
79 
80 protected:
81 
82  // Thermophysical properties
83 
84  //- Pointer to the fluid thermophysical properties
86 
87  //- Reference to the fluid thermophysical properties
89 
90  //- Reference to the pressure field
92 
93  //- The continuity density field
95 
96  //- Rate of change of the pressure
97  // Used in the enthalpy equation
99 
100 
101  // Optional buoyancy
102 
103  //- Pointer to the optional buoyancy force
104  // Case is considered buoyant if the p_rgh field exists
106 
107  //- Reference to the buoyant pressure for buoyant cases
108  // otherwise to the pressure
110 
111 
112  // Pressure reference
113 
114  //- Pressure reference
116 
117 
118  // Kinematic properties
119 
120  //- Velocity field
122 
123  //- Mass-flux field
125 
126  //- Kinetic energy field
127  // Used in the energy equation
129 
130 
131  // Momentum transport
132 
133  //- Pointer to the momentum transport model
135 
136 
137  // Continuity properties
138 
139  //- Initial mass in the region
141 
142 
143  // Optional models
144 
145  //- MRF zone list
147 
148 
149  // Cached temporary fields
150 
151  //- Momentum equation net force source term
152  // Used for buoyant simulations only
154 
155  //- Pointer to the vol momentum field
156  // used for mesh-change to set rhoUf for introduced faces
158 
159  //- Pointer to the old-time vol momentum field
160  // used for mesh-change to set rhoUf.oldTime() for introduced faces
162 
163  //- Pointer to the surface momentum field
164  // used to recreate the flux after mesh-change
166 
167  //- Pointer to the vol momentum divergence field
168  // used in correctPhi to ensure the corrected phi has the
169  // same divergence
171 
172  //- Optional LTS reciprocal time-step field
174 
175  //- Cached momentum matrix
176  // shared between the momentum predictor and pressure corrector
178 
179 
180 private:
181 
182  // Private Member Functions
183 
184  //- Set rDeltaT for LTS
185  virtual void setRDeltaT();
186 
187  //- Correct the cached Courant numbers
188  void correctCoNum();
189 
190  //- Calculate and print the continuity errors
191  void continuityErrors();
192 
193  //- Construct the continuity equation and correct the density
194  void correctDensity();
195 
196  //- Construct the pressure equation
197  // and correct the pressure and velocity
198  void correctPressure();
199 
200  //- Construct the buoyant pressure equation
201  // and correct the pressure and velocity
202  void correctBuoyantPressure();
203 
204 
205 protected:
206 
207  //- Adds the mesh-motion work to the pressure work term provided
209  (
211  ) const;
212 
213 
214 public:
215 
216  // Public Data
217 
218  //- Reference to the fluid thermophysical properties
219  const fluidThermo& thermo;
220 
221  //- Reference to the pressure field
222  const volScalarField& p;
223 
224  //- Reference to the continuity density field
225  const volScalarField& rho;
226 
227  //- Velocity field
228  const volVectorField& U;
229 
230  //- Mass-flux field
231  const surfaceScalarField& phi;
232 
233 
234  //- Runtime type information
235  TypeName("isothermalFluid");
236 
237 
238  // Constructors
239 
240  //- Construct from region mesh and thermophysical properties
242 
243  //- Construct from region mesh
245 
246  //- Disallow default bitwise copy construction
247  isothermalFluid(const isothermalFluid&) = delete;
248 
249 
250  //- Destructor
251  virtual ~isothermalFluid();
252 
253 
254  // Member Functions
255 
256  //- Called at the start of the time-step, before the PIMPLE loop
257  virtual void preSolve();
258 
259  //- Called at the start of the PIMPLE loop to move the mesh
260  virtual void moveMesh();
261 
262  //- Called at the start of the PIMPLE loop
263  virtual void prePredictor();
264 
265  //- Construct and optionally solve the momentum equation
266  virtual void momentumPredictor();
267 
268  //- Construct and solve the energy equation,
269  // convert to temperature
270  // and update thermophysical and transport properties
271  virtual void thermophysicalPredictor();
272 
273  //- Construct and solve the pressure equation in the PISO loop
274  virtual void pressureCorrector();
275 
276  //- Correct the momentum and thermophysical transport modelling
277  virtual void postCorrector();
278 
279  //- Called after the PIMPLE loop at the end of the time-step
280  virtual void postSolve();
281 
282 
283  // Member Operators
284 
285  //- Disallow default bitwise assignment
286  void operator=(const isothermalFluid&) = delete;
287 };
288 
289 
290 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
291 
292 } // End namespace solvers
293 } // End namespace Foam
294 
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 
297 #endif
298 
299 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
List of MRF zones with IO functionality. MRF zones are specified by a list of dictionary entries,...
Definition: IOMRFZoneList.H:68
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
Provides controls for the pressure reference in closed-volume simulations.
const fvMesh & mesh
Region mesh.
Definition: solver.H:94
Base solver module for fluid solvers.
Definition: fluidSolver.H:62
Solver module for steady or transient turbulent flow of compressible isothermal fluids with optional ...
virtual void thermophysicalPredictor()
Construct and solve the energy equation,.
autoPtr< volScalarField > divrhoU
Pointer to the vol momentum divergence field.
volScalarField rho_
The continuity density field.
volScalarField & p_rgh
Reference to the buoyant pressure for buoyant cases.
const surfaceScalarField & phi
Mass-flux field.
volVectorField U_
Velocity field.
virtual void prePredictor()
Called at the start of the PIMPLE loop.
Definition: prePredictor.C:30
tmp< fvVectorMatrix > tUEqn
Cached momentum matrix.
virtual void postSolve()
Called after the PIMPLE loop at the end of the time-step.
tmp< volVectorField > netForce
Momentum equation net force source term.
autoPtr< surfaceVectorField > rhoUf
Pointer to the surface momentum field.
tmp< volScalarField > trDeltaT
Optional LTS reciprocal time-step field.
autoPtr< volVectorField > rhoU
Pointer to the vol momentum field.
fluidThermo & thermo_
Reference to the fluid thermophysical properties.
virtual ~isothermalFluid()
Destructor.
autoPtr< fluidThermo > thermoPtr_
Pointer to the fluid thermophysical properties.
volScalarField K
Kinetic energy field.
virtual void moveMesh()
Called at the start of the PIMPLE loop to move the mesh.
Definition: moveMesh.C:32
autoPtr< solvers::buoyancy > buoyancy
Pointer to the optional buoyancy force.
const volVectorField & U
Velocity field.
virtual void pressureCorrector()
Construct and solve the pressure equation in the PISO loop.
IOMRFZoneList MRF
MRF zone list.
virtual void postCorrector()
Correct the momentum and thermophysical transport modelling.
tmp< volScalarField::Internal > pressureWork(const tmp< volScalarField::Internal > &) const
Adds the mesh-motion work to the pressure work term provided.
autoPtr< volVectorField > rhoU0
Pointer to the old-time vol momentum field.
virtual void momentumPredictor()
Construct and optionally solve the momentum equation.
volScalarField & p_
Reference to the pressure field.
surfaceScalarField phi_
Mass-flux field.
isothermalFluid(fvMesh &mesh, autoPtr< fluidThermo >)
Construct from region mesh and thermophysical properties.
const volScalarField & rho
Reference to the continuity density field.
volScalarField::Internal dpdt
Rate of change of the pressure.
Foam::pressureReference pressureReference
Pressure reference.
virtual void preSolve()
Called at the start of the time-step, before the PIMPLE loop.
void operator=(const isothermalFluid &)=delete
Disallow default bitwise assignment.
const fluidThermo & thermo
Reference to the fluid thermophysical properties.
const volScalarField & p
Reference to the pressure field.
TypeName("isothermalFluid")
Runtime type information.
dimensionedScalar initialMass
Initial mass in the region.
autoPtr< compressible::momentumTransportModel > momentumTransport
Pointer to the momentum transport model.
A class for managing temporary objects.
Definition: tmp.H:55
Namespace for OpenFOAM.