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

Read SU2 native binary restart file in python

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 6, 2021, 07:59
Unhappy Read SU2 native binary restart file in python
  #1
New Member
 
Guangnan Jia
Join Date: Oct 2021
Posts: 5
Rep Power: 5
Gj419 is on a distinguished road
Hi, Everyone.


I would like to read the data stored in the file called like restart_flow_*****.dat, which contain all the data of the each mesh point. Is there some good ways to output these data and make them be organised in python? Thanks very much.
Gj419 is offline   Reply With Quote

Old   December 6, 2021, 08:30
Default
  #2
Senior Member
 
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 630
Rep Power: 18
bigfootedrockmidget is on a distinguished road
You'll need the SU2 mesh as well to know where the data is. Why not use the paraview data instead and load that in python? with pyvista you can basically do:


Code:
mesh = pv.read("output.vtk")
cpos = mesh.plot()
bigfootedrockmidget is offline   Reply With Quote

Old   December 6, 2021, 09:15
Default
  #3
New Member
 
Guangnan Jia
Join Date: Oct 2021
Posts: 5
Rep Power: 5
Gj419 is on a distinguished road
Thanks for reply. The reason that I use python to read data is that I want to extract the times series data from an unsteady simulation, which will take a lot of time for importing every data file into tecplot or paraview and then export. I think loading the binary file directly using the loop will be more convenient, I tried using Numpy but there are some decoding errors.
Gj419 is offline   Reply With Quote

Old   December 6, 2021, 09:49
Default
  #4
Member
 
Akshay Koodly
Join Date: Aug 2017
Location: The Netherlands
Posts: 43
Rep Power: 9
akoodlyr is on a distinguished road
You can use paraview in batch mode using python scripts (https://www.paraview.org/Wiki/PvPython_and_PvBatch). If you have installed paraview, you will also have executables called pvpython and pvbatch.



The website gives you some instructions on how to generate a sample python file but you can also generate a python script example to perform any paraview operation from paraview. Open paraview, before performing any operations do "Tools->Start Trace". This will record all your operations into a python file. You can perform whatever operation you want for one file and then do "Stop Trace". This gives a python file which you can manipulate as you wish.
akoodlyr 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
[swak4Foam] Installation Problem with OF 6 version Aurel OpenFOAM Community Contributions 14 November 18, 2020 17:18
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 18:18
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 12:32
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 13:41


All times are GMT -4. The time now is 19:27.