Hi!<br>There are several numerical methods to calculate dx, dy, dz at a cell. I am searching for the exact numerical method implemented in vtkCellDerivatives. My dataset is rectilinear with equally spaced x,y,z. That makes the hexahedron required to compute derivatives to be cube in my case.
<br><br><span style="font-weight: bold;">What exactly is </span><span style="font-family: monospace; font-weight: bold;"></span><span style="font-weight: bold;">d(vx)/dx in vtkCell.h then?<br><br></span>Is it just the difference in value of vx across cell?
<br>Also, <br><pre>I could NOT find Derivatives function implementation in any of vtkGenericCell.cxx, vtkCell.cxx, vtkCell3D.cxx.</pre>
My aim here is to check how exactly vorticity is calculated and verify if that is what we want to use or write our own implementation, as the current visualizations give some artifacts in vorticity isosurfaces which isn't technically correct.
<br><br>Thanks a ton in advance.<br>Aditya<br><br>
<pre>Calculating vorticity<br>----------------------<br><a href="http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtk-src-unix/Graphics/vtkCellDerivatives.cxx">http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtk-src-unix/Graphics/vtkCellDerivatives.cxx
</a><br>...<br> vtkDataSet *input = this->GetInput();<br>...<br> input->GetCell(cellId, cell);<br>...<br> if ( computeVectorDerivs )<br> {<br> inVectors->GetTuples(cell->PointIds, cellVectors);
<br> vectors = cellVectors->GetPointer(0);<br>...<br> cell->Derivatives(0, pcoords, vectors, 3, derivs);<br> if ( this->VectorMode == VTK_VECTOR_MODE_COMPUTE_VORTICITY )<br> {<br><span style="font-weight: bold;">
w[0] = derivs[7] - derivs[5];</span><br style="font-weight: bold;"><span style="font-weight: bold;"> w[1] = derivs[2] - derivs[6];</span><br style="font-weight: bold;"><span style="font-weight: bold;"> w[2] = derivs[3] - derivs[1];
</span><br> outVectors->SetTuple(cellId, w);<br> }<br>....<br></pre>
<a href="http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtk-src-unix/Common/vtkGenericCell.cxx">http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtk-src-unix/Common/vtkGenericCell.cxx</a><br><pre>void vtkGenericCell::Derivatives(int subId, double pcoords[3], double *values,
<br> int dim, double *derivs)<br>{<br> this->Cell->Derivatives(subId, pcoords, values, dim, derivs);<br>}<br>....<br><a href="http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtk-src-unix/Common/vtkCell.h">
http://www.cs.utah.edu/classes/cs5630/vtk%204.4.2/vtk-src-unix/Common/vtkCell.h</a><br><br>// Description:<br> // Compute derivatives given cell subId and parametric coordinates. The<br> // values array is a series of data value(s) at the cell points. There is a
<br> // one-to-one correspondence between cell point and data value(s). Dim is<br> // the number of data values per cell point. Derivs are derivatives in the<br> // x-y-z coordinate directions for each data value. Thus, if computing
<br> // derivatives for a scalar function in a hexahedron, dim=1, 8 values are<br> // supplied, and 3 deriv values are returned (i.e., derivatives in x-y-z<br> // directions). On the other hand,<span style="font-weight: bold;">
if computing derivatives of velocity</span><br style="font-weight: bold;"><span style="font-weight: bold;"> // (vx,vy,vz) dim=3, 24 values are supplied ((vx,vy,vz)1, (vx,vy,vz)2,</span><br style="font-weight: bold;"><span style="font-weight: bold;">
// ....()8), and 9 deriv values are returned</span><br> // ((d(vx)/dx),(d(vx)/dy),(d(vx)/dz), (d(vy)/dx),(d(vy)/dy), (d(vy)/dz),<br> // (d(vz)/dx),(d(vz)/dy),(d(vz)/dz)).<br> virtual void Derivatives(int subId, double pcoords[3], double *values,
<br> int dim, double *derivs) = 0;<br>....<br><br><br></pre>