June 10, 2024, 21:51
|
Differences in Gradient Results Between OpenFOAM Built-in Post-Processing and Python
|
#1
|
New Member
Join Date: Aug 2023
Posts: 5
Rep Power: 3
|
Hello!
I am now working on some combustion simulations using OpenFOAM. I used `#includeFunc grad(H2);` and `#includeFunc grad(O2);` in my controlDict to obtain gradients of hydrogen and oxygen mass fractions during runtime in OpenFOAM. However, I found that when I calculate these gradients using PyVista directly from the H2 and O2 fields, the results differ from those calculated by OpenFOAM.
I understand that floating-point calculations might cause some discrepancies, and it seems that PyVista does not use central differencing at the boundaries. However, the direction of the gradient results is different at some specific points, and the numerical differences at some points are quite significant. Using ParaView's built-in gradient calculation filter yields the same gradient results as PyVista.
By the way, I am using cell_data for the calculations, not point_data, and I maintain float64 precision in the computations. Moreover, the points where the gradient directions differ do not seem to be at the boundaries.
I am uncertain which results are more reliable: those from OpenFOAM or those calculated using the VTK library (ParaView and the PyVista package both seem to rely on VTK).
Any insights or advice would be greatly appreciated! Thank you.
|
|
|