annulus.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::zoneGenerators::annulus
26 
27 Description
28  A zoneGenerator which selects points, cells or faces with centres either
29  inside or outside a annulus.
30 
31  By default all the points, cells or faces of the mesh are tested for being
32  inside or outside the annulus but an optional single zone or list of zones
33  may be provided and those points, cells or faces are tested instead. This
34  provides an efficient method of hierarchical sub-division of space where an
35  initial selection of points cells or faces is refined by selecting the
36  sub-set inside or outside the given annulus rather than having to generate
37  another zone to intersect with.
38 
39 Usage
40  \table
41  Property | Description | Required | Default value
42  type | Type: annulus | yes |
43  name | Name of the zone | no | zoneGenerator name
44  zoneType | Type of zone | yes |
45  select | Select either the inside or outside | no | inside
46  point1 | First point on annulus axis | yes |
47  point2 | Second point on annulus axis | yes |
48  outerRadius | Outer radius of the annulus | yes |
49  innerRadius | Inner radius of the annulus | yes |
50  zone | Optional zone to sub-set | no |
51  zones | Optional list of zones to sub-set | no |
52  \endtable
53 
54  A cellZone named \c annulus1 containing the cells with centres inside
55  a annulus is generated by
56  \verbatim
57  annulus1
58  {
59  type annulus;
60  zoneType cell;
61 
62  point1 (-0.0075 0 -1);
63  point2 (-0.003 0.0025 1);
64  outerRadius 0.002;
65  innerRadius 0.001;
66  }
67  \endverbatim
68 
69 SourceFiles
70  annulus.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef annulus_zoneGenerator_H
75 #define annulus_zoneGenerator_H
76 
77 #include "volume.H"
78 
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
80 
81 namespace Foam
82 {
83 namespace zoneGenerators
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class annulus Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class annulus
91 :
92  public volume
93 {
94  // Private Data
95 
96  //- First point on annulus axis
97  vector point1_;
98 
99  //- Second point on annulus axis
100  vector point2_;
101 
102  //- Outer Radius
103  scalar outerRadius_;
104 
105  //- Inner Radius
106  scalar innerRadius_;
107 
108  //- Axis vector calculated from point1_ and point2_
109  vector axis_;
110 
111  //- Magnitude of the axis vector squared calculated from axis_
112  scalar magAxis2_;
113 
114  //- Outer radius squared
115  scalar outerRadius2_;
116 
117  //- Inner radius squared
118  scalar innerRadius2_;
119 
120 
121  // Private Member Functions
122 
123  friend class volume;
124 
125  //- Return true if the annuluses contain the given point
126  inline bool contains(const point& p) const;
127 
128 
129 public:
130 
131  //- Runtime type information
132  TypeName("annulus");
133 
134 
135  // Constructors
136 
137  //- Construct from dictionary
138  annulus
139  (
140  const word& name,
141  const polyMesh& mesh,
142  const dictionary& dict
143  );
144 
145 
146  //- Destructor
147  virtual ~annulus();
148 
149 
150  // Member Functions
151 
152  virtual zoneSet generate() const;
153 };
154 
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 } // End namespace zoneGenerators
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #endif
164 
165 // ************************************************************************* //
const word & name() const
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: annulus.C:91
annulus(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: annulus.C:65
virtual ~annulus()
Destructor.
Definition: annulus.C:85
TypeName("annulus")
Runtime type information.
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:41
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:49
dictionary dict
volScalarField & p