scalarTransportFoam.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-------------------------------------------------------------------------------
10License
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
26Application
27 scalarTransportFoam
28
29Group
30 grpBasicSolvers
31
32Description
33 Passive scalar transport equation solver.
34
35 \heading Solver details
36 The equation is given by:
37
38 \f[
39 \ddt{T} + \div \left(\vec{U} T\right) - \div \left(D_T \grad T \right)
40 = S_{T}
41 \f]
42
43 Where:
44 \vartable
45 T | Passive scalar
46 D_T | Diffusion coefficient
47 S_T | Source
48 \endvartable
49
50 \heading Required fields
51 \plaintable
52 T | Passive scalar
53 U | Velocity [m/s]
54 \endplaintable
55
56\*---------------------------------------------------------------------------*/
57
58#include "fvCFD.H"
59#include "fvOptions.H"
60#include "simpleControl.H"
61
62// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63
64int main(int argc, char *argv[])
65{
66 argList::addNote
67 (
68 "Passive scalar transport equation solver."
69 );
70
71 #include "addCheckCaseOptions.H"
72 #include "setRootCaseLists.H"
73 #include "createTime.H"
74 #include "createMesh.H"
75
76 simpleControl simple(mesh);
77
78 #include "createFields.H"
79
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81
82 Info<< "\nCalculating scalar transport\n" << endl;
83
84 #include "CourantNo.H"
85
86 while (simple.loop())
87 {
88 Info<< "Time = " << runTime.timeName() << nl << endl;
89
90 while (simple.correctNonOrthogonal())
91 {
93 (
94 fvm::ddt(T)
95 + fvm::div(phi, T)
96 - fvm::laplacian(DT, T)
97 ==
99 );
100
101 TEqn.relax();
102 fvOptions.constrain(TEqn);
103 TEqn.solve();
104 fvOptions.correct(T);
105 }
106
107 runTime.write();
108 }
109
110 Info<< "End\n" << endl;
111
112 return 0;
113}
114
115
116// ************************************************************************* //
Required Classes.
fv::options & fvOptions
surfaceScalarField & phi
const volScalarField & T
dynamicFvMesh & mesh
engineTime & runTime
Required Variables.
fvScalarMatrix TEqn(fvm::ddt(T)+fvm::div(phi, T) - fvm::laplacian(alphaEff, T)==radiation->ST(rhoCpRef, T)+fvOptions(T))
fvMatrix< scalar > fvScalarMatrix
Definition: fvMatricesFwd.H:45
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
constexpr char nl
The newline '\n' character (0x0a)
Definition: Ostream.H:53
const dictionary & simple