pow.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) 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::pow
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the power of an input \c volScalarField.
34
35 \f[
36 f = s f_0^n + t
37 \f]
38
39 where
40 \vartable
41 f | Output volScalarField
42 f_0 | Input volScalarField
43 n | Exponent
44 s | Scaling factor
45 t | Offset factor
46 \endvartable
47
48 \table
49 Operand | Type | Location
50 input | volScalarField | $FOAM_CASE/<time>/<inpField>
51 output file | - | -
52 output field | volScalarField | $FOAM_CASE/<time>/<outField>
53 \endtable
54
55Usage
56 Minimal example by using \c system/controlDict.functions:
57 \verbatim
58 pow1
59 {
60 // Mandatory entries (unmodifiable)
61 type pow;
62 libs (fieldFunctionObjects);
63
64 // Mandatory (inherited) entry (runtime modifiable)
65 field <inpField>;
66
67 // Mandatory entry (runtime modifiable)
68 n 0.25;
69
70 // Optional entries (runtime modifiable)
71 checkDimensions false;
72 scale 1.0;
73 offset 0.0;
74
75 // Optional (inherited) entries
76 ...
77 }
78 \endverbatim
79
80 where the entries mean:
81 \table
82 Property | Description | Type | Req'd | Dflt
83 type | Type name: pow | word | yes | -
84 libs | Library name: fieldFunctionObjects | word | yes | -
85 field | Name of the operand field | word | yes | -
86 n | Exponent | scalar | yes | -
87 checkDimensions | Flag to check dimensions of the operand field <!--
88 --> | bool | no | true
89 scale | Scaling factor - \c s above | scalar | no | 1.0
90 offset | Offset factor - \c t above | scalar | no | 0.0
91 \endtable
92
93 The inherited entries are elaborated in:
94 - \link functionObject.H \endlink
95 - \link fieldExpression.H \endlink
96
97 Minimal example by using the \c postProcess utility:
98 \verbatim
99 postProcess -func "pow(<inpField>)" -scale 1.0 -offset 0.0
100 \endverbatim
101
102See also
103 - Foam::functionObject
104 - Foam::functionObjects::fieldExpression
105 - Foam::functionObjects::fvMeshFunctionObject
106 - ExtendedCodeGuide::functionObjects::field::pow
107
108SourceFiles
109 pow.C
110
111\*---------------------------------------------------------------------------*/
112
113#ifndef functionObjects_pow_H
114#define functionObjects_pow_H
115
116#include "fieldExpression.H"
117
118// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119
120namespace Foam
121{
122namespace functionObjects
123{
124
125/*---------------------------------------------------------------------------*\
126 Class pow Declaration
127\*---------------------------------------------------------------------------*/
128
129class pow
130:
131 public fieldExpression
132{
133 // Private Data
134
135 //- Flag to check dimensions of the operand
136 Switch checkDimensions_;
137
138 //- Exponent
139 scalar n_;
140
141 //- Scaling factor
142 scalar scale_;
143
144 //- Offset factor
145 scalar offset_;
146
147
148 // Private Member Functions
149
150 //- Calculate the pow field and return true if successful
151 virtual bool calc();
152
153
154public:
155
156 //- Runtime type information
157 TypeName("pow");
158
159
160 // Constructors
161
162 //- Construct from Time and dictionary
163 pow
164 (
165 const word& name,
166 const Time& runTime,
167 const dictionary& dict
168 );
169
170 //- No copy construct
171 pow(const pow&) = delete;
172
173 //- No copy assignment
174 void operator=(const pow&) = delete;
175
176
177 //- Destructor
178 virtual ~pow() = default;
179
180
181 // Member Functions
182
183 //- Read the randomise data
184 virtual bool read(const dictionary&);
185};
186
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190} // End namespace functionObjects
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#endif
196
197// ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
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 the power of an input volScalarField.
Definition: pow.H:217
virtual ~pow()=default
Destructor.
pow(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: pow.C:82
void operator=(const pow &)=delete
No copy assignment.
TypeName("pow")
Runtime type information.
pow(const pow &)=delete
No copy construct.
virtual bool read(const dictionary &)
Read the randomise data.
Definition: pow.C:100
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
Namespace for OpenFOAM.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73