GradientOfUnstructuredDataSet accuracy

Hello,

I am trying to compute the shear stress of a wing for viscous drag calculation. I want to match the result from fluent (same cfd data of course) as a step for further calculations. I use the filter GradientOfUnstructuredDataSet for the calculation of gradients… unfortunately I obtain completely wrong output.

I want to calculate - X-shear stress (x flow direction) = surfaceIntegral (txx + txy + txz) = surfaceIntegral (μdu/dxNormals_X + μ/2*(dv/dx +du/dy)Normals_Y + μ/2(dw/dx + du/dz)*Normals_Z)
In paraview from GradientOfUnstructuredDataSet I use Gradients_0 (txx), Gradients_3, Gradients_1 (txy), Gradients_6, Gradients_2 (txz) respectively assuming "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} ".

Being confident about the formulation I can only suppose that I implement wrong the GradientOfUnstructuredDataSet filter.

As a potential solution I would like to use the feature of the GradientOfUnstructuredDataSet filter called ContributingCellOption. However as I can “see” its not available on my graphical interface.

Any suggestions how to solve this ? Or in more general how to properly use the GradientOfUnstructuredDataSet filter ?

Thanks
Dimitris

2 Likes

Could you please give a sample file or pictures so that we could try reproducing it? May I know how different the gradients are?
Also try using the “python calculator” filter and try gradient(Velocity) (if your vector name is velocity). Could you compare both the results?, the python calculator gives the option for point data and cell data, i think this is what you are looking for.

Hello @vrkssai,

Thanks for your answer !! First of all in the link
( https://drive.google.com/drive/folders/1NPKZXh0cksEQtdf1Pl0rzTeyVSpqTEjB?usp=sharing ) you can download the state in paraview and the needed files the check what I have done. Namely you have files exported from fluent (ensight case gold) . The first set of files (Cell-centered) consist of the files needed to calculate the shear stress and the second set (shearStress) contains the shear stress directly exported from fluent.

Regarding the pyhton calculator I tried it as you explained howver I obtained exactly the same results (I always use cell data since indeed I have discovered that give much better results (at least in my cases).

Thanks for your time !
Dimitris

@logo you mean this difference in values below?

Yes @vrkssai I mean this difference !!

1 Like

@logo could you do a quick check? Maybe slightly demanding though.

Could you use your calculations you adopted in Paraview directly in fluent for computing wall shear(by creating a custom variable if I remember correctly), instead of exporting the values of of wall shear directly. This will confidently get rid of any doubts on your formulation, if you get the same results with your formulation and fluent export of them.

I’ll try to look into it in the meanwhile.

I am particularly concerned with nonzero velocity on the wing. Why?

When Fluent computes the velocity gradient tensor of a wing, it knows the No-slip condition on the wing and takes this into consideration. On the other hand, since ParaView doesn’t have access to the same level of knowledge, the GradientOfUnstructuredDataSet filter will compute it on the wing just as slip boundary condition.

I anticipate the difference between results is mainly caused by these two approaches.

2 Likes

Hello @Kenichiro-Yoshimi

Your comment is to the point. Of course I have applied no-slip conditions on the wing on my cfd model. On fluent indeed the wing is illustrated with zero velocity everywhere. The only thing that I can think about it is that paraview takes a priori not the first cell for velocity visualisation ? But I cannot confirm it … if there someone who has this knowledge ?

I think I understand what is happening here. I’m assuming you are exporting cell centered data. If not my explanation is probably wrong.
Paraview as per my understanding does some sort of interpolation at the places it doesn’t have values. Consider this, the first cell from the wall(airfoil here) has a non zero velocity., the second cell as well. Now consider the edge of the first cell at the wall, interpolating from the second and first cell centres to that point gives a non-zero value.

How to verify this?- Try increasing the grid density near the wall and see if the paraview calculation becomes better(preferrebly with higher order interpolation) I bet it would.

Solution-

  1. Maybe export the ghost cells near the wall as well, the ghost cell value for no slip has the value making the value at the wall zero, this should work.
  2. Export nodal data(i.e data at the cell corners), this ensures the data at the wall is also exported as zero and not interpolated.

I tried to make velocity zero at the wing using an attached script force_vel0_wing.py.

python force_vel0.py CellCentered.case

This script outputs only fluid zone with nodal data: fluid.vtu.
And then calculate WSS with respect to the above. (see the attached state file wss.pvsm)

wss

The resulting distribution is similar to the one from Fluent. But the amount is only half the value. I may forget to double the WSS values somewhere in programmable filter.:slightly_frowning_face:
wss.zip (35.7 KB)

1 Like

Hi Kyoshimi,
I’m stuck with the same problem you had and I’m trying to run the py code you kindly shared but I’m having some issues. Do you have just to run this code through the python shell? Can you please guide me through the process?
By the way, you are finding half values because in the formula of the stress the viscous part is 2mustrainTensor. The strain tensor is what you wrote without mu :slight_smile:

Hello chiara,

Would you download a wss_with_data.zip and unzip it?

Then you can load wss.pvsm in ParaView using File > Load State… At that time, under Load State Data File Options, you would need to specify Search files under specified directory.

(In my previous post, a simulation data (fluid.vtu) exceeded the maximum upload size. So I had to extract fluid.vtu with a script force_vel0_wing.py.)

1 Like

Hi everyone,
I know this is an ancient post but I hope someone can find me a solution. I have been stuck for a very long time. I am actually doing LES and cannot figure out how to output wall shear stress during the simulation in openfoam. So I was trying to calculate the wall shear stress in Paraview using gradientOfUnstructuresDataSet and then extracting the surface and computing the surface normals and then doing the dot product of this gradient tensor with the surface normal vector and the dynamic viscosity to calculate the wall shear stress. But my gradient vectors are computed all zero on the wall. I don’t know how to include the gradient at the cell centroid and not at the face of the wall cell. Any help will be highly appreciated.