Loading...
Searching...
No Matches
ddt2.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2020 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::functionObjects::ddt2
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the magnitude or magnitude squared of the Eulerian time derivative
34 of an input volume field for time-variant simulations
35 (not appropriate to steady-state simulations).
36
37 The result can be further used for determining e.g. variance or RMS values.
38
39 Operands:
40 \table
41 Operand | Type | Location
42 input | vol<Type>Field | <time>/inputFields
43 output file | - | -
44 output field | vol<Type>Field | <time>/outputField
45 \endtable
46
47 where \c Type can be one of:
48 \c Scalar, \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
49
50Usage
51 Minimal example by using \c system/controlDict.functions:
52 \verbatim
53 ddt2FO
54 {
55 // Mandatory entries
56 type ddt2;
57 libs (fieldFunctionObjects);
58
59 // Optional entries
60 result d@@dt2;
61 mag <bool>;
62
63 // Inherited entries
64 fields <wordList>; // (<field1> <field2> ... <fieldN>);
65 ...
66 }
67 \endverbatim
68
69 where the entries mean:
70 \table
71 Property | Description | Type | Reqd | Deflt
72 type | Type name: ddt2 | word | yes | -
73 libs | Library name: fieldFunctionObjects | word | yes | -
74 fields | Names of the operand fields | wordList | yes | -
75 mag | Compute 'mag' instead of 'magSqr' | bool | no | false
76 result | Name of results | word | no | magSqr(ddt2(@@))
77 \endtable
78
79 The inherited entries are elaborated in:
80 - \link functionObject.H \endlink
81
82 A list of fields can contain exact names or regular expressions.
83 The token '\@\@' in the result name is replaced by the name of the source
84 field. In the special case of a single source field (specified as
85 a non-regex), the '\@\@' token checking is suppressed.
86
87 The function object will skip over fields that appear to have
88 already been processed (ie, their names are similar to the output names).
89
90SourceFiles
91 ddt2.C
92 ddt2Templates.C
93
94\*---------------------------------------------------------------------------*/
95
96#ifndef Foam_functionObjects_ddt2_H
97#define Foam_functionObjects_ddt2_H
98
100#include "volFieldsFwd.H"
101#include "OFstream.H"
102#include "regExp.H"
103#include "HashSet.H"
104#include "wordRes.H"
105
106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
108namespace Foam
109{
110namespace functionObjects
111{
112
113/*---------------------------------------------------------------------------*\
114 Class ddt2 Declaration
115\*---------------------------------------------------------------------------*/
116
117class ddt2
118:
120{
121 // Private Data
122
123 //- Name of fields to process
124 wordRes selectFields_;
125
126 //- Formatting for the result fields
127 word resultName_;
128
129 //- Avoid processing the same field twice
130 mutable regExp denyField_;
131
132 //- Hashed names of result fields
133 wordHashSet results_;
134
135 //- Flat to use 'mag' instead of 'magSqr'
136 // Cannot be adjusted during the simulation since it alters the
137 // dimensions of the output field
138 const bool mag_;
139
140
141 // Private Member Functions
142
143 //- Accept unless field name appears to have already been processed
144 bool accept(const word& fieldName) const;
145
146 //- Apply for the volume field type
147 template<class FieldType>
148 int apply(const word& inputName, int& state);
149
150 //- Process by trying to apply for various volume field types
151 int process(const word& inputName);
152
153
154public:
155
156 //- Runtime type information
157 TypeName("ddt2");
158
159
160 // Constructors
161
162 //- Construct from name, Time and dictionary
163 ddt2
165 const word& name,
166 const Time& runTime,
167 const dictionary& dict
168 );
169
170 //- No copy construct
171 ddt2(const ddt2&) = delete;
172
173 //- No copy assignment
174 void operator=(const ddt2&) = delete;
175
176
177 //- Destructor
178 virtual ~ddt2() = default;
179
180
181 // Member Functions
182
183 //- Read the function-object dictionary
184 virtual bool read(const dictionary& dict);
185
186 //- Execute the function-object operations
187 virtual bool execute();
188
189 //- Write the function-object results
190 virtual bool write();
191};
192
193
194// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195
196} // End namespace functionObjects
197} // End namespace Foam
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201#ifdef NoRepository
202 #include "ddt2Templates.C"
203#endif
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207#endif
208
209// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Computes the magnitude or magnitude squared of the Eulerian time derivative of an input volume field ...
Definition ddt2.H:167
TypeName("ddt2")
Runtime type information.
virtual ~ddt2()=default
Destructor.
ddt2(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition ddt2.C:101
ddt2(const ddt2 &)=delete
No copy construct.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition ddt2.C:120
void operator=(const ddt2 &)=delete
No copy assignment.
virtual bool execute()
Execute the function-object operations.
Definition ddt2.C:164
virtual bool write()
Write the function-object results.
Definition ddt2.C:211
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
Definition HashSet.H:80
regExpCxx regExp
Selection of preferred regular expression implementation.
Definition regExpFwd.H:37
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68
Forwards and collection of common volume field types.