Nektar++
ProcessWallNormalData.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: ProcessWallNormalData.h
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Get the wall-normal data at a given origin.
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef FIELDUTILS_PROCESSWALLNORMALDATA
36 #define FIELDUTILS_PROCESSWALLNORMALDATA
37 
38 #include "ProcessBoundaryExtract.h"
39 
40 namespace Nektar
41 {
42 namespace FieldUtils
43 {
44 
45 /**
46  * @brief This processing module calculates the wall shear stress and adds it
47  * as an extra-field to the output file, and writes it to a surface output file.
48  */
50 {
51 public:
52  /// Creates an instance of this class
53  static std::shared_ptr<Module> create(FieldSharedPtr f)
54  {
56  }
58 
60  virtual ~ProcessWallNormalData();
61 
62  /// Write mesh to output file.
63  virtual void Process(po::variables_map &vm);
64 
65  virtual std::string GetModuleName()
66  {
67  return "ProcessWallNormalData";
68  }
69 
70  virtual std::string GetModuleDescription()
71  {
72  return "Get the wall-normal data at a given origin.";
73  }
74 
75 protected:
76 private:
78 
79  /**
80  * @brief Project a single point along the given direction to a plane
81  * @param gloCoord Global coordinate of the point. size=3.
82  * @param projDir Projection direction, which is also the normal vector
83  * of the target plane. size=3, norm=1.
84  * @param distToOrig The distance from the origin (0,0,0) to the target
85  * plane.
86  * @param projGloCoord The global coordinate of the projecion result.
87  */
88  void ProjectPoint(const Array<OneD, const NekDouble> &gloCoord,
89  const Array<OneD, const NekDouble> &projDir,
90  const NekDouble distToOrig,
91  Array<OneD, NekDouble> &projGloCoord);
92 
93  /**
94  * @brief Project a single point along the given direction to a plane
95  * @param pts Global coordinate of the vertices of the elmt.
96  * size=2/3.
97  * @param projDir Projection direction, which is also the normal vector
98  * of the target plane. size=3, norm=1.
99  * @param distToOrig The distance from the origin (0,0,0) to the target
100  * plane.
101  * @param projPts The global coordinate of the projecion result.
102  */
103  void ProjectVertices(const Array<OneD, const Array<OneD, NekDouble>> &pts,
104  const Array<OneD, const NekDouble> &projDir,
105  const NekDouble distToOrig,
106  Array<OneD, Array<OneD, NekDouble>> &projPts);
107 
108  /**
109  * @brief Determine if the projected point is inside the projected element.
110  * @param projGloCoord The global coordinate of the projected single point.
111  * @param projPts The global coordinate of the projected
112  * vertices,size=2/3
113  * @param projDir Projection direction, which is used as the reference
114  * direction. size=3, norm=1.
115  * @param paralTol Tolerence to check if two vectors are parallel.
116  * @param angleTol Tolerence to check if the total angle is 2*pi.
117  * @return Inside (true) or not (false)
118  */
119  bool isInProjectedArea2D(
120  const Array<OneD, const NekDouble> &projGloCoord,
121  const Array<OneD, const Array<OneD, NekDouble>> &projPts,
122  const NekDouble paralTol = 1.0e-12);
123 
124  bool isInProjectedArea3D(
125  const Array<OneD, const NekDouble> &projGloCoord,
126  const Array<OneD, const Array<OneD, NekDouble>> &projPts,
127  const Array<OneD, const NekDouble> &projDir,
128  const NekDouble paralTol = 1.0e-12, const NekDouble angleTol = 1.0e-6);
129 
130  /**
131  * @brief Use iteration to get the locCoord. This routine should be used
132  * after we have checked the projected point is inside the projected
133  * element.
134  * @param bndGeom Geometry to get the xmap.
135  * @param gloCoord Global coordinate of the point. size=3.
136  * @param pts Global coordinate of the vertices of the elmt.
137  * size=2/3.
138  * @param dieUse The main direction(s) used to compute local
139  * coordinate
140  * @param locCoord Iteration results for local coordinate(s)
141  * @param dist Returned distance in physical space if the collapsed
142  * locCoord is out of range [-1,1].
143  * @param iterTol Tolerence for iteration.
144  * @param iterMax Maximum iteration steps
145  * @return Converged (true) or not (false)
146  */
149  const Array<OneD, const NekDouble> &gloCoord,
150  const Array<OneD, const Array<OneD, NekDouble>> &pts,
151  const Array<OneD, const int> &dirUse, Array<OneD, NekDouble> &locCoord,
152  const NekDouble iterTol = 1.0e-8, const int iterMax = 51);
153 
156  const Array<OneD, const NekDouble> &gloCoord,
157  const Array<OneD, const Array<OneD, NekDouble>> &pts,
158  const Array<OneD, const int> &dirUse, Array<OneD, NekDouble> &locCoord,
159  NekDouble &dist, const NekDouble iterTol = 1.0e-8,
160  const int iterMax = 51);
161 
162  /**
163  * @brief Check if a point can be projected onto an oundary element in a
164  * given direction. If yes, give the local coordinates of the projected
165  * point. we have checked the projected point is inside the projected
166  * element.
167  * @param bndGeom Pointer to the geometry of the boundary element.
168  * @param gloCoord Global coordinate of the point. size=3.
169  * @param projDir Projection direction, which is used as the reference
170  * direction in the 3D routine. size=3, norm=1.
171  * @param locCoord Iteration results for local coordinates (if inside).
172  * @param projDist Projection distance betweem the point to the wall
173  * point.
174  * @param maxDist Disntance to check if the wall point is desired.
175  * @param iterTol Tolerence for iteration.
176  * @return Inside (true) or not (false)
177  */
179  const Array<OneD, const NekDouble> &gloCoord,
180  const Array<OneD, const NekDouble> &projDir,
181  Array<OneD, NekDouble> &locCoord,
182  NekDouble &projDist,
183  const NekDouble maxDist = 1.0,
184  const NekDouble iterTol = 1.0e-8);
185 
186  /**
187  * @brief Get the normals for a given locCoord
188  * @param bndGeom Pointer to the geometry of the boundary element.
189  * @param locCoord Iteration results for local coordinates (if inside).
190  * @param normals Wall normal as the result
191  */
193  const Array<OneD, const NekDouble> &locCoord,
194  Array<OneD, NekDouble> &normals);
195 };
196 } // namespace FieldUtils
197 } // namespace Nektar
198 
199 #endif
This processing module sets up for the boundary field to be extracted.
This processing module calculates the wall shear stress and adds it as an extra-field to the output f...
void ProjectPoint(const Array< OneD, const NekDouble > &gloCoord, const Array< OneD, const NekDouble > &projDir, const NekDouble distToOrig, Array< OneD, NekDouble > &projGloCoord)
Project a single point along the given direction to a plane.
virtual void Process(po::variables_map &vm)
Write mesh to output file.
bool BndElmtContainsPoint(SpatialDomains::GeometrySharedPtr bndGeom, const Array< OneD, const NekDouble > &gloCoord, const Array< OneD, const NekDouble > &projDir, Array< OneD, NekDouble > &locCoord, NekDouble &projDist, const NekDouble maxDist=1.0, const NekDouble iterTol=1.0e-8)
Check if a point can be projected onto an oundary element in a given direction. If yes,...
bool NewtonIterForLocCoordOnBndElmt(SpatialDomains::GeometrySharedPtr bndGeom, const Array< OneD, const NekDouble > &gloCoord, const Array< OneD, const Array< OneD, NekDouble >> &pts, const Array< OneD, const int > &dirUse, Array< OneD, NekDouble > &locCoord, NekDouble &dist, const NekDouble iterTol=1.0e-8, const int iterMax=51)
void ProjectVertices(const Array< OneD, const Array< OneD, NekDouble >> &pts, const Array< OneD, const NekDouble > &projDir, const NekDouble distToOrig, Array< OneD, Array< OneD, NekDouble >> &projPts)
Project a single point along the given direction to a plane.
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
void GetNormals(SpatialDomains::GeometrySharedPtr bndGeom, const Array< OneD, const NekDouble > &locCoord, Array< OneD, NekDouble > &normals)
Get the normals for a given locCoord.
bool BisectionForLocCoordOnBndElmt(SpatialDomains::GeometrySharedPtr bndGeom, const Array< OneD, const NekDouble > &gloCoord, const Array< OneD, const Array< OneD, NekDouble >> &pts, const Array< OneD, const int > &dirUse, Array< OneD, NekDouble > &locCoord, const NekDouble iterTol=1.0e-8, const int iterMax=51)
Use iteration to get the locCoord. This routine should be used after we have checked the projected po...
bool isInProjectedArea3D(const Array< OneD, const NekDouble > &projGloCoord, const Array< OneD, const Array< OneD, NekDouble >> &projPts, const Array< OneD, const NekDouble > &projDir, const NekDouble paralTol=1.0e-12, const NekDouble angleTol=1.0e-6)
bool isInProjectedArea2D(const Array< OneD, const NekDouble > &projGloCoord, const Array< OneD, const Array< OneD, NekDouble >> &projPts, const NekDouble paralTol=1.0e-12)
Determine if the projected point is inside the projected element.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:989
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:285
std::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble