twoDPointCorrector.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) 2011-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::twoDPointCorrector
28 
29 Description
30  Class applies a two-dimensional correction to mesh motion point field.
31 
32  The correction guarantees that the mesh does not get twisted during motion
33  and thus introduce a third dimension into a 2-D problem.
34 
35  The operation is performed by looping through all edges approximately
36  normal to the plane and enforcing their orthogonality onto the plane by
37  adjusting points on their ends.
38 
39 SourceFiles
40  twoDPointCorrector.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef twoDPointCorrector_H
45 #define twoDPointCorrector_H
46 
47 #include "MeshObject.H"
48 #include "pointField.H"
49 #include "labelList.H"
50 #include "vector.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward Declarations
58 class polyMesh;
59 
60 /*---------------------------------------------------------------------------*\
61  Class twoDPointCorrector Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 :
66  public MeshObject<polyMesh, UpdateableMeshObject, twoDPointCorrector>
67 {
68  // Private Typedefs
69 
70  typedef MeshObject
71  <
72  polyMesh,
76 
77 
78  // Private Data
79 
80  //- Is 2D correction required, i.e. is the mesh
81  bool required_;
82 
83  //- 2-D plane unit normal
84  mutable vector* planeNormalPtr_;
85 
86  //- Indices of edges normal to plane
87  mutable labelList* normalEdgeIndicesPtr_;
88 
89  //- Flag to indicate a wedge geometry
90  mutable bool isWedge_;
91 
92  //- Wedge axis (if wedge geometry)
93  mutable vector wedgeAxis_;
94 
95  //- Wedge angle (if wedge geometry)
96  mutable scalar wedgeAngle_;
97 
98 
99  // Private Member Functions
100 
101  //- No copy construct
102  twoDPointCorrector(const twoDPointCorrector&) = delete;
103 
104  //- No copy assignment
105  void operator=(const twoDPointCorrector&) = delete;
106 
107 
108  //- Calculate addressing
109  void calcAddressing() const;
110 
111  //- Clear addressing
112  void clearAddressing() const;
113 
114  //- Snap a point to the wedge patch(es)
115  void snapToWedge(const vector& n, const point& A, point& p) const;
116 
117 
118  // Static data members
119 
120  //- Edge orthogonality tolerance
121  static const scalar edgeOrthogonalityTol;
122 
123 
124 public:
125 
126  // Declare name of the class and its debug switch
127  ClassName("twoDPointCorrector");
128 
129 
130  // Constructors
131 
132  //- Construct from components
134 
135 
136  //- Destructor
138 
139 
140  // Member Functions
141 
142  //- Is 2D correction required, i.e. is the mesh a wedge or slab
143  bool required() const
144  {
145  return required_;
146  }
147 
148  //- Return plane normal
149  const vector& planeNormal() const;
150 
151  //- Return indices of normal edges.
152  const labelList& normalEdgeIndices() const;
153 
154  //- Return direction normal to plane
155  direction normalDir() const;
156 
157  //- Correct motion points
158  void correctPoints(pointField& p) const;
159 
160  //- Correct motion displacements
161  void correctDisplacement(const pointField& p, vectorField& disp) const;
162 
163  //- Update topology
164  void updateMesh(const mapPolyMesh&);
165 
166  //- Correct weighting factors for moving mesh.
167  bool movePoints();
168 };
169 
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 } // End namespace Foam
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
void updateMesh(const mapPolyMesh &)
Update topology.
uint8_t direction
Definition: direction.H:46
const labelList & normalEdgeIndices() const
Return indices of normal edges.
ClassName("twoDPointCorrector")
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
void correctPoints(pointField &p) const
Correct motion points.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:152
void correctDisplacement(const pointField &p, vectorField &disp) const
Correct motion displacements.
bool required() const
Is 2D correction required, i.e. is the mesh a wedge or slab.
Class applies a two-dimensional correction to mesh motion point field.
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const vector & planeNormal() const
Return plane normal.
bool movePoints()
Correct weighting factors for moving mesh.
direction normalDir() const
Return direction normal to plane.
label n
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
volScalarField & p
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Namespace for OpenFOAM.
UpdateableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:352