The open source CFD toolbox
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 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Sums a given list of (at least two or more) fields and outputs the result
35 into a new field, where the fields possess the same sizes and dimensions:
36
37 \verbatim
38 fieldResult = field1 + field2 + ... + fieldN
39 \endverbatim
40
41 Operands:
42 \table
43 Operand | Type | Location
44 input | {vol,surface}<Type>Field(s) <!--
45 --> |$FOAM_CASE/<time>/<inpField>s 46 output file | - |- 47 output field | {vol,surface}<Type>Field <!-- 48 --> |$FOAM_CASE/<time>/<outField>
49 \endtable
50
51 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
52
53Usage
54 Minimal example by using \c system/controlDict.functions:
55 \verbatim
57 {
58 // Mandatory entries (unmodifiable)
60 libs (fieldFunctionObjects);
61
62 // Mandatory (inherited) entry (runtime modifiable)
63 fields (<field1> <field2> ... <fieldN>);
64
65 // Optional (inherited) entries
66 ...
67 }
68 \endverbatim
69
70 where the entries mean:
71 \table
72 Property | Description | Type | Req'd | Dflt
73 type | Type name: add | word | yes | -
74 libs | Library name: fieldFunctionObjects | word | yes | -
75 fields | Names of the operand fields | wordList | yes | -
76 \endtable
77
78 The inherited entries are elaborated in:
81
82 Minimal example by using the \c postProcess utility:
83 \verbatim
84 postProcess -func "add(<field1>, <field2>, ..., <fieldN>)"
85 \endverbatim
86
88 - Foam::functionObject
89 - Foam::functionObjects::fieldsExpression
90 - Foam::functionObjects::fvMeshFunctionObject
92
93SourceFiles
96
97\*---------------------------------------------------------------------------*/
98
101
102#include "fieldsExpression.H"
103
104// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105
106namespace Foam
107{
108namespace functionObjects
109{
110
111/*---------------------------------------------------------------------------*\
113\*---------------------------------------------------------------------------*/
114
116:
117 public fieldsExpression
118{
119 // Private Member Functions
120
121 //- Add the list of fields of the specified type
122 //- and return the result
123 template<class GeoFieldType>
124 tmp<GeoFieldType> calcFieldType() const;
125
126 //- Add the list of fields and return true if successful
127 virtual bool calc();
128
129
130public:
131
132 friend class fieldsExpression;
133
134
135 //- Runtime type information
137
138
139 // Constructors
140
141 //- Construct from Time and dictionary
143 (
144 const word& name,
145 const Time& runTime,
146 const dictionary& dict
147 );
148
149 //- No copy construct
151
152 //- No copy assignment
153 void operator=(const add&) = delete;
154
155
156 //- Destructor
159
160
161// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162
163} // End namespace functionObjects
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#ifdef NoRepository
170#endif
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
176// ************************************************************************* //
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.
Sums a given list of (at least two or more) fields and outputs the result into a new field,...
friend class fieldsExpression
Destructor.
No copy assignment.
Runtime type information.