|
[Sponsors] |
Differences in Gradient Results Between OpenFOAM Built-in Post-Processing and Python |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Join Date: Aug 2023
Posts: 5
Rep Power: 3 ![]() |
Hello,
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 manually calculate these gradients using PyVista for post-processing, the results differ from those calculated by OpenFOAM. I understand that floating-point operations 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'm 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. |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Oct 2017
Posts: 124
Rep Power: 8 ![]() |
Can't you at least roughly determine the direction of the gradient just by looking at the mass fraction fields? And depending on the type of your mesh, you could also simply calculate the gradient yourself and compare it with the values from OpenFOAM and PyVista.
|
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] Using python script for automatic post processing of openFoam | vPaquet | ParaView | 12 | December 16, 2021 03:30 |
Post processing timestep data files in Python | pattim | OpenFOAM Post-Processing | 0 | September 28, 2020 19:29 |
PyFoam with Python Post Processing | godfatherBond | OpenFOAM Post-Processing | 0 | October 18, 2018 15:18 |
[General] Advice on post processing compressor blade data in paraview | Jack001 | ParaView | 0 | February 4, 2016 17:16 |
Development of my own post processing tool | Many | Visualization & Post-Processing | 0 | March 3, 2015 15:59 |