truncatedCone.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::truncatedCone
26 
27 Description
28  A zoneGenerator which selects points, cells or faces with centres either
29  inside or outside a truncatedCone.
30 
31  By default all the points, cells or faces of the mesh are tested for being
32  inside or outside the truncatedCone but an optional single zone or list of
33  zones may be provided and those points, cells or faces are tested instead.
34  This provides an efficient method of hierarchical sub-division of space
35  where an initial selection of points cells or faces is refined by selecting
36  the sub-set inside or outside the given truncatedCone rather than having to
37  generate another zone to intersect with.
38 
39 Usage
40  \table
41  Property | Description | Required | Default value
42  type | Type: truncatedCone | 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  moveUpdate | Switch to update after mesh motion | no | false
47  point1 | First point on cone axis | yes |
48  radius1 | Radius of the cone at point1 | yes |
49  point2 | Second point on cone axis | yes |
50  radius2 | Radius of the cone at point2 | yes |
51  zone | Optional zone to sub-set | no |
52  zones | Optional list of zones to sub-set | no |
53  \endtable
54 
55  A cellZone named \c cone1 containing the cells with centres inside
56  a cone can be generated by
57  \verbatim
58  cone1
59  {
60  type truncatedCone;
61  zoneType cell;
62 
63  point1 (-0.0075 0 -1);
64  point2 (-0.003 0.0025 1);
65  radius1 0.001;
66  radius2 0.001;
67  }
68  \endverbatim
69 
70 See also
71  zoneGenerators::volume
72 
73 SourceFiles
74  truncatedCone.C
75 
76 \*---------------------------------------------------------------------------*/
77 
78 #ifndef truncatedCone_zoneGenerator_H
79 #define truncatedCone_zoneGenerator_H
80 
81 #include "volume.H"
82 
83 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
84 
85 namespace Foam
86 {
87 namespace zoneGenerators
88 {
89 
90 /*---------------------------------------------------------------------------*\
91  Class truncatedCone Declaration
92 \*---------------------------------------------------------------------------*/
93 
94 class truncatedCone
95 :
96  public volume
97 {
98  // Private Data
99 
100  //- First point on cone axis
101  vector point1_;
102 
103  //- Second point on cone axis
104  vector point2_;
105 
106  //- Radius 1
107  scalar radius1_;
108 
109  //- Radius 2
110  scalar radius2_;
111 
112  //- Axis vector calculated from point1_ and point2_
113  vector axis_;
114 
115  //- Magnitude of the axis vector squared calculated from axis_
116  scalar magAxis2_;
117 
118 
119  // Private Member Functions
120 
121  friend class volume;
122 
123  //- Return true if the truncatedConees contain the given point
124  inline bool contains(const point& p) const;
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("truncatedCone");
131 
132 
133  // Constructors
134 
135  //- Construct from dictionary
137  (
138  const word& name,
139  const polyMesh& mesh,
140  const dictionary& dict
141  );
142 
143 
144  //- Destructor
145  virtual ~truncatedCone();
146 
147 
148  // Member Functions
149 
150  virtual zoneSet generate() const;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace zoneGenerators
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
const word & name() const
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: truncatedCone.C:91
truncatedCone(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: truncatedCone.C:67
TypeName("truncatedCone")
Runtime type information.
virtual ~truncatedCone()
Destructor.
Definition: truncatedCone.C:85
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