mylaplacianFoam.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 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  laplacianFoam
26 
27 Description
28  Solves a simple Laplace equation, e.g. for thermal diffusion in a solid.
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #include "fvCFD.H"
33 #include "simpleMatrix.H"
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 int main(int argc, char *argv[])
37 {
38  #include "setRootCase.H"
39 
40  #include "createTime.H"
41  #include "createMesh.H"
42  #include "createFields.H"
43 
44  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46  Info<< "\nCalculating temperature distribution\n" << endl;
47 
48  while (runTime.loop())
49  {
50 
52  TEqn.solve();
53 
54  forAll(T, cellI)
55  {
56  Info<< "X = " << mesh.C()[cellI].component(vector::X)
57  << ", T = " << T[cellI] << endl;
58  }
59 
60 #include "matrixWrite.H"
61 
62  runTime.writeAndEnd();
63  }
64 
65  Info<< "End\n" << endl;
66 
67  return 0;
68 }
69 
70 
71 // ************************************************************************* //
Foam::GeometricField::component
tmp< GeometricField< cmptType, PatchField, GeoMesh > > component(const direction) const
Return a component of the field.
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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::Info
messageStream Info
main
int main(int argc, char *argv[])
Definition: mylaplacianFoam.C:33
matrixWrite.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
TEqn
fvScalarMatrix TEqn(fvm::div(phi, T) - fvm::laplacian(alphaEff, T)==radiation->ST(rhoCpRef, T)+fvOptions(T))
setRootCase.H
T
const volScalarField & T
Definition: createFields.H:25
Foam::fvMesh::C
const volVectorField & C() const
Return cell centres as volVectorField.
Definition: fvMeshGeometry.C:369
createFields.H
createMesh.H
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
createTime.H
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
fvCFD.H
simpleMatrix.H