Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
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 | <time>/inputField
53 output file | - | -
54 output field | {vol,surface}ScalarField | <time>/outputField
55 \endtable
56
57 where \c Type can be one of:
58 \c Vector, \c SphericalTensor, \c SymmTensor, or \c Tensor.
59
60Usage
61 Minimal example by using \c system/controlDict.functions:
62 \verbatim
63 componentsFO
64 {
65 // Mandatory entries
66 type components;
67 libs (fieldFunctionObjects);
68
69 // Inherited entries
70 field <word>;
71 ...
72 }
73 \endverbatim
74
75 where the entries mean:
76 \table
77 Property | Description | Type | Reqd | Deflt
78 type | Type name: components | word | yes | -
79 libs | Library name: fieldFunctionObjects | word | yes | -
80 field | Name of the operand field | word | yes | -
81 \endtable
82
83 The inherited entries are elaborated in:
84 - \link fieldExpression.H \endlink
85
86SourceFiles
87 components.C
88 componentsTemplates.C
89
90\*---------------------------------------------------------------------------*/
91
92#ifndef Foam_functionObjects_components_H
93#define Foam_functionObjects_components_H
94
95#include "fieldExpression.H"
96
97// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98
99namespace Foam
100{
101namespace functionObjects
102{
103
104/*---------------------------------------------------------------------------*\
105 Class components Declaration
106\*---------------------------------------------------------------------------*/
107
108class components
109:
110 public fieldExpression
111{
112 // Private Member Data
113
114 //- List of the component field names
115 wordList resultNames_;
116
117
118 // Private Member Functions
119
120 //- Calculate the components of the field with the specified type
121 //- and register the result
122 template<class GeoFieldType>
123 bool calcComponents(const GeoFieldType& field);
124
125 //- Calculate the components of the field with the specified
126 //- element type and register the result
127 template<class Type>
128 bool calcComponents();
129
130 //- Calculate the components of the field
131 // \return True if successful
132 virtual bool calc();
133
134
135public:
136
137 //- Runtime type information
138 TypeName("components");
139
140
141 // Constructors
142
143 //- Construct from name, Time and dictionary
145 (
146 const word& name,
147 const Time& runTime,
148 const dictionary& dict
149 );
150
151 //- No copy construct
152 components(const components&) = delete;
153
154 //- No copy assignment
155 void operator=(const components&) = delete;
156
157
158 //- Destructor
159 virtual ~components() = default;
160
161
162 // Member Functions
164 //- Write the function-object results
165 virtual bool write();
166
167 //- Clear the component fields from the objectRegistry
168 virtual bool clear();
169};
170
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174} // End namespace functionObjects
175} // End namespace Foam
176
177// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178
179#endif
180
181// ************************************************************************* //
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.
Extracts the components of elements of a field and outputs the result into new fields,...
Definition components.H:166
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:85
virtual bool write()
Write the function-object results.
Definition components.C:72
virtual ~components()=default
Destructor.
components(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition components.C:60
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.
A class for handling words, derived from Foam::string.
Definition word.H:66
rDeltaTY field()
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
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