visit-dav / visit

VisIt - Visualization and Data Analysis for Mesh-based Scientific Data
https://visit.llnl.gov
BSD 3-Clause "New" or "Revised" License
420 stars 109 forks source link

Gradient expressions not well behaved. #5566

Open brugger1 opened 3 years ago

brugger1 commented 3 years ago

I was trying to use the q_criterion to find vortices from a data set. This involves taking gradients of the velocity field components. Specifically:

q_criterion(gradient(v[0]), gradient(v[1]), gradient(v[2]))

When I plotted this, the data was in the approximate range -1e15 to 1e15, which makes no sense to me. Most of the reasonable data was in the range 0 - 10, with the extreme values being outliers. I suspect it has to do with edge conditions.

Here is the velocity field, starting with vectors of the velocity and then the individual velocity components. You can see it is very well behaved.

u

u0

u1

Here are the vector fields of the gradients. I went to a constant sized vector, because when I had scaling on it was blank because the range is 0 -> 1.527e17 and 0 ->2.415e17.

grad_u0

grad_u1

Here I resampled the data and used the ij_gradient. This is much better, but there are still some outliers on the boundaries. The light grey represents where the mesh is.

resampled_grad_u0

resampled_grad_u1

Regarding the resampled data, we can set a value where nothing is covered. It seems like it would also be nice to allow them to be marked as ghost nodes/zones. The ij_gradient could then look at the ghost data and be more intelligent about it. It might also be nice to have the max operator be smart about vectors so that the high gradients from the boundaries or areas where it is really high be eliminated.

This is with VisIt 3.1.4 on Linux. The data is a VTK file with a single domain that is a triangulated unstructured hex mesh (Actually, the mesh looks like block structured AMR, so the triangles are a bit strange where there are changes in refinement level).

cyrush commented 3 years ago

If they are triangles, default gradient in this case would probably be sample based, which can be bad.

ij_gradient is logical, but doesn't take into consideration mesh distortion, even resampled it could be off (b/c it doesn't do the dx, dy division). Can you try agrad?

brugger1 commented 3 years ago

agrad gave the same result at ij_gradient.