hemisphere.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::hemisphere
26 
27 Description
28  A zoneGenerator which selects points, cells or faces with centres either
29  inside or outside a hemisphere.
30 
31  By default all the points, cells or faces of the mesh are tested for being
32  inside or outside the hemisphere 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 hemisphere 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: hemisphere | 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  centre | Centre of the hemisphere | yes |
48  axis | Axis of the hemisphere | yes |
49  radius | Radius of the hemisphere | 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 hemisphere1 containing the cells with centres inside
55  a cylinder can be generated by
56  \verbatim
57  hemisphere1
58  {
59  type hemisphere;
60  zoneType cell;
61 
62  centre (-0.001 0.001 0);
63  axis (0 1 0);
64  radius 0.001;
65  }
66  \endverbatim
67 
68 See also
69  zoneGenerators::volume
70 
71 SourceFiles
72  hemisphere.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef hemisphere_zoneGenerator_H
77 #define hemisphere_zoneGenerator_H
78 
79 #include "volume.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 namespace zoneGenerators
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class hemisphere Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class hemisphere
93 :
94  public volume
95 {
96  // Private Data
97 
98  //- Centre
99  vector centre_;
100 
101  //- Radius
102  scalar radius_;
103 
104  //- Axis
105  vector axis_;
106 
107  //- Radius squared
108  scalar radiusSqr_;
109 
110 
111  // Private Member Functions
112 
113  friend class volume;
114 
115  //- Return true if the hemispherees contain the given point
116  inline bool contains(const point& p) const;
117 
118 
119 public:
120 
121  //- Runtime type information
122  TypeName("hemisphere");
123 
124 
125  // Constructors
126 
127  //- Construct from dictionary
128  hemisphere
129  (
130  const word& name,
131  const polyMesh& mesh,
132  const dictionary& dict
133  );
134 
135 
136  //- Destructor
137  virtual ~hemisphere();
138 
139 
140  // Member Functions
141 
142  virtual zoneSet generate() const;
143 };
144 
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 } // End namespace zoneGenerators
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
const word & name() const
virtual zoneSet generate() const
Generate and return the zoneSet.
Definition: hemisphere.C:75
TypeName("hemisphere")
Runtime type information.
virtual ~hemisphere()
Destructor.
Definition: hemisphere.C:69
hemisphere(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: hemisphere.C:53
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