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