planeToFaceZone.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 OpenFOAM Foundation
9 Copyright (C) 2020 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::planeToFaceZone
29
30Description
31 A \c topoSetSource to select faces based on the adjacent cell centres
32 spanning a given plane. The plane is defined by a point and normal vector.
33
34 Operands:
35 \table
36 Operand | Type | Location
37 output 1 | faceSet | <constant>/polyMesh/sets/<set>
38 output 2 | faceZone | <constant>/polyMesh/faceZones
39 \endtable
40
41Usage
42 Minimal example by using \c system/topoSetDict.actions:
43 \verbatim
44 {
45 // Mandatory (inherited) entries
46 name <name>;
47 type faceZoneSet;
48 action <action>;
49
50 // Mandatory entries
51 source planeToFaceZone;
52 point (<px> <py> <pz>);
53 normal (<nx> <ny> <nz>);
54
55 // Optional entries
56 option <option>;
57 }
58 \endverbatim
59
60 where the entries mean:
61 \table
62 Property | Description | Type | Reqd | Dflt
63 name | Name of faceZone | word | yes | -
64 type | Type name: faceZoneSet | word | yes | -
65 action | Action applied on faces - see below | word | yes | -
66 source | Source name: planeToFaceZone | word | yes | -
67 point | A point on the input plane | vector | yes | -
68 normal | Normal vector to the input plane | vector | yes | -
69 option | Plane selection method - see below | word | no | all
70 \endtable
71
72 Options for the \c action entry:
73 \verbatim
74 new | Create a new faceZone from selected faces of a faceZone
75 add | Add selected faces of a faceZone into this faceZone
76 subtract | Remove selected faces of a faceZone from this faceZone
77 \endverbatim
78
79 Options for the \c option entry:
80 \verbatim
81 all | Select all faces that meet the criteria
82 closest | Select faces that belong to the closest contiguous plane
83 \endverbatim
84
85Note
86 - Additionally, an include entry can be specified. When omitted or set to
87 "all", then all faces that meet the criteria are included in the set. When
88 set to "closest", just the faces that belong to the closest contiguous
89 region to the plane point are included. This latter setting is useful when
90 defining face zones through channels on which the flow rate is to be
91 computed, as it keeps the set local to a single channel.
92
93See also
94 - Foam::topoSetSource
95
96SourceFiles
97 planeToFaceZone.C
98
99\*---------------------------------------------------------------------------*/
100
101#ifndef planeToFaceZone_H
102#define planeToFaceZone_H
103
105
106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
108namespace Foam
109{
110
111/*---------------------------------------------------------------------------*\
112 Class planeToFaceZone Declaration
113\*---------------------------------------------------------------------------*/
114
115class planeToFaceZone
116:
117 public topoSetFaceZoneSource
118{
119public:
120
121 //- Enumeration defining the valid options
122 enum faceAction
123 {
124 ALL,
125 CLOSEST
126 };
127
128
129private:
130
131 // Private Data
132
133 //- Add usage string
134 static addToUsageTable usage_;
135
136 //- Plane selection methods
137 static const Enum<faceAction> faceActionNames_;
138
139 //- Point on the input plane
140 const vector point_;
141
142 //- Normal to the input plane
143 const vector normal_;
144
145 //- Input plane selection method
146 const faceAction option_;
147
148
149 // Private Member Functions
150
151 void combine(faceZoneSet& set, const bool add) const;
152
153
154public:
155
156 //- Runtime type information
157 TypeName("planeToFaceZone");
158
159
160 // Constructors
161
162 //- No default construct
163 planeToFaceZone() = delete;
164
165 //- Construct from components
167 (
168 const polyMesh& mesh,
169 const point& basePoint,
170 const vector& normal,
171 const faceAction action = faceAction::ALL
172 );
173
174 //- Construct from dictionary
176
177 //- Construct from Istream
179
180
181 //- Destructor
182 virtual ~planeToFaceZone() = default;
184
185 // Member Functions
186
187 virtual void applyToSet
188 (
189 const topoSetSource::setAction action,
190 topoSet&
191 ) const;
192};
193
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197} // End namespace Foam
198
199// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200
201#endif
202
203// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Like faceSet but -reads data from faceZone -updates faceZone when writing.
Definition: faceZoneSet.H:54
A topoSetSource to select faces based on the adjacent cell centres spanning a given plane....
TypeName("planeToFaceZone")
Runtime type information.
planeToFaceZone()=delete
No default construct.
virtual ~planeToFaceZone()=default
Destructor.
virtual void applyToSet(const topoSetSource::setAction action, topoSet &) const
Apply specified action to the topoSet.
faceAction
Enumeration defining the valid options.
@ CLOSEST
Select faces belong to the closest contiguous plane.
@ ALL
Select all faces that meet the criteria.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
The topoSetFaceZoneSource is a intermediate class for handling topoSet sources for selecting face zon...
setAction
Enumeration defining various actions.
const polyMesh & mesh() const noexcept
Reference to the mesh.
General set of labels of mesh quantity (points, cells, faces).
Definition: topoSet.H:67
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73