Loading...
Searching...
No Matches
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 value obtained by
34 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 | <time>/inputField
55 output file | - | -
56 output field | {vol,surface}<Type>Field | <time>/outputField
57 \endtable
58
59 where \c Type can be one of:
60 \c Scalar, \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
61
62Usage
63 Minimal example by using \c system/controlDict.functions:
64 \verbatim
65 referenceFO
66 {
67 // Mandatory entries
68 type reference;
69 libs (fieldFunctionObjects);
70 field <word>;
71 refValue <Function1>;
72
73 // Optional entries
74 scale <scalar>;
75 offset <scalar>;
76
77 // Inherited entries
78 ...
79 }
80 \endverbatim
81
82 Where the entries comprise:
83 \table
84 Property | Description | Type | Reqd | Deflt
85 type | Type name: reference | word | yes | -
86 field | Name of the operand field | word | yes | -
87 refValue | Function1 reference value | Function1 | yes | -
88 offset | Offset value | type-value | no | zero
89 scale | Scale factor | scalar | no | 1
90 \endtable
91
92 The inherited entries are elaborated in:
93 - \link fieldExpression.H \endlink
94
95SourceFiles
96 reference.C
97 referenceTemplates.C
98
99\*---------------------------------------------------------------------------*/
100
101#ifndef Foam_functionObjects_reference_H
102#define Foam_functionObjects_reference_H
103
104#include "fieldExpression.H"
105#include "point.H"
106
107// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108
109namespace Foam
110{
111namespace functionObjects
112{
113
114/*---------------------------------------------------------------------------*\
115 Class reference Declaration
116\*---------------------------------------------------------------------------*/
117
118class reference
119:
120 public fieldExpression
121{
122 // Private Data
123
124 //- Local copy of dictionary used for construction
125 dictionary localDict_;
126
127 //- Scale factor
128 scalar scale_;
129
130
131 // Private Member Functions
132
133 //- Calculate the reference field and return true if successful
134 virtual bool calc();
135
136 //- Utility function to calc a given type of field
137 template<class Type>
138 bool calcType();
139
140
141public:
142
143 //- Runtime type information
144 TypeName("reference");
145
146
147 // Constructors
148
149 //- Construct from name, Time and dictionary
151 (
152 const word& name,
153 const Time& runTime,
154 const dictionary& dict
155 );
156
157 //- No copy construct
158 reference(const reference&) = delete;
159
160 //- No copy assignment
161 void operator=(const reference&) = delete;
162
163
164 //- Destructor
165 virtual ~reference() = default;
166
167
168 // Public Member Functions
169
170 //- Read the function-object dictionary
171 virtual bool read(const dictionary& dict);
172};
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace functionObjects
178} // End namespace Foam
179
180// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181
182#ifdef NoRepository
183 #include "referenceTemplates.C"
184#endif
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188#endif
189
190// ************************************************************************* //
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
const word & name() const noexcept
Return the name of this functionObject.
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
fieldExpression(const word &name, const Time &runTime, const dictionary &dict, const word &fieldName=word::null, const word &resultName=word::null)
Construct from name, Time and dictionary.
virtual bool calc()=0
Calculate the components of the field and return true if successful.
Computes a field whose values are offset to a reference value obtained by from a Function1.
Definition reference.H:188
reference(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition reference.C:57
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition reference.C:76
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:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
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