Q.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-2014 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 Class
25  Foam::Q
26 
27 Group
28  grpUtilitiesFunctionObjects
29 
30 Description
31  This function object calculates and outputs the second invariant of the
32  velocity gradient tensor [1/s^2].
33 
34  \f[
35  Q = 0.5(sqr(tr(\nabla U)) - tr(((\nabla U) \cdot (\nabla U))))
36  \f]
37 
38  where
39  \vartable
40  U | velocity [m/s]
41  \endvartable
42 
43  Example of function object specification to calculate Q:
44  \verbatim
45  Q1
46  {
47  type Q;
48  functionObjectLibs ("libutilityFunctionObjects.so");
49  ...
50  }
51  \endverbatim
52 
53  \heading Function object usage
54  \table
55  Property | Description | Required | Default value
56  type | type name: Q | yes |
57  UName | Name of velocity field | no | U
58  resultName | Name of Q field | no | <function name>
59  log | Log to standard output | no | yes
60  \endtable
61 
62 SourceFiles
63  Q.C
64  IOQ.H
65 
66 \*---------------------------------------------------------------------------*/
67 
68 #ifndef Q_H
69 #define Q_H
70 
71 #include "volFieldsFwd.H"
72 #include "surfaceFieldsFwd.H"
73 #include "OFstream.H"
74 #include "Switch.H"
75 
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78 namespace Foam
79 {
80 
81 // Forward declaration of classes
82 class objectRegistry;
83 class dictionary;
84 class polyMesh;
85 class mapPolyMesh;
86 
87 /*---------------------------------------------------------------------------*\
88  Class Q Declaration
89 \*---------------------------------------------------------------------------*/
90 
91 class Q
92 {
93  // Private data
94 
95  //- Name of this set of Q objects
96  word name_;
97 
98  //- Reference to the database
99  const objectRegistry& obr_;
100 
101  //- On/off switch
102  bool active_;
103 
104  //- Name of velocity field, default is "U"
105  word UName_;
106 
107  //- Result name
108  word resultName_;
109 
110  //- Switch to send output to Info as well as to file
111  Switch log_;
112 
113 
114  // Private Member Functions
115 
116  //- Disallow default bitwise copy construct
117  Q(const Q&);
118 
119  //- Disallow default bitwise assignment
120  void operator=(const Q&);
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("Q");
127 
128 
129  // Constructors
130 
131  //- Construct for given objectRegistry and dictionary.
132  // Allow the possibility to load fields from files
134  (
135  const word& name,
137  const dictionary&,
138  const bool loadFromFiles = false
139  );
140 
141 
142  //- Destructor
143  virtual ~Q();
144 
145 
146  // Member Functions
147 
148  //- Return name of the set of Q
149  virtual const word& name() const
150  {
151  return name_;
152  }
153 
154  //- Read the Q 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 Q 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 // ************************************************************************* //
volFieldsFwd.H
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::Q::name_
word name_
Name of this set of Q objects.
Definition: Q.H:124
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::Q::Q
Q(const Q &)
Disallow default bitwise copy construct.
Foam::Q::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: Q.C:148
Foam::Q::write
virtual void write()
Calculate the Q and write.
Definition: Q.C:154
Foam::Q::operator=
void operator=(const Q &)
Disallow default bitwise assignment.
Foam::Q::obr_
const objectRegistry & obr_
Reference to the database.
Definition: Q.H:127
Foam::Q::UName_
word UName_
Name of velocity field, default is "U".
Definition: Q.H:133
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::Q::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: Q.C:142
Foam::Q::name
virtual const word & name() const
Return name of the set of Q.
Definition: Q.H:177
OFstream.H
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Foam::Q
This function object calculates and outputs the second invariant of the velocity gradient tensor [1/s...
Definition: Q.H:119
Foam::Q::log_
Switch log_
Switch to send output to Info as well as to file.
Definition: Q.H:139
Foam::Q::execute
virtual void execute()
Execute, currently does nothing.
Definition: Q.C:120
Switch.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::Q::read
virtual void read(const dictionary &)
Read the Q data.
Definition: Q.C:101
Foam::Q::TypeName
TypeName("Q")
Runtime type information.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::Q::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: Q.H:198
surfaceFieldsFwd.H
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::Q::~Q
virtual ~Q()
Destructor.
Definition: Q.C:95
Foam::Q::resultName_
word resultName_
Result name.
Definition: Q.H:136
Foam::Q::active_
bool active_
On/off switch.
Definition: Q.H:130
Foam::Q::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: Q.H:202