Loading...
Searching...
No Matches
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 | <time>/inputField
51 output file | - | -
52 output field | volScalarField | <time>/outputField
53 \endtable
54
55Usage
56 Minimal example by using \c system/controlDict.functions:
57 \verbatim
58 powFO
59 {
60 // Mandatory entries
61 type pow;
62 libs (fieldFunctionObjects);
63 field <word>;
64 n <scalar>;
65
66 // Optional entries
67 checkDimensions <bool>;
68 scale <scalar>;
69 offset <scalar>;
70
71 // Inherited entries
72 ...
73 }
74 \endverbatim
75
76 where the entries mean:
77 \table
78 Property | Description | Type | Reqd | Deflt
79 type | Type name: pow | word | yes | -
80 libs | Library name: fieldFunctionObjects | word | yes | -
81 field | Name of the operand field | word | yes | -
82 n | Exponent | scalar | yes | -
83 checkDimensions | Flag to check dimensions of the operand field <!--
84 --> | bool | no | true
85 scale | Scaling factor - \c s above | scalar | no | 1.0
86 offset | Offset factor - \c t above | scalar | no | 0.0
87 \endtable
88
89 The inherited entries are elaborated in:
90 - \link fieldExpression.H \endlink
91
92SourceFiles
93 pow.C
94
95\*---------------------------------------------------------------------------*/
96
97#ifndef Foam_functionObjects_pow_H
98#define Foam_functionObjects_pow_H
99
100#include "fieldExpression.H"
101
102// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
103
104namespace Foam
105{
106namespace functionObjects
107{
108
109/*---------------------------------------------------------------------------*\
110 Class pow Declaration
111\*---------------------------------------------------------------------------*/
112
113class pow
114:
115 public fieldExpression
116{
117 // Private Data
118
119 //- Flag to check dimensions of the operand
120 Switch checkDimensions_;
121
122 //- Exponent
123 scalar n_;
124
125 //- Scaling factor
126 scalar scale_;
127
128 //- Offset factor
129 scalar offset_;
130
131
132 // Private Member Functions
133
134 //- Calculate the pow field and return true if successful
135 virtual bool calc();
136
137
138public:
139
140 //- Runtime type information
141 TypeName("pow");
142
143
144 // Constructors
145
146 //- Construct from name, Time and dictionary
147 pow
148 (
149 const word& name,
150 const Time& runTime,
151 const dictionary& dict
152 );
153
154 //- No copy construct
155 pow(const pow&) = delete;
156
157 //- No copy assignment
158 void operator=(const pow&) = delete;
159
160
161 //- Destructor
162 virtual ~pow() = default;
163
164
165 // Member Functions
166
167 //- Read the function-object dictionary
168 virtual bool read(const dictionary& dict);
169};
170
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174} // End namespace functionObjects
175} // End namespace Foam
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179#endif
180
181// ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition Switch.H:81
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 the power of an input volScalarField.
Definition pow.H:197
virtual ~pow()=default
Destructor.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition pow.C:93
pow(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition pow.C:75
void operator=(const pow &)=delete
No copy assignment.
TypeName("pow")
Runtime type information.
pow(const pow &)=delete
No copy construct.
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