simpleFoam.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  simpleFoam
28 
29 Group
30  grpIncompressibleSolvers
31 
32 Description
33  Steady-state solver for incompressible, turbulent flows.
34 
35  \heading Solver details
36  The solver uses the SIMPLE algorithm to solve the continuity equation:
37 
38  \f[
39  \div \vec{U} = 0
40  \f]
41 
42  and momentum equation:
43 
44  \f[
45  \div \left( \vec{U} \vec{U} \right) - \div \gvec{R}
46  = - \grad p + \vec{S}_U
47  \f]
48 
49  Where:
50  \vartable
51  \vec{U} | Velocity
52  p | Pressure
53  \vec{R} | Stress tensor
54  \vec{S}_U | Momentum source
55  \endvartable
56 
57  \heading Required fields
58  \plaintable
59  U | Velocity [m/s]
60  p | Kinematic pressure, p/rho [m2/s2]
61  <turbulence fields> | As required by user selection
62  \endplaintable
63 
64 \*---------------------------------------------------------------------------*/
65 
66 #include "fvCFD.H"
69 #include "simpleControl.H"
70 #include "fvOptions.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 int main(int argc, char *argv[])
75 {
76  argList::addNote
77  (
78  "Steady-state solver for incompressible, turbulent flows."
79  );
80 
81  #include "postProcess.H"
82 
83  #include "addCheckCaseOptions.H"
84  #include "setRootCaseLists.H"
85  #include "createTime.H"
86  #include "createMesh.H"
87  #include "createControl.H"
88  #include "createFields.H"
89  #include "initContinuityErrs.H"
90 
91  turbulence->validate();
92 
93  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95  Info<< "\nStarting time loop\n" << endl;
96 
97  while (simple.loop())
98  {
99  Info<< "Time = " << runTime.timeName() << nl << endl;
100 
101  // --- Pressure-velocity SIMPLE corrector
102  {
103  #include "UEqn.H"
104  #include "pEqn.H"
105  }
106 
107  laminarTransport.correct();
108  turbulence->correct();
109 
110  runTime.write();
111 
112  runTime.printExecutionTime(Info);
113  }
114 
115  Info<< "End\n" << endl;
116 
117  return 0;
118 }
119 
120 
121 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
simple
const dictionary & simple
Definition: readFluidMultiRegionSIMPLEControls.H:1
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
setRootCaseLists.H
addCheckCaseOptions.H
Required Classes.
Foam::Info
messageStream Info
Information stream (stdout output on master, null elsewhere)
simpleControl.H
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)