FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 orthoginality 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 <OpenFOAM/pointField.H>
46 #include <OpenFOAM/labelList.H>
47 #include <OpenFOAM/vector.H>
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 // Forward class declarations
55 class polyMesh;
56 
57 /*---------------------------------------------------------------------------*\
58  Class twoDPointCorrector Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 {
63  // Private data
64 
65  //- Reference to moving mesh
66  const polyMesh& mesh_;
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 
78  // Private Member Functions
79 
80  //- Disallow default bitwise copy construct
82 
83  //- Disallow default bitwise assignment
84  void operator=(const twoDPointCorrector&);
85 
86 
87  //- Calculate addressing
88  void calcAddressing() const;
89 
90  //- Clear addressing
91  void clearAddressing() const;
92 
93 
94  // Static data members
95 
96  //- Edge orthogonality tolerance
97  static const scalar edgeOrthogonalityTol;
98 
99 
100 public:
101 
102  // Constructors
103 
104  //- Construct from components
106 
107 
108  // Destructor
109 
111 
112 
113  // Member Functions
114 
115  //- Is 2D correction required, i.e. is the mesh a wedge or slab
116  bool required() const
117  {
118  return required_;
119  }
120 
121  //- Return plane normal
122  const vector& planeNormal() const;
123 
124  //- Return indices of normal edges.
125  const labelList& normalEdgeIndices() const;
126 
127  //- Return direction normal to plane
128  direction normalDir() const;
129 
130  //- Correct motion points
131  void correctPoints(pointField& p) const;
132 
133  //- Update topology
134  void updateMesh();
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************ vim: set sw=4 sts=4 et: ************************ //