VMTK
Loading...
Searching...
No Matches
vtkvmtkMeshWallShearRate Class Reference

Calculates wall shear rate from velocity components in a mesh. More...

#include <vtkvmtkMeshWallShearRate.h>

Inheritance diagram for vtkvmtkMeshWallShearRate:
[legend]
Collaboration diagram for vtkvmtkMeshWallShearRate:
[legend]

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkMeshWallShearRate * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual void SetVelocityArrayName (const char *)
virtual char * GetVelocityArrayName ()
virtual void SetWallShearRateArrayName (const char *)
virtual char * GetWallShearRateArrayName ()
virtual void SetComputeIndividualPartialDerivatives (int)
virtual int GetComputeIndividualPartialDerivatives ()
virtual void ComputeIndividualPartialDerivativesOn ()
virtual void ComputeIndividualPartialDerivativesOff ()
virtual void SetUseFullStrainRateTensor (int)
virtual int GetUseFullStrainRateTensor ()
virtual void UseFullStrainRateTensorOn ()
virtual void UseFullStrainRateTensorOff ()
virtual void SetConvergenceTolerance (double)
virtual double GetConvergenceTolerance ()
virtual void SetQuadratureOrder (int)
virtual int GetQuadratureOrder ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkvmtkMeshWallShearRate * SafeDownCast (vtkObjectBase *o)
static vtkvmtkMeshWallShearRate * New ()

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkMeshWallShearRate ()
 ~vtkvmtkMeshWallShearRate ()
int FillInputPortInformation (int, vtkInformation *info) override
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override

Protected Attributes

char * VelocityArrayName
char * WallShearRateArrayName
int ComputeIndividualPartialDerivatives
double ConvergenceTolerance
int QuadratureOrder
int UseFullStrainRateTensor

Detailed Description

Calculates wall shear rate from velocity components in a mesh.

Extracts the wall surface of the input volumetric mesh, computes the velocity gradient tensor of the 3-component point data array named VelocityArrayName (via vtkvmtkUnstructuredGridGradientFilter, Gauss quadrature order QuadratureOrder, solved to ConvergenceTolerance), and derives the wall shear rate vector at each wall point, storing it in the point data array named WallShearRateArrayName. By default (UseFullStrainRateTensor off), the simple approximation tau = -(grad u) . n is used; when on, the full symmetric strain-rate tensor E = 0.5*(grad u + (grad u)^T) is used instead (tau = -2 * E.n projected tangent to the wall), per Matyka et al. (doi:10.1016/j.compfluid.2012.12.018).

See also
vtkvmtkUnstructuredGridGradientFilter, vtkvmtkMeshVorticity

Definition at line 40 of file vtkvmtkMeshWallShearRate.h.

Member Typedef Documentation

◆ Superclass

typedef vtkPolyDataAlgorithm vtkvmtkMeshWallShearRate::Superclass

Definition at line 43 of file vtkvmtkMeshWallShearRate.h.

Constructor & Destructor Documentation

◆ vtkvmtkMeshWallShearRate()

vtkvmtkMeshWallShearRate::vtkvmtkMeshWallShearRate ( )
protected

◆ ~vtkvmtkMeshWallShearRate()

vtkvmtkMeshWallShearRate::~vtkvmtkMeshWallShearRate ( )
protected

Definition at line 52 of file vtkvmtkMeshWallShearRate.cxx.

53{
54 if (this->VelocityArrayName)
55 {
56 delete[] this->VelocityArrayName;
57 this->VelocityArrayName = NULL;
58 }
59 if (this->WallShearRateArrayName)
60 {
61 delete[] this->WallShearRateArrayName;
62 this->WallShearRateArrayName = NULL;
63 }
64}

Member Function Documentation

◆ IsTypeOf()

int vtkvmtkMeshWallShearRate::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkMeshWallShearRate::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkMeshWallShearRate * vtkvmtkMeshWallShearRate::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkMeshWallShearRate::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkMeshWallShearRate * vtkvmtkMeshWallShearRate::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkMeshWallShearRate::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 226 of file vtkvmtkMeshWallShearRate.cxx.

