Assemble the vorticity right-hand side for component Direction.
50{
52 {
53 vtkErrorMacro("VelocityArrayName not specified!");
54 return;
55 }
56
58
59 if (!velocityArray)
60 {
61 vtkErrorMacro("VelocityArray with name specified does not exist!");
62 return;
63 }
64
65 if (velocityArray->GetNumberOfComponents() != 3)
66 {
67 vtkErrorMacro("VelocityArray must have 3 components!");
68 return;
69 }
70
71
72 int numberOfVariables = 1;
74
77
79
80 int dimension = 3;
81
82 int numberOfCells = this->
DataSet->GetNumberOfCells();
83 int k;
84 for (k=0; k<numberOfCells; k++)
85 {
86 vtkCell* cell = this->
DataSet->GetCell(k);
87 if (cell->GetCellDimension() != dimension)
88 {
89 continue;
90 }
91 gaussQuadrature->
Initialize(cell->GetCellType());
94 double quadraturePCoords[3];
95 int numberOfCellPoints = cell->GetNumberOfPoints();
96 int i, j;
97 int q;
98 for (q=0; q<numberOfQuadraturePoints; q++)
99 {
102 double jacobian = feShapeFunctions->
GetJacobian(q);
103 double phii, phij;
104 double dphii[3];
105 double velocityValue[3];
106
107
108 double vorticityComponent = 0.0;
109 for (i=0; i<numberOfCellPoints; i++)
110 {
111 vtkIdType iId = cell->GetPointId(i);
112 feShapeFunctions->
GetDPhi(q,i,dphii);
113 velocityArray->GetTuple(iId,velocityValue);
114
115
116
118 {
119 vorticityComponent += velocityValue[2] * dphii[1] - velocityValue[1] * dphii[2];
120 }
122 {
123 vorticityComponent += velocityValue[0] * dphii[2] - velocityValue[2] * dphii[0];
124 }
126 {
127 vorticityComponent += velocityValue[1] * dphii[0] - velocityValue[0] * dphii[1];
128 }
129 }
130 for (i=0; i<numberOfCellPoints; i++)
131 {
132 vtkIdType iId = cell->GetPointId(i);
133 phii = feShapeFunctions->
GetPhi(q,i);
134
135
136
137 double value = jacobian * quadratureWeight * vorticityComponent * phii;
138
139
140
142 for (j=0; j<numberOfCellPoints; j++)
143 {
144 vtkIdType jId = cell->GetPointId(j);
145 phij = feShapeFunctions->
GetPhi(q,j);
146 double value = jacobian * quadratureWeight * phii * phij;
147
148
149
150 this->
Matrix->AddElement(iId,jId,value);
151 }
152 }
153 }
154 }
155
156 gaussQuadrature->Delete();
157 feShapeFunctions->Delete();
158}
vtkvmtkSparseMatrix * Matrix
vtkvmtkDoubleVector * RHSVector
void Initialize(int numberOfVariables)
void Initialize(vtkCell *cell, vtkDoubleArray *pcoords)
static vtkvmtkFEShapeFunctions * New()
double GetPhi(vtkIdType id, vtkIdType i)
double * GetDPhi(vtkIdType id, vtkIdType i)
double GetJacobian(vtkIdType i)
double * GetQuadraturePoint(vtkIdType id)
virtual vtkDoubleArray * GetQuadraturePoints()
static vtkvmtkGaussQuadrature * New()
void Initialize(vtkIdType cellType)
double GetQuadratureWeight(vtkIdType id)
virtual void SetOrder(int)
int GetNumberOfQuadraturePoints()