CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Differences in Gradient Results Between OpenFOAM Built-in Post-Processing and Python

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 10, 2024, 21:57
Default Differences in Gradient Results Between OpenFOAM Built-in Post-Processing and Python
  #1
New Member
 
Join Date: Aug 2023
Posts: 5
Rep Power: 3
TurbuGuu is on a distinguished road
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.
TurbuGuu is offline   Reply With Quote

Old   June 11, 2024, 06:37
Default
  #2
Senior Member
 
Join Date: Oct 2017
Posts: 124
Rep Power: 8
Krapf is on a distinguished road
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.
Krapf is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
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


All times are GMT -4. The time now is 21:47.