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