writeCellCentres.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2022 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 \*---------------------------------------------------------------------------*/
25 
26 #include "writeCellCentres.H"
27 #include "volFields.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace functionObjects
35 {
38 }
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 (
46  const word& name,
47  const Time& runTime,
48  const dictionary& dict
49 )
50 :
51  fvMeshFunctionObject(name, runTime, dict)
52 {
53  read(dict);
54 }
55 
56 
57 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
58 
60 {}
61 
62 
63 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
64 
66 {
67  return true;
68 }
69 
70 
72 {
74  (
75  IOobject
76  (
77  "C",
78  time_.name(),
79  mesh_,
82  false
83  ),
84  mesh_.C(),
85  calculatedFvPatchScalarField::typeName
86  );
87 
88  Log << " Writing cell-centre field " << C.name()
89  << " to " << time_.name() << endl;
90 
91  C.write();
92 
93  for (direction i=0; i<vector::nComponents; i++)
94  {
96  (
97  IOobject
98  (
99  mesh_.C().name() + vector::componentNames[i],
100  time_.name(),
101  mesh_,
104  false
105  ),
106  mesh_.C().component(i)
107  );
108 
109  Log << " Writing the "
111  << " component field of the cell-centres " << Ci.name()
112  << " to " << time_.name() << endl;
113 
114  Ci.write();
115  }
116 
117  return true;
118 }
119 
120 
121 // ************************************************************************* //
static const Foam::dimensionedScalar C("C", Foam::dimTemperature, 234.5)
Macros for easy insertion into run-time selection tables.
Graphite solid properties.
Definition: C.H:51
virtual void write(Ostream &os) const
Write the function coefficients.
Definition: C.C:63
Generic GeometricField class.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:99
const word & name() const
Return name.
Definition: IOobject.H:310
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
static const char *const componentNames[]
Definition: VectorSpace.H:117
static const direction nComponents
Number of components in this vector space.
Definition: VectorSpace.H:105
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base-class for Time/database functionObjects.
Specialisation of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
virtual bool read(const dictionary &)
Read optional controls.
Writes the cell-centres volVectorField and the three component fields as volScalarFields.
writeCellCentres(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool write()
Write the cell-centre fields.
virtual bool write(const bool write=true) const
Write using setting from DB.
A class for handling words, derived from string.
Definition: word.H:62
#define Log
Report write to Foam::Info if the local log switch is true.
defineTypeNameAndDebug(adjustTimeStepToCombustion, 0)
addToRunTimeSelectionTable(functionObject, adjustTimeStepToCombustion, dictionary)
Namespace for OpenFOAM.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
uint8_t direction
Definition: direction.H:45
dictionary dict