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