reference.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) 2018-2021 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::reference
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes a field whose values are offset to a reference
34 value obtained by from a Function1.
35
36 The field values are calculated using:
37
38 \f[
39 r_c = s(f_{c}(t) - f_p + f_{off})
40 \f]
41
42 where
43 \vartable
44 r_c | field values at cell
45 s | optional scale factor (default = 1)
46 f_{c}(t) | current field values at cell at this time
47 f_p | reference value
48 f_{off} | offset field value (default = 0)
49 \endvartable
50
51 Operands:
52 \table
53 Operand | Type | Location
54 input | {vol,surface}<Type>Field <!--
55 --> | $FOAM_CASE/<time>/<inpField>
56 output file | - | -
57 output field | {vol,surface}<Type>Field <!--
58 --> | $FOAM_CASE/<time>/<outField>
59 \endtable
60
61 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
62
63Usage
64 Minimal example by using \c system/controlDict.functions:
65 \verbatim
66 reference1
67 {
68 // Mandatory entries (unmodifiable)
69 type reference;
70 libs (fieldFunctionObjects);
71
72 // Mandatory (inherited) entry (runtime modifiable)
73 field <field>;
74
75 // Reference value
76 refValue <Function1>;
77
78 // Optional entries (runtime modifiable)
79 scale 1.0;
80 offset 0.0;
81
82 // Optional (inherited) entries
83 ...
84 }
85 \endverbatim
86
87 Where the entries comprise:
88 \table
89 Property | Description | Type | Req'd | Dflt
90 type | Type name: reference | word | yes | -
91 field | Name of the operand field | word | yes | -
92 refValue | Function1 reference value | Function1 | yes | -
93 offset | Offset value | type-value | no | zero
94 scale | Scale factor | scalar | no | 1
95 \endtable
96
97 The inherited entries are elaborated in:
98 - \link functionObject.H \endlink
99 - \link fieldExpression.H \endlink
100
101 Usage by the \c postProcess utility is not available.
102
103See also
104 - Foam::functionObject
105 - Foam::functionObjects::fvMeshFunctionObject
106 - Foam::functionObjects::fieldExpression
107 - Foam::Function1
108 - ExtendedCodeGuide::functionObjects::field::reference
109
110SourceFiles
111 reference.C
112 referenceTemplates.C
113
114\*---------------------------------------------------------------------------*/
115
116#ifndef functionObjects_reference_H
117#define functionObjects_reference_H
118
119#include "fieldExpression.H"
120#include "point.H"
121
122// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123
124namespace Foam
125{
126namespace functionObjects
127{
128
129/*---------------------------------------------------------------------------*\
130 Class reference Declaration
131\*---------------------------------------------------------------------------*/
132
133class reference
134:
135 public fieldExpression
136{
137 // Private Data
138
139 //- Local copy of dictionary used for construction
140 dictionary localDict_;
141
142 //- Scale factor
143 scalar scale_;
144
145
146 // Private Member Functions
147
148 //- Calculate the reference field and return true if successful
149 virtual bool calc();
150
151 //- Utility function to calc a given type of field
152 template<class Type>
153 bool calcType();
154
155
156public:
157
158 //- Runtime type information
159 TypeName("reference");
160
161
162 // Constructors
163
164 //- Construct from Time and dictionary
166 (
167 const word& name,
168 const Time& runTime,
169 const dictionary& dict
170 );
171
172 //- No copy construct
173 reference(const reference&) = delete;
174
175 //- No copy assignment
176 void operator=(const reference&) = delete;
177
178
179 //- Destructor
180 virtual ~reference() = default;
181
182
183 // Public Member Functions
184
185 //- Read the fieldExpression data
186 virtual bool read(const dictionary& dict);
187};
188
189
190// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191
192} // End namespace functionObjects
193} // End namespace Foam
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197#ifdef NoRepository
198 #include "referenceTemplates.C"
199#endif
200
201// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202
203#endif
204
205// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
Computes a field whose values are offset to a reference value obtained by from a Function1.
Definition: reference.H:211
reference(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: reference.C:64
virtual bool read(const dictionary &dict)
Read the fieldExpression data.
Definition: reference.C:83
void operator=(const reference &)=delete
No copy assignment.
reference(const reference &)=delete
No copy construct.
virtual ~reference()=default
Destructor.
TypeName("reference")
Runtime type information.
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73