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 | Copyright (C) 2011-2015 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  Application
25  simpleFoam
26 
27  Group
28  grpIncompressibleSolvers
29 
30  Description
31  Steady-state solver for incompressible flows with turbulence modelling.
32 
33  \heading Solver details
34  The solver uses the SIMPLE algorithm to solve the continuity equation:
35 
36  \f[
37  \div \vec{U} = 0
38  \f]
39 
40  and momentum equation:
41 
42  \f[
43  \div \left( \vec{U} \vec{U} \right) - \div \gvec{R}
44  = - \grad p + \vec{S}_U
45  \f]
46 
47 Where:
48 \vartable
49 \vec{U} | Velocity
50 p | Pressure
51 \vec{R} | Stress tensor
52 \vec{S}_U | Momentum source
53 \endvartable
54 
55 \heading Required fields
56 \plaintable
57 U | Velocity [m/s]
58 p | Kinematic pressure, p/rho [m2/s2]
59 <turbulence fields> | As required by user selection
60 \endplaintable
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #include "fvCFD.H"
67 #include "simpleControl.H"
68 #include "fvOptions.H"
69 
70 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71 
72 int main(int argc, char *argv[])
73 {
74 #include "setRootCase.H"
75 #include "createTime.H"
76 #include "createMesh.H"
77 
79 
80 #include "createFields.H"
81 #include "createMRF.H"
82 #include "createFvOptions.H"
83 #include "initContinuityErrs.H"
84 
85  turbulence->validate();
86 
87  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88 
89  Info<< "\nStarting time loop\n" << endl;
90 #include "CourantNo.H"
91 
92  while (simple.loop())
93  {
94  Info<< "Time = " << runTime.timeName() << nl << endl;
95 
96  // --- Pressure-velocity SIMPLE corrector
97  {
98 #include "UEqn.H"
99 #include "pEqn.H"
100 
101  // Copy - no reference
102  const volScalarField nuEff = turbulence->nuEff();
103  // while (simple.correctNonOrthogonal())
104  for (label i =0;i< 5 ;i++)
105  {
106 
107  fvScalarMatrix airAgeEqn
108  (
109  // fvm::ddt(airAge)
110  //+ fvm::div(phi, airAge)
111  fvm::div(phi, airAge)
112  - fvm::laplacian(nuEff, airAge)
113  ==
114  dimensionedScalar("ageSource", airAge.dimensions()*dimensionSet(0,0,-1,0,0), 1) // fvOptions(AoA)
115  );
116 
117  airAgeEqn.relax();
118  airAgeEqn.solve();
119  }
120  }
122  turbulence->correct();
123  runTime.write();
124 
125  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
126  << " ClockTime = " << runTime.elapsedClockTime() << " s"
127  << nl << endl;
128  }
129  Info<< "End\n" << endl;
130  return 0;
131 }
132 
133 
134 // ************************************************************************* //
fvOptions.H
Foam::simpleControl
SIMPLE control class to supply convergence information/checks for the SIMPLE loop.
Definition: simpleControl.H:46
singlePhaseTransportModel.H
phi
surfaceScalarField & phi
Definition: setRegionFluidFields.H:8
turbulentTransportModel.H
createFields.H
UEqn.H
Foam::fvc::div
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Definition: fvcDiv.C:47
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::dimensionSet
Dimension set for the base types.
Definition: dimensionSet.H:116
simple
Simple relative velocity model.
createFvOptions.H
Foam::fvc::laplacian
tmp< GeometricField< Type, fvPatchField, volMesh > > laplacian(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
Definition: fvcLaplacian.C:45
Foam::fvMatrix::solve
SolverPerformance< Type > solve(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
turbulence
autoPtr< compressible::turbulenceModel > turbulence
Definition: createFields.H:23
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::Info
messageStream Info
Foam::fvMatrix::relax
void relax(const scalar alpha)
Relax matrix (for steady-state solution).
Definition: fvMatrix.C:519
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
simpleControl.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
setRootCase.H
laminarTransport
singlePhaseTransportModel laminarTransport(U, phi)
simple
const dictionary & simple
Definition: readFluidMultiRegionSIMPLEControls.H:1
createMesh.H
createTime.H
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::singlePhaseTransportModel::correct
virtual void correct()
Correct the laminar viscosity.
Definition: singlePhaseTransportModel.C:76
fvCFD.H
pEqn.H
Foam::GeometricField
Generic GeometricField class.
Definition: surfaceFieldsFwd.H:52
main
int main(int argc, char *argv[])
Definition: simpleFoam.C:100