# Second Order Derivative

Hi,

Does anybody know the convention for the output we get when we use the second-order derivative on the gradient of a velocity? I got a total of 27 outputs, but I am unsure what the order is.

Thanks for posting!

I have to admit that it would benefit to have a little context.

Depending on your mesh, your initial data, your numerical gradient calculation, etc. the answer can be quite different. For example: if you have data described on your points on an unstructured grid, ParaView automatically linearly interpolates inside cells. A gradient should therefore be a cell data field being constant inside cells leaving a second derivative null.

By default ParaView does things differently and provides gradient data on points which should lead to non-null second order derivative tensor field.

Are you looking for the order (i.e. row or column first) of the tensor you get after performing a gradient on a vector field?

Best regards,

Julien

Hi,

So I am doing a CFD simulation postprocessing of an OpenFOAM case in paraview.

I want to use the calculated velocity field to further calculate the second order derivative of velocity.

For example , using the gradient function for velocity in paraview we get 9 components . du/dx,du/dy,du/dz, etc.

But I want to find the derivatives d2u/dx2 and d2w/dz2. For this when I use the gradient function again on the output I got for velocity gradient, now I obtain a result with 27 components. But the problem is it is not mentioned which is which. Like, whether the component , say, 2 is d2u/dx2 or d2w/dx.dy.

I wanted to know what this convention is.
I am aware of the convention for the first order derivative, that is the 9 components. But for 27 components what is the assignment /naming?

Thanks for the context. I think I have a better sense of your question now.

The documentation in the `vtkGradientFilter` states:

``````The output gradient array has 3*number of components of the input data array.
The ordering for the output gradient tuple will be

{du/dx, du/dy, du/dz, dv/dx, dv/dy, dv/dz, dw/dx, dw/dy, dw/dz}

for an input array {u, v, w}.
``````

This leads me to believe that for the double gradient case, starting from a `{u, v, w}` case you will get something along the lines of:

``````{d(du/dx)/dx, d(du/dx)/dy, d(du/dx)/dz, d(du/dy)/dx, d(du/dy)/dy, ..., d(dw/dz)/dx, d(dw/dz)/dy, d(dw/dz)/dz}
``````

Essentially repeating the gradient operation on each component individually and storing them in order.