pisoFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2023 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  pisoFoam
29 
30 Group
31  grpIncompressibleSolvers
32 
33 Description
34  Transient solver for incompressible, turbulent flow, using the PISO
35  algorithm.
36 
37  \heading Solver details
38  The solver uses the PISO algorithm to solve the continuity equation:
39 
40  \f[
41  \div \vec{U} = 0
42  \f]
43 
44  and momentum equation:
45 
46  \f[
47  \ddt{\vec{U}} + \div \left( \vec{U} \vec{U} \right) - \div \gvec{R}
48  = - \grad p
49  \f]
50 
51  Where:
52  \vartable
53  \vec{U} | Velocity
54  p | Pressure
55  \vec{R} | Stress tensor
56  \endvartable
57 
58  Sub-models include:
59  - turbulence modelling, i.e. laminar, RAS or LES
60  - run-time selectable MRF and finite volume options, e.g. explicit porosity
61 
62  \heading Required fields
63  \plaintable
64  U | Velocity [m/s]
65  p | Kinematic pressure, p/rho [m2/s2]
66  <turbulence fields> | As required by user selection
67  \endplaintable
68 
69 \*---------------------------------------------------------------------------*/
70 
71 #include "fvCFD.H"
74 #include "pisoControl.H"
75 #include "fvOptions.H"
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 int main(int argc, char *argv[])
80 {
81  argList::addNote
82  (
83  "Transient solver for incompressible, turbulent flow,"
84  " using the PISO algorithm."
85  );
86 
87  #include "postProcess.H"
88 
89  #include "addCheckCaseOptions.H"
90  #include "setRootCaseLists.H"
91  #include "createTime.H"
92  #include "createMesh.H"
93  #include "createControl.H"
94  #include "createFields.H"
95  #include "initContinuityErrs.H"
96 
97  turbulence->validate();
98 
99  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101  Info<< "\nStarting time loop\n" << endl;
102 
103  while (runTime.loop())
104  {
105  Info<< "Time = " << runTime.timeName() << nl << endl;
106 
107  #include "CourantNo.H"
108 
109  // Update settings from the control dictionary
110  piso.read();
111 
112  // Pressure-velocity PISO corrector
113  {
114  #include "UEqn.H"
115 
116  // --- PISO loop
117  while (piso.correct())
118  {
119  #include "pEqn.H"
120  }
121  }
122 
123  laminarTransport.correct();
124  turbulence->correct();
125 
126  runTime.write();
127 
128  runTime.printExecutionTime(Info);
129  }
130 
131  Info<< "End\n" << endl;
132 
133  return 0;
134 }
135 
136 
137 // ************************************************************************* //
constexpr char nl
The newline &#39;\n&#39; character (0x0a)
Definition: Ostream.H:50
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
pisoControl piso(mesh)
singlePhaseTransportModel laminarTransport(U, phi)
Info<< "Reading field U\"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
Required Classes.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Execute application functionObjects to post-process existing results.
Required Classes.