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

MATLAB for Contour Plots of OpenFOAM Data

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2020, 12:10
Default MATLAB for Contour Plots of OpenFOAM Data
  #1
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Hi, I use the file 'surfaces' to extract 2D surfaces of the phase fraction from OpenFOAM transient results. I postprocess the data using MATLAB to plot contours of the phase fraction and make videos. I am wondering if I have to use the interpolation function 'griddata' to do so. The problem with 'griddata' is that it takes time to do the interpolation, e.g. a simulation with 100 time steps may take more than an hour to generate the video. Any suggestions?
Bodo1993 is offline   Reply With Quote

Old   October 27, 2020, 10:16
Default
  #2
Member
 
hulli graemer
Join Date: Oct 2014
Posts: 48
Rep Power: 11
hulli is on a distinguished road
Hi you can try to modify the code of the medical imaging toolbox (matlab file exchange) to read your vtk files into matlab ...
hulli is offline   Reply With Quote

Old   October 27, 2020, 10:18
Default
  #3
Member
 
hulli graemer
Join Date: Oct 2014
Posts: 48
Rep Power: 11
hulli is on a distinguished road
so you do not need to griddata actually it gives you the same as you would get from paraview ...
hulli is offline   Reply With Quote

Old   October 27, 2020, 10:39
Default
  #4
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Hi, thank you. I will try that. Just to make sure, is the exact name of the toolbox "Medical Image Processing Toolbox"?
Bodo1993 is offline   Reply With Quote

Old   October 28, 2020, 03:52
Default
  #5
Member
 
hulli graemer
Join Date: Oct 2014
Posts: 48
Rep Power: 11
hulli is on a distinguished road
Hi, yes
what I did was I produced slices slicing my model using the surfaces /sample Dict function. Then I imported the vtk file using the function read_vtkMesh of the toolkit ...
https://de.mathworks.com/matlabcentr...essing-toolbox
Notice if you run it it will complain about some missing functions which you have to download, then you should be fine... using

patch or trimesh you can visulaize the grid...
I had to do some adjistments to visulaize the field since I was not able to read the fields ... However, I can DM you my script if you want ... Best H
hulli is offline   Reply With Quote

Old   October 28, 2020, 09:57
Default
  #6
Senior Member
 
Join Date: Jul 2019
Posts: 148
Rep Power: 6
Bodo1993 is on a distinguished road
Quote:
Originally Posted by hulli View Post
Hi, yes
what I did was I produced slices slicing my model using the surfaces /sample Dict function. Then I imported the vtk file using the function read_vtkMesh of the toolkit ...
https://de.mathworks.com/matlabcentr...essing-toolbox
Notice if you run it it will complain about some missing functions which you have to download, then you should be fine... using

patch or trimesh you can visulaize the grid...
I had to do some adjistments to visulaize the field since I was not able to read the fields ... However, I can DM you my script if you want ... Best H
Hi, thanks a lot. That would be great.
Bodo1993 is offline   Reply With Quote

Old   September 11, 2021, 15:50
Thumbs up Use Python insted
  #7
New Member
 
Edgar Alejandro Martínez Ojeda
Join Date: Jul 2019
Posts: 20
Rep Power: 6
Edgar Alejandro Martínez is on a distinguished road
Here I have a file to extract 2D results of the wake of a virtual turbine:
https://github.com/EdgarAMO/fluidfoam

Video on YT:
https://www.youtube.com/watch?v=wFZeFDUQflQ
Edgar Alejandro Martínez 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
CFD by anderson, chp 10.... supersonic flow over flat plate varunjain89 Main CFD Forum 18 May 11, 2018 07:31
Tecplot visualization OpenFoam data: Unable to load the solution data ndtrong Tecplot 2 July 30, 2017 11:45
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 10:52


All times are GMT -4. The time now is 17:42.