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 surface momentum field
160  // used to recreate the flux after mesh-change
162 
163  //- Pointer to the vol momentum divergence field
164  // used in correctPhi to ensure the corrected phi has the
165  // same divergence
167 
168  //- Optional LTS reciprocal time-step field
170 
171  //- Cached momentum matrix
172  // shared between the momentum predictor and pressure corrector
174 
175 
176 private:
177 
178  // Private Member Functions
179 
180  //- Set rDeltaT for LTS
181  virtual void setRDeltaT();
182 
183  //- Correct the cached Courant numbers
184  void correctCoNum();
185 
186  //- Calculate and print the continuity errors
187  void continuityErrors();
188 
189  //- Construct the continuity equation and correct the density
190  void correctDensity();
191 
192  //- Construct the pressure equation
193  // and correct the pressure and velocity
194  void correctPressure();
195 
196  //- Construct the buoyant pressure equation
197  // and correct the pressure and velocity
198  void correctBuoyantPressure();
199 
200 
201 protected:
202 
203  //- Adds the mesh-motion work to the pressure work term provided
205  (
207  ) const;
208 
209 
210 public:
211 
212  // Public Data
213 
214  //- Reference to the fluid thermophysical properties
215  const fluidThermo& thermo;
216 
217  //- Reference to the pressure field
218  const volScalarField& p;
219 
220  //- Reference to the continuity density field
221  const volScalarField& rho;
222 
223  //- Velocity field
224  const volVectorField& U;
225 
226  //- Mass-flux field
227  const surfaceScalarField& phi;
228 
229 
230  //- Runtime type information
231  TypeName("isothermalFluid");
232 
233 
234  // Constructors
235 
236  //- Construct from region mesh and thermophysical properties
238 
239  //- Construct from region mesh
241 
242  //- Disallow default bitwise copy construction
243  isothermalFluid(const isothermalFluid&) = delete;
244 
245 
246  //- Destructor
247  virtual ~isothermalFluid();
248 
249 
250  // Member Functions
251 
252  //- Called at the start of the time-step, before the PIMPLE loop
253  virtual void preSolve();
254 
255  //- Called at the start of the PIMPLE loop to move the mesh
256  virtual void moveMesh();
257 
258  //- Corrections that follow mesh motion
259  virtual void motionCorrector();
260 
261  //- Called at the start of the PIMPLE loop
262  virtual void prePredictor();
263 
264  //- Construct and optionally solve the momentum equation
265  virtual void momentumPredictor();
266 
267  //- Construct and solve the energy equation,
268  // convert to temperature
269  // and update thermophysical and transport properties
270  virtual void thermophysicalPredictor();
271 
272  //- Construct and solve the pressure equation in the PISO loop
273  virtual void pressureCorrector();
274 
275  //- Correct the momentum and thermophysical transport modelling
276  virtual void postCorrector();
277 
278  //- Called after the PIMPLE loop at the end of the time-step
279  virtual void postSolve();
280 
281 
282  // Member Operators
283 
284  //- Disallow default bitwise assignment
285  void operator=(const isothermalFluid&) = delete;
286 };
287 
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 } // End namespace solvers
292 } // End namespace Foam
293 
294 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 
296 #endif
297 
298 // ************************************************************************* //
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:99
Provides controls for the pressure reference in closed-volume simulations.
const fvMesh & mesh
Region mesh.
Definition: solver.H:101
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 motionCorrector()
Corrections that follow mesh motion.
Definition: moveMesh.C:42
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.
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.