CourantNo.H
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) 2013-2015 OpenFOAM Foundation
6  \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
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 Class
25  Foam::CourantNo
26 
27 Group
28  grpUtilitiesFunctionObjects
29 
30 Description
31  This function object calculates and outputs the Courant number as a
32  volScalarField. The field is stored on the mesh database so that it can
33  be retrieved and used for other applications.
34 
35  Example of function object specification to calculate the Courant number:
36  \verbatim
37  CourantNo1
38  {
39  type CourantNo;
40  functionObjectLibs ("libutilityFunctionObjects.so");
41  ...
42  }
43  \endverbatim
44 
45  \heading Function object usage
46  \table
47  Property | Description | Required | Default value
48  type | Type name: CourantNo | yes |
49  rhoName | Name of density field | no | rho
50  phiName | Name of flux field | no | phi
51  resultName | Name of Courant number field | no | <function name>
52  log | Log to standard output | no | yes
53  \endtable
54 
55 
56 SourceFiles
57  CourantNo.C
58  IOCourantNo.H
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef CourantNo_H
63 #define CourantNo_H
64 
65 #include "volFields.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 
72 // Forward declaration of classes
73 class objectRegistry;
74 class dictionary;
75 class polyMesh;
76 class mapPolyMesh;
77 
78 /*---------------------------------------------------------------------------*\
79  Class CourantNo Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class CourantNo
83 {
84  // Private data
85 
86  //- Name of this set of CourantNo objects
87  word name_;
88 
89  //- Reference to the database
90  const objectRegistry& obr_;
91 
92  //- On/off switch
93  bool active_;
94 
95  //- Name of flux field, default is "phi"
96  word phiName_;
97 
98  //- Name of density field (optional)
99  word rhoName_;
100 
101  //- Result name
102  word resultName_;
103 
104  //- Switch to send output to Info as well as to file
105  Switch log_;
106 
107 
108  // Private Member Functions
109 
110  //- Divide Co by rho if required
112  (
114  ) const;
115 
116  //- Disallow default bitwise copy construct
117  CourantNo(const CourantNo&);
118 
119  //- Disallow default bitwise assignment
120  void operator=(const CourantNo&);
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("CourantNo");
127 
128 
129  // Constructors
130 
131  //- Construct for given objectRegistry and dictionary.
132  // Allow the possibility to load fields from files
133  CourantNo
134  (
135  const word& name,
136  const objectRegistry&,
137  const dictionary&,
138  const bool loadFromFiles = false
139  );
140 
141 
142  //- Destructor
143  virtual ~CourantNo();
144 
145 
146  // Member Functions
147 
148  //- Return name of the set of CourantNo
149  virtual const word& name() const
150  {
151  return name_;
152  }
153 
154  //- Read the CourantNo data
155  virtual void read(const dictionary&);
156 
157  //- Execute, currently does nothing
158  virtual void execute();
159 
160  //- Execute at the final time-loop, currently does nothing
161  virtual void end();
162 
163  //- Called when time was set at the end of the Time::operator++
164  virtual void timeSet();
165 
166  //- Calculate the CourantNo and write
167  virtual void write();
168 
169  //- Update for changes of mesh
170  virtual void updateMesh(const mapPolyMesh&)
171  {}
172 
173  //- Update for changes of mesh
174  virtual void movePoints(const polyMesh&)
175  {}
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
volFields.H
Foam::CourantNo::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: CourantNo.C:160
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::CourantNo::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: CourantNo.H:203
Foam::CourantNo::write
virtual void write()
Calculate the CourantNo and write.
Definition: CourantNo.C:170
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::CourantNo::byRho
tmp< volScalarField::DimensionedInternalField > byRho(const tmp< volScalarField::DimensionedInternalField > &Co) const
Divide Co by rho if required.
Definition: CourantNo.C:42
Foam::CourantNo::rhoName_
word rhoName_
Name of density field (optional)
Definition: CourantNo.H:128
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::CourantNo::resultName_
word resultName_
Result name.
Definition: CourantNo.H:131
Foam::CourantNo
This function object calculates and outputs the Courant number as a volScalarField....
Definition: CourantNo.H:111
Foam::CourantNo::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: CourantNo.H:199
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::CourantNo::name
virtual const word & name() const
Return name of the set of CourantNo.
Definition: CourantNo.H:178
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::CourantNo::TypeName
TypeName("CourantNo")
Runtime type information.
Foam::CourantNo::active_
bool active_
On/off switch.
Definition: CourantNo.H:122
Foam::CourantNo::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: CourantNo.C:166
Foam::CourantNo::phiName_
word phiName_
Name of flux field, default is "phi".
Definition: CourantNo.H:125
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::CourantNo::execute
virtual void execute()
Execute, currently does nothing.
Definition: CourantNo.C:134
Foam::CourantNo::obr_
const objectRegistry & obr_
Reference to the database.
Definition: CourantNo.H:119
Foam::CourantNo::read
virtual void read(const dictionary &)
Read the CourantNo data.
Definition: CourantNo.C:121
Foam::CourantNo::CourantNo
CourantNo(const CourantNo &)
Disallow default bitwise copy construct.
Foam::CourantNo::~CourantNo
virtual ~CourantNo()
Destructor.
Definition: CourantNo.C:115
Foam::CourantNo::name_
word name_
Name of this set of CourantNo objects.
Definition: CourantNo.H:116
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::CourantNo::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: CourantNo.H:134
Foam::CourantNo::operator=
void operator=(const CourantNo &)
Disallow default bitwise assignment.