227{
228 this->Superclass::PrintSelf(os,indent);
229}

◆ New()

vtkvmtkMeshWallShearRate * vtkvmtkMeshWallShearRate::New ( )
static

◆ SetVelocityArrayName()

virtual void vtkvmtkMeshWallShearRate::SetVelocityArrayName ( const char * )
virtual

Set/Get the name of the 3-component point data array holding the velocity field. Required input.

◆ GetVelocityArrayName()

virtual char * vtkvmtkMeshWallShearRate::GetVelocityArrayName ( )
virtual

Set/Get the name of the 3-component point data array holding the velocity field. Required input.

◆ SetWallShearRateArrayName()

virtual void vtkvmtkMeshWallShearRate::SetWallShearRateArrayName ( const char * )
virtual

Set/Get the name of the output 3-component point data array where the computed wall shear rate is stored. Commonly named "WallShearRate".

◆ GetWallShearRateArrayName()

virtual char * vtkvmtkMeshWallShearRate::GetWallShearRateArrayName ( )
virtual

Set/Get the name of the output 3-component point data array where the computed wall shear rate is stored. Commonly named "WallShearRate".

◆ SetComputeIndividualPartialDerivatives()

virtual void vtkvmtkMeshWallShearRate::SetComputeIndividualPartialDerivatives ( int )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ GetComputeIndividualPartialDerivatives()

virtual int vtkvmtkMeshWallShearRate::GetComputeIndividualPartialDerivatives ( )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ ComputeIndividualPartialDerivativesOn()

virtual void vtkvmtkMeshWallShearRate::ComputeIndividualPartialDerivativesOn ( )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ ComputeIndividualPartialDerivativesOff()

virtual void vtkvmtkMeshWallShearRate::ComputeIndividualPartialDerivativesOff ( )
virtual

Toggle assembling and solving each partial derivative of the velocity gradient as a separate linear system, instead of assembling the full gradient in a single system. See vtkvmtkUnstructuredGridGradientFilter::ComputeIndividualPartialDerivatives. Default: off.

◆ SetUseFullStrainRateTensor()

virtual void vtkvmtkMeshWallShearRate::SetUseFullStrainRateTensor ( int )
virtual

Toggle using the full symmetric strain-rate tensor formulation (per Matyka et al.) instead of the simple tau = -(grad u).n approximation. See the class description. Default: off.

◆ GetUseFullStrainRateTensor()

virtual int vtkvmtkMeshWallShearRate::GetUseFullStrainRateTensor ( )
virtual

Toggle using the full symmetric strain-rate tensor formulation (per Matyka et al.) instead of the simple tau = -(grad u).n approximation. See the class description. Default: off.

◆ UseFullStrainRateTensorOn()

virtual void vtkvmtkMeshWallShearRate::UseFullStrainRateTensorOn ( )
virtual

Toggle using the full symmetric strain-rate tensor formulation (per Matyka et al.) instead of the simple tau = -(grad u).n approximation. See the class description. Default: off.

◆ UseFullStrainRateTensorOff()

virtual void vtkvmtkMeshWallShearRate::UseFullStrainRateTensorOff ( )
virtual

Toggle using the full symmetric strain-rate tensor formulation (per Matyka et al.) instead of the simple tau = -(grad u).n approximation. See the class description. Default: off.

◆ SetConvergenceTolerance()

virtual void vtkvmtkMeshWallShearRate::SetConvergenceTolerance ( double )
virtual

Set/Get the convergence tolerance of the iterative linear solver used to solve the finite-element gradient projection.

◆ GetConvergenceTolerance()

virtual double vtkvmtkMeshWallShearRate::GetConvergenceTolerance ( )
virtual

Set/Get the convergence tolerance of the iterative linear solver used to solve the finite-element gradient projection.

◆ SetQuadratureOrder()

virtual void vtkvmtkMeshWallShearRate::SetQuadratureOrder ( int )
virtual

Set/Get the order of the Gauss quadrature rule used to integrate the finite-element gradient matrices.

◆ GetQuadratureOrder()

virtual int vtkvmtkMeshWallShearRate::GetQuadratureOrder ( )
virtual

