twoDPointCorrector.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) 2011-2019 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::twoDPointCorrector
26 
27 Description
28  Class applies a two-dimensional correction to mesh motion point field.
29 
30  The correction guarantees that the mesh does not get twisted during motion
31  and thus introduce a third dimension into a 2-D problem.
32 
33  The operation is performed by looping through all edges approximately
34  normal to the plane and enforcing their orthogonality onto the plane by
35  adjusting points on their ends.
36 
37 SourceFiles
38  twoDPointCorrector.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef twoDPointCorrector_H
43 #define twoDPointCorrector_H
44 
45 #include "MeshObject.H"
46 #include "pointField.H"
47 #include "labelList.H"
48 #include "vector.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward class declarations
56 class polyMesh;
57 
58 /*---------------------------------------------------------------------------*\
59  Class twoDPointCorrector Declaration
60 \*---------------------------------------------------------------------------*/
61 
63 :
64  public MeshObject<polyMesh, UpdateableMeshObject, twoDPointCorrector>
65 {
66  // Private Data
67 
68  //- Is 2D correction required, i.e. is the mesh
69  bool required_;
70 
71  //- 2-D plane unit normal
72  mutable vector* planeNormalPtr_;
73 
74  //- Indices of edges normal to plane
75  mutable labelList* normalEdgeIndicesPtr_;
76 
77  //- Flag to indicate a wedge geometry
78  mutable bool isWedge_;
79 
80  //- Wedge axis (if wedge geometry)
81  mutable vector wedgeAxis_;
82 
83  //- Wedge angle (if wedge geometry)
84  mutable scalar wedgeAngle_;
85 
86 
87  // Private Member Functions
88 
89  //- Calculate addressing
90  void calcAddressing() const;
91 
92  //- Clear addressing
93  void clearAddressing() const;
94 
95  //- Snap a point to the wedge patch(es)
96  void snapToWedge(const vector& n, const point& A, point& p) const;
97 
98 
99  // Static Data Members
100 
101  //- Edge orthogonality tolerance
102  static const scalar edgeOrthogonalityTol;
103 
104 
105 public:
106 
107  // Declare name of the class and its debug switch
108  ClassName("twoDPointCorrector");
109 
110 
111  // Constructors
112 
113  //- Construct from components
115 
116  //- Disallow default bitwise copy construction
117  twoDPointCorrector(const twoDPointCorrector&) = delete;
118 
119 
120  //- Destructor
122 
123 
124  // Member Functions
125 
126  //- Is 2D correction required, i.e. is the mesh a wedge or slab
127  bool required() const
128  {
129  return required_;
130  }
131 
132  //- Return plane normal
133  const vector& planeNormal() const;
134 
135  //- Return indices of normal edges.
136  const labelList& normalEdgeIndices() const;
137 
138  //- Return direction normal to plane
139  direction normalDir() const;
140 
141  //- Correct motion points
142  void correctPoints(pointField& p) const;
143 
144  //- Correct motion displacements
145  void correctDisplacement(const pointField& p, vectorField& disp) const;
146 
147  //- Update topology
148  void updateMesh(const mapPolyMesh&);
149 
150  //- Correct weighting factors for moving mesh.
151  bool movePoints();
152 
153 
154  // Member Operators
155 
156  //- Disallow default bitwise assignment
157  void operator=(const twoDPointCorrector&) = delete;
158 };
159 
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 } // End namespace Foam
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
void updateMesh(const mapPolyMesh &)
Update topology.
uint8_t direction
Definition: direction.H:45
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
twoDPointCorrector(const polyMesh &mesh)
Construct from components.
void correctPoints(pointField &p) const
Correct motion points.
void operator=(const twoDPointCorrector &)=delete
Disallow default bitwise assignment.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:86
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 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:74
volScalarField & p
Namespace for OpenFOAM.