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 
77 private:
79 
80  /**
81  * @brief Project a single point along the given direction to a plane
82  * @param gloCoord Global coordinate of the point. size=3.
83  * @param projDir Projection direction, which is also the normal vector
84  * of the target plane. size=3, norm=1.
85  * @param distToOrig The distance from the origin (0,0,0) to the target plane.
86  * @param projGloCoord The global coordinate of the projecion result.
87  */
88  void ProjectPoint(
89  const Array<OneD, const NekDouble > & gloCoord,
90  const Array<OneD, const NekDouble > & projDir,
91  const NekDouble distToOrig,
92  Array<OneD, NekDouble > & projGloCoord);
93 
94  /**
95  * @brief Project a single point along the given direction to a plane
96  * @param pts Global coordinate of the vertices of the elmt. size=2/3.
97  * @param projDir Projection direction, which is also the normal vector of
98  * the target plane. size=3, norm=1.
99  * @param distToOrig The distance from the origin (0,0,0) to the target plane.
100  * @param projPts The global coordinate of the projecion result.
101  */
102  void ProjectVertices(
103  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 vertices,size=2/3
112  * @param projDir Projection direction, which is used as the reference
113  * direction. size=3, norm=1.
114  * @param paralTol Tolerence to check if two vectors are parallel.
115  * @param angleTol Tolerence to check if the total angle is 2*pi.
116  * @return Inside (true) or not (false)
117  */
118  bool isInProjectedArea2D(
119  const Array<OneD, const NekDouble > & projGloCoord,
120  const Array<OneD, const Array<OneD, NekDouble> > & projPts,
121  const NekDouble paralTol = 1.0e-12);
122 
123  bool isInProjectedArea3D(
124  const Array<OneD, const NekDouble > & projGloCoord,
125  const Array<OneD, const Array<OneD, NekDouble> > & projPts,
126  const Array<OneD, const NekDouble > & projDir,
127  const NekDouble paralTol = 1.0e-12,
128  const NekDouble angleTol = 1.0e-6);
129 
130  /**
131  * @brief Use iteration to get the locCoord. This routine should be used after
132  * we have checked the projected point is inside the projected element.
133  * @param bndGeom Geometry to get the xmap.
134  * @param gloCoord Global coordinate of the point. size=3.
135  * @param pts Global coordinate of the vertices of the elmt. size=2/3.
136  * @param dieUse The main direction(s) used to compute local coordinate
137  * @param locCoord Iteration results for local coordinate(s)
138  * @param dist Returned distance in physical space if the collapsed
139  * locCoord is out of range [-1,1].
140  * @param iterTol Tolerence for iteration.
141  * @param iterMax Maximum iteration steps
142  * @return Converged (true) or not (false)
143  */
146  const Array<OneD, const NekDouble > & gloCoord,
147  const Array<OneD, const Array<OneD, NekDouble> > & pts,
148  const Array<OneD, const int > & dirUse,
149  Array<OneD, NekDouble > & locCoord,
150  const NekDouble iterTol = 1.0e-8,
151  const int iterMax = 51);
152 
155  const Array<OneD, const NekDouble> & gloCoord,
156  const Array<OneD, const Array<OneD, NekDouble> > & pts,
157  const Array<OneD, const int > & dirUse,
158  Array<OneD, NekDouble> & locCoord,
159  NekDouble & dist,
160  const NekDouble iterTol = 1.0e-8,
161  const int iterMax = 51);
162 
163  /**
164  * @brief Check if a point can be projected onto an oundary element in a given
165  * direction. If yes, give the local coordinates of the projected point.
166  * we have checked the projected point is inside the projected 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 point.
173  * @param maxDist Disntance to check if the wall point is desired.
174  * @param iterTol Tolerence for iteration.
175  * @return Inside (true) or not (false)
176  */
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  */
192  void GetNormals(
194  const Array<OneD, const NekDouble > & locCoord,
195  Array< OneD, NekDouble > & normals);
196 
197 };
198 }
199 }
200 
201 #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)
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
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.
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 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...
void GetNormals(SpatialDomains::GeometrySharedPtr bndGeom, const Array< OneD, const NekDouble > &locCoord, Array< OneD, NekDouble > &normals)
Get the normals for a given locCoord.
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< 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:290
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