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
39
40namespace Nektar
41{
42namespace 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{
51public:
52 /// Creates an instance of this class
53 static std::shared_ptr<Module> create(FieldSharedPtr f)
54 {
56 }
58
60 virtual ~ProcessWallNormalData();
61
62 /**
63 * @brief Get the normals for a given locCoord
64 * @param bndGeom Pointer to the geometry of the boundary element.
65 * @param locCoord Iteration results for local coordinates (if inside).
66 * @param normals Wall normal as the result
67 */
69 const Array<OneD, const NekDouble> &locCoord,
70 Array<OneD, NekDouble> &normals);
71
72protected:
73 /// Write mesh to output file.
74 virtual void v_Process(po::variables_map &vm) override;
75
76 virtual std::string v_GetModuleName() override
77 {
78 return "ProcessWallNormalData";
79 }
80
81 virtual std::string v_GetModuleDescription() override
82 {
83 return "Get the wall-normal data at a given origin.";
84 }
85
86private:
88
89 /**
90 * @brief Project a single point along the given direction to a plane
91 * @param gloCoord Global coordinate of the point. size=3.
92 * @param projDir Projection direction, which is also the normal vector
93 * of the target plane. size=3, norm=1.
94 * @param distToOrig The distance from the origin (0,0,0) to the target
95 * plane.
96 * @param projGloCoord The global coordinate of the projecion result.
97 */
98 void ProjectPoint(const Array<OneD, const NekDouble> &gloCoord,
99 const Array<OneD, const NekDouble> &projDir,
100 const NekDouble distToOrig,
101 Array<OneD, NekDouble> &projGloCoord);
102
103 /**
104 * @brief Project a single point along the given direction to a plane
105 * @param pts Global coordinate of the vertices of the elmt.
106 * size=2/3.
107 * @param projDir Projection direction, which is also the normal vector
108 * of the target plane. size=3, norm=1.
109 * @param distToOrig The distance from the origin (0,0,0) to the target
110 * plane.
111 * @param projPts The global coordinate of the projecion result.
112 */
113 void ProjectVertices(const Array<OneD, const Array<OneD, NekDouble>> &pts,
114 const Array<OneD, const NekDouble> &projDir,
115 const NekDouble distToOrig,
117
118 /**
119 * @brief Determine if the projected point is inside the projected element.
120 * @param projGloCoord The global coordinate of the projected single point.
121 * @param projPts The global coordinate of the projected
122 * vertices,size=2/3
123 * @param projDir Projection direction, which is used as the reference
124 * direction. size=3, norm=1.
125 * @param paralTol Tolerence to check if two vectors are parallel.
126 * @param angleTol Tolerence to check if the total angle is 2*pi.
127 * @return Inside (true) or not (false)
128 */
130 const Array<OneD, const NekDouble> &projGloCoord,
131 const Array<OneD, const Array<OneD, NekDouble>> &projPts,
132 const NekDouble paralTol = 1.0e-12);
133
135 const Array<OneD, const NekDouble> &projGloCoord,
136 const Array<OneD, const Array<OneD, NekDouble>> &projPts,
137 const Array<OneD, const NekDouble> &projDir,
138 const NekDouble paralTol = 1.0e-12, const NekDouble angleTol = 1.0e-6);
139
140 /**
141 * @brief Use iteration to get the locCoord. This routine should be used
142 * after we have checked the projected point is inside the projected
143 * element.
144 * @param bndGeom Geometry to get the xmap.
145 * @param gloCoord Global coordinate of the point. size=3.
146 * @param pts Global coordinate of the vertices of the elmt.
147 * size=2/3.
148 * @param dieUse The main direction(s) used to compute local
149 * coordinate
150 * @param locCoord Iteration results for local coordinate(s)
151 * @param dist Returned distance in physical space if the collapsed
152 * locCoord is out of range [-1,1].
153 * @param iterTol Tolerence for iteration.
154 * @param iterMax Maximum iteration steps
155 * @return Converged (true) or not (false)
156 */
159 const Array<OneD, const NekDouble> &gloCoord,
160 const Array<OneD, const Array<OneD, NekDouble>> &pts,
161 const Array<OneD, const int> &dirUse, Array<OneD, NekDouble> &locCoord,
162 const NekDouble iterTol = 1.0e-8, const int iterMax = 51);
163
166 const Array<OneD, const NekDouble> &gloCoord,
167 const Array<OneD, const Array<OneD, NekDouble>> &pts,
168 const Array<OneD, const int> &dirUse, Array<OneD, NekDouble> &locCoord,
169 NekDouble &dist, const NekDouble iterTol = 1.0e-8,
170 const int iterMax = 51);
171
172 /**
173 * @brief Check if a point can be projected onto an oundary element in a
174 * given direction. If yes, give the local coordinates of the projected
175 * point. we have checked the projected point is inside the projected
176 * element.
177 * @param bndGeom Pointer to the geometry of the boundary element.
178 * @param gloCoord Global coordinate of the point. size=3.
179 * @param projDir Projection direction, which is used as the reference
180 * direction in the 3D routine. size=3, norm=1.
181 * @param locCoord Iteration results for local coordinates (if inside).
182 * @param projDist Projection distance betweem the point to the wall
183 * point.
184 * @param maxDist Disntance to check if the wall point is desired.
185 * @param iterTol Tolerence for iteration.
186 * @return Inside (true) or not (false)
187 */
189 const Array<OneD, const NekDouble> &gloCoord,
190 const Array<OneD, const NekDouble> &projDir,
191 Array<OneD, NekDouble> &locCoord,
192 NekDouble &projDist,
193 const NekDouble maxDist = 1.0,
194 const NekDouble iterTol = 1.0e-8);
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 std::string v_GetModuleDescription() override
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,...
virtual std::string v_GetModuleName() override
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)
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...
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.
virtual void v_Process(po::variables_map &vm) override
Write mesh to output file.
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:991
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:317
std::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:54
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble