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