Set/Get the order of the Gauss quadrature rule used to integrate the finite-element gradient matrices.

◆ FillInputPortInformation()

int vtkvmtkMeshWallShearRate::FillInputPortInformation ( int ,
vtkInformation * info )
overrideprotected

Definition at line 66 of file vtkvmtkMeshWallShearRate.cxx.

67{
68 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGrid");
69 return 1;
70}

◆ RequestData()

int vtkvmtkMeshWallShearRate::RequestData ( vtkInformation * ,
vtkInformationVector ** ,
vtkInformationVector *  )
overrideprotectedvirtual

Definition at line 72 of file vtkvmtkMeshWallShearRate.cxx.

76{
77 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
78 vtkInformation *outInfo = outputVector->GetInformationObject(0);
79
80 vtkUnstructuredGrid *input = vtkUnstructuredGrid::SafeDownCast(
81 inInfo->Get(vtkDataObject::DATA_OBJECT()));
82 vtkPolyData *output = vtkPolyData::SafeDownCast(
83 outInfo->Get(vtkDataObject::DATA_OBJECT()));
84
85 if (this->VelocityArrayName == NULL)
86 {
87 vtkErrorMacro("VelocityArrayName not specified");
88 return 1;
89 }
90
91 vtkDataArray* velocityArray = input->GetPointData()->GetArray(this->VelocityArrayName);
92
93 if (velocityArray == NULL)
94 {
95 vtkErrorMacro("VelocityArray with name specified does not exist");
96 return 1;
97 }
98
99 char gradientArrayName[] = "VelocityGradient";
100
101 vtkvmtkUnstructuredGridGradientFilter* gradientFilter = vtkvmtkUnstructuredGridGradientFilter::New();
102 gradientFilter->SetInputData(input);
103 gradientFilter->SetInputArrayName(this->VelocityArrayName);
104 gradientFilter->SetGradientArrayName(gradientArrayName);
105 gradientFilter->SetQuadratureOrder(this->QuadratureOrder);
106 gradientFilter->SetConvergenceTolerance(this->ConvergenceTolerance);
108 gradientFilter->Update();
109
110 vtkGeometryFilter* geometryFilter = vtkGeometryFilter::New();
111 geometryFilter->SetInputConnection(gradientFilter->GetOutputPort());
112 geometryFilter->Update();
113
114 // Since VTK 9.4, vtkPolyDataNormals passes pre-existing normals through
115 // unchanged instead of recomputing them; strip normals inherited from the
116 // mesh so consistently outward-oriented normals are always recomputed.
117 vtkPolyData* surfaceWithoutNormals = vtkPolyData::New();
118 surfaceWithoutNormals->ShallowCopy(geometryFilter->GetOutput());
119 surfaceWithoutNormals->GetPointData()->SetNormals(NULL);
120 surfaceWithoutNormals->GetCellData()->SetNormals(NULL);
121
122 vtkPolyDataNormals* normalsFilter = vtkPolyDataNormals::New();
123 normalsFilter->SetInputData(surfaceWithoutNormals);
124 surfaceWithoutNormals->Delete();
125 normalsFilter->AutoOrientNormalsOn();
126 normalsFilter->ConsistencyOn();
127 normalsFilter->SplittingOff();
128 normalsFilter->Update();
129
130 vtkPolyData* outputSurface = normalsFilter->GetOutput();
131
132 vtkDataArray* velocityGradientArray = outputSurface->GetPointData()->GetArray(gradientArrayName);
133 vtkDataArray* normalsArray = outputSurface->GetPointData()->GetNormals();
134
135 int numberOfPoints = outputSurface->GetNumberOfPoints();
136
137 vtkDoubleArray* wallShearRateArray = vtkDoubleArray::New();
138 if (this->WallShearRateArrayName)
139 {
140 wallShearRateArray->SetName(this->WallShearRateArrayName);
141 }
142 else
143 {
144 wallShearRateArray->SetName("WallShearRate");
145 }
146 wallShearRateArray->SetNumberOfComponents(3);
147 wallShearRateArray->SetNumberOfTuples(numberOfPoints);
148
149 double velocityGradient[9];
150 double normal[3];
151 double wallShearRate[3];
152
153 int i, j, k;
154
155 if (!this->UseFullStrainRateTensor)
156 {
157 for (i=0; i<numberOfPoints; i++)
158 {
159 velocityGradientArray->GetTuple(i,velocityGradient);
160 normalsArray->GetTuple(i,normal);
161 for (j=0; j<3; j++)
162 {
163 wallShearRate[j] = -normal[0] * velocityGradient[3*j + 0] - normal[1] * velocityGradient[3*j + 1] - normal[2] * velocityGradient[3*j + 2];
164 }
165 wallShearRateArray->SetTuple(i,wallShearRate);
166 }
167 }
168 else
169 {
170
171 /**********************************************************************
172 Calculate strain rate tensor: E = 0.5 * (\nabla u + (\nabla u)^T)
173 Calculate wall shear rate vector: tau = -2 * E*n * (1-n^T*n)
174 Reference: Matyka et al., http://dx.doi.org/10.1016/j.compfluid.2012.12.018
175 **********************************************************************/
176
177 double normalShear, shearVector[3], strainRateTensor[9];
178
179 for (i=0; i<numberOfPoints; i++)
180 {
181
182 // compute strain rate tensor
183 velocityGradientArray->GetTuple(i,velocityGradient);
184 for (j=0; j<3; j++)
185 {
186 for (k=0; k<3; k++)
187 {
188 strainRateTensor[3*j + k] = 0.5 * (velocityGradient[3*j + k] + velocityGradient[3*k + j]);
189 }
190 }
191
192 // compute shear rate vector and normal projection
193 normalsArray->GetTuple(i,normal);
194 normalShear = 0.0;
195 for (j=0; j<3; j++)
196 {
197 shearVector[j] = 0.0;
198 for (k=0; k<3; k++)
199 {
200 shearVector[j] += strainRateTensor[3*j + k] * normal[k];
201 }
202 normalShear += shearVector[j] * normal[j];
203 }
204
205 // compute wall shear rate
206 for (j=0; j<3; j++)
207 {
208 // sign due to normals pointing outwards
209 wallShearRate[j] = -2.0 * (shearVector[j] - normalShear*normal[j]);
210 }
211
212 wallShearRateArray->SetTuple(i,wallShearRate);
213 }
214 }
215
216 output->DeepCopy(outputSurface);
217 output->GetPointData()->AddArray(wallShearRateArray);
218
219 wallShearRateArray->Delete();
220 geometryFilter->Delete();
221 normalsFilter->Delete();
222
223 return 1;
224}
virtual void SetComputeIndividualPartialDerivatives(int)
virtual void SetInputArrayName(const char *)
virtual void SetGradientArrayName(const char *)
virtual void SetConvergenceTolerance(double)
static vtkvmtkUnstructuredGridGradientFilter * New()

Member Data Documentation

◆ VelocityArrayName

char* vtkvmtkMeshWallShearRate::VelocityArrayName
protected

Definition at line 113 of file vtkvmtkMeshWallShearRate.h.

◆ WallShearRateArrayName

char* vtkvmtkMeshWallShearRate::WallShearRateArrayName
protected

Definition at line 114 of file vtkvmtkMeshWallShearRate.h.

◆ ComputeIndividualPartialDerivatives

int vtkvmtkMeshWallShearRate::ComputeIndividualPartialDerivatives
protected

Definition at line 116 of file vtkvmtkMeshWallShearRate.h.

◆ ConvergenceTolerance

double vtkvmtkMeshWallShearRate::ConvergenceTolerance
protected

Definition at line 118 of file vtkvmtkMeshWallShearRate.h.

◆ QuadratureOrder

int vtkvmtkMeshWallShearRate::QuadratureOrder
protected

Definition at line 119 of file vtkvmtkMeshWallShearRate.h.

◆ UseFullStrainRateTensor

int vtkvmtkMeshWallShearRate::UseFullStrainRateTensor
protected

Definition at line 120 of file vtkvmtkMeshWallShearRate.h.


The documentation for this class was generated from the following files: