overLaplacianDyMFoam.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-2015 OpenFOAM Foundation
9 Copyright (C) 2016-2017 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Application
28 overLaplacianDyMFoam
29
30Group
31 grpBasicSolvers
32
33Description
34 Laplace equation solver for a scalar quantity.
35
36 \heading Solver details
37 The solver is applicable to, e.g. for thermal diffusion in a solid. The
38 equation is given by:
39
40 \f[
41 \ddt{T} = \div \left( D_T \grad T \right)
42 \f]
43
44 Where:
45 \vartable
46 T | Scalar field which is solved for, e.g. temperature
47 D_T | Diffusion coefficient
48 \endvartable
49
50 \heading Required fields
51 \plaintable
52 T | Scalar field which is solved for, e.g. temperature
53 \endplaintable
54
55\*---------------------------------------------------------------------------*/
56
57#include "fvCFD.H"
58#include "fvOptions.H"
59#include "simpleControl.H"
60#include "dynamicFvMesh.H"
61
62// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63
64int main(int argc, char *argv[])
65{
66 argList::addNote
67 (
68 "Overset Laplace equation solver for a scalar quantity."
69 );
70
71 #include "setRootCaseLists.H"
72 #include "createTime.H"
74
75 simpleControl simple(mesh);
76
77 #include "createFields.H"
78 #include "createFvOptions.H"
79
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81
82 Info<< "\nCalculating temperature distribution\n" << endl;
83
84 while (simple.loop())
85 {
86 Info<< "Time = " << runTime.timeName() << nl << endl;
87
88 mesh.update();
89
90 while (simple.correctNonOrthogonal())
91 {
93 (
94 fvm::ddt(T) - fvm::laplacian(DT, T)
95 ==
97 );
98
99 fvOptions.constrain(TEqn);
100 TEqn.solve();
101 fvOptions.correct(T);
102 }
103
104 #include "write.H"
105
106 runTime.printExecutionTime(Info);
107 }
108
109 Info<< "End\n" << endl;
110
111 return 0;
112}
113
114
115// ************************************************************************* //
fv::options & fvOptions
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