Nektar++
ProcessBodyFittedVelocity.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: ProcessBodyFittedVelocity.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: Generate the body-fitted coordinate system and compute the
32 // body-fitted velocity components.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef FIELDUTILS_PROCESSBODYFITTEDVELOCITY
37 #define FIELDUTILS_PROCESSBODYFITTEDVELOCITY
38 
39 #include "ProcessBoundaryExtract.h"
40 
41 namespace Nektar
42 {
43 namespace FieldUtils
44 {
45 
46 /**
47  * @brief This processing module calculates the wall shear stress and adds it
48  * as an extra-field to the output file, and writes it to a surface output file.
49  */
51 {
52 public:
53  /// Creates an instance of this class
54  static std::shared_ptr<Module> create(FieldSharedPtr f)
55  {
57  }
59 
62 
63 protected:
64  /// Write mesh to output file.
65  virtual void v_Process(po::variables_map &vm) override;
66 
67  virtual std::string v_GetModuleName() override
68  {
69  return "ProcessBodyFittedVelocity";
70  }
71 
72  virtual std::string v_GetModuleDescription() override
73  {
74  return "Get velocity in the body-fitted coordinate system.";
75  }
76 
77 public:
78  /**
79  * @brief At each quadrature point inside the domian, compute the
80  * body-fitted coordinate system with respect to the input boundary id.
81  * @param targetBndId Target boundary id.
82  * @param assistVec Unit assistant vector, the cross product of inward-
83  * pointing wall normalId and wihch gives of the main
84  * tangential direction of the body-fitted system.
85  * @param bfcsDir Pointwise body-fitted coordinate system.
86  * @param isPerpendicularCondition Flag for using perpendicular check or not
87  * @param distTol Distance tolerence. Used to find the boundary
88  * elements for local coordinate iteration.
89  * @param iterTol Iteration tolerence. Used to check iteration
90  * convergence.
91  * @param dirTol Direction tolerencce. Used to check if the inner
92  * product of two unit vectors is cloes enough to 1.0.
93  * @param geoTol Geometry tolerence. Used as the relative tolerence
94  * for local coord and distance absolute tolerence.
95  */
97  const int targetBndId, const Array<OneD, NekDouble> assistVec,
98  Array<OneD, NekDouble> &distance,
100  const bool isCheckAngle, const NekDouble distTol = 1.0e-12,
101  const NekDouble iterTol = 1.0e-12, const NekDouble dirTol = 1.0e-4,
102  const NekDouble geoTol = 1.0e-12);
103 
104 protected:
105 private:
106  /**
107  * @brief Compute the local coordinate for the nearest point on the given
108  * 2D boundary element to the input point.
109  * @param inGloCoord Global coordinate for the input point.
110  * @param bndGeom Geometry of the boundary element to search from.
111  * @param pts Global coordinate of the quadrature points in the
112  * boundary element.
113  * @param locCoord Local coordinate of the result.
114  * @param gloCoord Global coordinate of the result.
115  * @param dist Distance from the input point to the boundary element.
116  * @param iterTol Iteration tolerence.
117  * @param iterMax Max iteration steps.
118  */
120  const Array<OneD, Array<OneD, NekDouble>> &pts, const int pId,
121  const Array<OneD, Array<OneD, NekDouble>> &bndPts);
122 
123  /**
124  * @brief Compute the local coordinate for the nearest point on the given
125  * 2D boundary element to the input point.
126  * @param inGloCoord Global coordinate for the input point.
127  * @param bndGeom Geometry of the boundary element to search from.
128  * @param pts Global coordinate of the quadrature points in the
129  * boundary element.
130  * @param locCoord Local coordinate of the result.
131  * @param gloCoord Global coordinate of the result.
132  * @param dist Distance from the input point to the boundary element.
133  * @param iterTol Iteration tolerence.
134  * @param iterMax Max iteration steps.
135  */
137  const Array<OneD, const NekDouble> &inGloCoord,
139  const Array<OneD, Array<OneD, NekDouble>> &pts,
140  Array<OneD, NekDouble> &locCoord, Array<OneD, NekDouble> &gloCoord,
141  NekDouble &dist, const NekDouble iterTol = 1.0e-12,
142  const int iterMax = 51);
143 
144  /**
145  * @brief Compute the local coordinate for the nearest point on the given
146  * boundary element to the input point. The locCoord is the position
147  * to set up the body-fitted coordinate. This function works as a driver.
148  * @param inGloCoord Global coordinate for the input point.
149  * @param bndGeom Geometry of the boundary element to search from.
150  * @param locCoord Local coordinate of the result.
151  * @param gloCoord Global coordinate of the result.
152  * @param dist Distance from the input point to the boundary element.
153  * @param iterTol Iteration tolerence.
154  * @param iterMax Max iteration steps.
155  */
157  const Array<OneD, const NekDouble> &inGloCoord,
159  Array<OneD, NekDouble> &locCoord, Array<OneD, NekDouble> &gloCoord,
160  NekDouble &dist, const NekDouble iterTol = 1.0e-12,
161  const int iterMax = 51);
162 
163  /**
164  * @brief Compute the normalized cross product for two 2D vectors.
165  * vec3 = vec1 x vec2
166  */
168  const Array<OneD, NekDouble> &vec2,
169  Array<OneD, NekDouble> &vec3);
170 
171  /**
172  * @brief Get velocity and convert to Cartesian system, if it is still in
173  * transformed system. It is copied and modified from from
174  * ProcessGrad.cpp
175  */
177 };
178 } // namespace FieldUtils
179 } // namespace Nektar
180 
181 #endif
This processing module calculates the wall shear stress and adds it as an extra-field to the output f...
void GetVelAndConvertToCartSys(Array< OneD, Array< OneD, NekDouble >> &vel)
Get velocity and convert to Cartesian system, if it is still in transformed system....
virtual void v_Process(po::variables_map &vm) override
Write mesh to output file.
void ScaledCrosssProduct(const Array< OneD, NekDouble > &vec1, const Array< OneD, NekDouble > &vec2, Array< OneD, NekDouble > &vec3)
Compute the normalized cross product for two 2D vectors. vec3 = vec1 x vec2.
NekDouble PntToBndElmtPntDistance(const Array< OneD, Array< OneD, NekDouble >> &pts, const int pId, const Array< OneD, Array< OneD, NekDouble >> &bndPts)
Compute the local coordinate for the nearest point on the given 2D boundary element to the input poin...
bool LocCoordForNearestPntOnBndElmt_2D(const Array< OneD, const NekDouble > &inGloCoord, SpatialDomains::GeometrySharedPtr bndGeom, const Array< OneD, Array< OneD, NekDouble >> &pts, Array< OneD, NekDouble > &locCoord, Array< OneD, NekDouble > &gloCoord, NekDouble &dist, const NekDouble iterTol=1.0e-12, const int iterMax=51)
Compute the local coordinate for the nearest point on the given 2D boundary element to the input poin...
void GenPntwiseBodyFittedCoordSys(const int targetBndId, const Array< OneD, NekDouble > assistVec, Array< OneD, NekDouble > &distance, Array< OneD, Array< OneD, Array< OneD, NekDouble >>> &bfcsDir, const bool isCheckAngle, const NekDouble distTol=1.0e-12, const NekDouble iterTol=1.0e-12, const NekDouble dirTol=1.0e-4, const NekDouble geoTol=1.0e-12)
At each quadrature point inside the domian, compute the body-fitted coordinate system with respect to...
bool LocCoordForNearestPntOnBndElmt(const Array< OneD, const NekDouble > &inGloCoord, SpatialDomains::GeometrySharedPtr bndGeom, Array< OneD, NekDouble > &locCoord, Array< OneD, NekDouble > &gloCoord, NekDouble &dist, const NekDouble iterTol=1.0e-12, const int iterMax=51)
Compute the local coordinate for the nearest point on the given boundary element to the input point....
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
This processing module sets up for the boundary field to be extracted.
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:53
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble