CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[OpenFOAM] How to extract the coordinate of every single streamline

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Flowkersma

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2020, 07:10
Default How to extract the coordinate of every single streamline
  #1
New Member
 
Xinyu Li
Join Date: Aug 2020
Posts: 3
Rep Power: 6
Xinyu Li is on a distinguished road
Hi everyone,

I plotted thousands of streamlines in Paraview as is shown in the following figure.
[IMG]file:///Users/lixinyu/Downloads/%E5%9B%BE%E5%83%8F2020-8-4%20%E4%B8%8B%E5%8D%8811.43.JPG[/IMG]

Now I need to know the coordinate of every points on every single streamline. If I plot spreadsheet directly, all I can get is the coordinate of all unordered points like the following figure.
[IMG]file:///Users/lixinyu/Downloads/%E5%9B%BE%E5%83%8F2020-8-4%20%E4%B8%8B%E5%8D%8811.44.JPG[/IMG]

Is it possible to extract the coordinate of all points of a streamline and then do that for every single streamline, just like the following figure which I selected manually which is impossible to operate when we have thousands of streamlines.
[IMG]file:///Users/lixinyu/Downloads/%E5%9B%BE%E5%83%8F2020-8-4%20%E4%B8%8B%E5%8D%8811.46.JPG[/IMG]

Thanks,
Xinyu
Xinyu Li is offline   Reply With Quote

Old   August 5, 2020, 08:21
Default
  #2
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 13
Flowkersma is on a distinguished road
Hi Xinyu,

I'm not sure exactly what you want to do (your figures are not working). Here is one way to deal with the streamlines in an ordered way.
  1. Apply CellDatatoPointData filter on the StreamTracer filter (interpolate the SeedIds to points)
  2. Export the pointdata as .csv file
  3. Use the .csv file. Here is an example script how to plot the data with numpy and matplotlib
    Code:
    import numpy as np
    import matplotlib.pyplot as plt
    data = np.genfromtxt('streamlines.csv', delimiter=',', names=True)
    
    streamline_ids = np.unique(data['SeedIds']).astype(int)
    
    # each loop plots one streamline.
    for i in streamline_ids:
        rows = np.where(data['SeedIds'] == i)
        plt.plot(data['Points0'][rows],data['Points1'][rows])
    plt.show()

Best, Mikko
Flowkersma is offline   Reply With Quote

Old   August 5, 2020, 08:30
Default
  #3
New Member
 
Xinyu Li
Join Date: Aug 2020
Posts: 3
Rep Power: 6
Xinyu Li is on a distinguished road
Hi Mikko,

Thanks for your reply. I'm a new member of CFD Online, so I'm not familiar with the operation. How can I insert images from my computer, so that I can upload the images to make my question clearer. When I click the button 'insert image' there is a window to ask for the URL of my image which I don't know.

Cheers,
Xinyu
Xinyu Li is offline   Reply With Quote

Old   November 30, 2020, 11:37
Default
  #4
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10
mmohaqeqf is on a distinguished road
Quote:
Originally Posted by Xinyu Li View Post
Hi Mikko,

Thanks for your reply. I'm a new member of CFD Online, so I'm not familiar with the operation. How can I insert images from my computer, so that I can upload the images to make my question clearer. When I click the button 'insert image' there is a window to ask for the URL of my image which I don't know.

Cheers,
Xinyu

Try to use "attachment" button, or use an online website which allows for image upload and then share the link to that website.


Anyway, have you tried the solution provided here and see if it works?
mmohaqeqf is offline   Reply With Quote

Old   November 30, 2020, 12:17
Default
  #5
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10
mmohaqeqf is on a distinguished road
So here is what I found; I hope it helps someone.
After you generated your streamlines, try to export them out as cvs file.
When you open the cvs file, you see a column labeled as "IntegrationTime". Whenever you see a zero (0) on this column, it is the starting point of one streamline, which ends at the next zero (0) in the column (at least, it has been true for my cases so far).
So, you need to write a script (matlab, python, etc) to be able to organize them according to you own needs.


Another way to extract data of a streamline is to use the threshold filter. However, this method is difficult when you are dealing with a lot of streamlines. Anyway, first generate your streamlines, then apply a threshold filter and choose SeedIds in the scalar dropdown list. Then, open a spreadsheet inside paraview and choose different SeedIds on the left panel (threshold properties) to see data associated with that particular streamline.


Thanks,
mmohaqeqf is offline   Reply With Quote

Reply

Tags
coordinate files, streamline paraview


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
Extract body points coordinate snappyhexmesh Astan OpenFOAM Post-Processing 2 August 15, 2019 04:02
[ANSYS Meshing] Coordinate system Import to Fluent superduke1200 ANSYS Meshing & Geometry 4 December 16, 2018 04:41
How Tensor Transforms Between Cartesian and Polar Coordinate Systems ChanStormstout OpenFOAM 0 February 26, 2018 20:53
Coordinate system help!!!! Ranjith Kumar J Main CFD Forum 1 January 6, 2017 13:14
Single v.s. double precision Confused CFX 15 November 10, 2016 05:42


All times are GMT -4. The time now is 14:08.