The open source CFD toolbox
components.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) 2016 OpenFOAM Foundation
9 Copyright (C) 2019-2022 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
28 Foam::functionObjects::components
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Extracts the components of elements of a field and outputs the result
35 into new fields, where the fields possess the same sizes and dimensions.
36
37 Depending on the base type of the input field, the number of output fields
38 and output suffixes are as follows (the base type cannot be scalar since
39 scalars have no components):
40
41 \table
42 Base type | Number of components | Suffixes
43 vector | 3 | (x y z)
44 sphericalTensor | 3 | (x y z)
45 symmTensor | 6 | (xx xy xz yy yz zz)
46 tensor | 9 | (xx xy xz yx yy yz zx zy zz)
47 \endtable
48
49 Operands:
50 \table
51 Operand | Type | Location
52 input | {vol,surface}<Type>Field (Type != Scalar) <!--
53 --> | $FOAM_CASE/<time>/<inpField> 54 output file | - | - 55 output field | {vol,surface}ScalarField for each component <!-- 56 --> |$FOAM_CASE/<time>/<outField><suffix>
57 \endtable
58
59 where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
60
61Usage
62 Minimal example by using \c system/controlDict.functions:
63 \verbatim
64 components1
65 {
66 // Mandatory entries (unmodifiable)
67 type components;
68 libs (fieldFunctionObjects);
69
70 // Mandatory (inherited) entry (runtime modifiable)
71 field <field>;
72
73 // Optional (inherited) entries
74 ...
75 }
76 \endverbatim
77
78 where the entries mean:
79 \table
80 Property | Description | Type | Req'd | Dflt
81 type | Type name: components | word | yes | -
82 libs | Library name: fieldFunctionObjects | word | yes | -
83 field | Name of the operand field | word | yes | -
84 \endtable
85
86 The inherited entries are elaborated in:
89
90 Minimal example by using the \c postProcess utility:
91 \verbatim
92 postProcess -func "components(<field>)"
93 \endverbatim
94
96 - Foam::functionObject
97 - Foam::functionObjects::fvMeshFunctionObject
98 - ExtendedCodeGuide::functionObjects::field::components
99
100SourceFiles
101 components.C
102 componentsTemplates.C
103
104\*---------------------------------------------------------------------------*/
105
106#ifndef Foam_functionObjects_components_H
107#define Foam_functionObjects_components_H
108
109#include "fieldExpression.H"
110
111// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112
113namespace Foam
114{
115namespace functionObjects
116{
117
118/*---------------------------------------------------------------------------*\
119 Class components Declaration
120\*---------------------------------------------------------------------------*/
121
122class components
123:
124 public fieldExpression
125{
126 // Private Member Data
127
128 //- List of the component field names
129 wordList resultNames_;
130
131
132 // Private Member Functions
133
134 //- Calculate the components of the field with the specified type
135 //- and register the result
136 template<class GeoFieldType>
137 bool calcComponents(const GeoFieldType& field);
138
139 //- Calculate the components of the field with the specified
140 //- element type and register the result
141 template<class Type>
142 bool calcComponents();
143
144 //- Calculate the components of the field
145 // \return True if successful
146 virtual bool calc();
147
148
149public:
150
151 //- Runtime type information
152 TypeName("components");
153
154
155 // Constructors
156
157 //- Construct from Time and dictionary
159 (
160 const word& name,
161 const Time& runTime,
162 const dictionary& dict
163 );
164
165 //- No copy construct
166 components(const components&) = delete;
167
168 //- No copy assignment
169 void operator=(const components&) = delete;
170
171
172 //- Destructor
173 virtual ~components() = default;
174
175
176 // Member Functions
177
178 //- Write the component fields
179 virtual bool write();
180
181 //- Clear the component fields from the objectRegistry
182 virtual bool clear();
183};
184
186// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187
188} // End namespace functionObjects
189} // End namespace Foam
190
191// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193#endif
194
195// ************************************************************************* //
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.
Extracts the components of elements of a field and outputs the result into new fields,...
Definition: components.H:188
void operator=(const components &)=delete
No copy assignment.
components(const components &)=delete
No copy construct.
TypeName("components")
Runtime type information.
virtual bool clear()
Clear the component fields from the objectRegistry.
Definition: components.C:92
virtual bool write()
Write the component fields.
Definition: components.C:79
virtual ~components()=default
Destructor.
components(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: components.C:67
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
A class for handling words, derived from Foam::string.
Definition: word.H:68
rDeltaTY field()
engineTime & runTime
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:63
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73