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 Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 5, 2020, 06:10
Default How to extract the coordinate of every single streamline
  #1
New Member
 
Xinyu Li
Join Date: Aug 2020
Posts: 3
Rep Power: 2
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, 07:21
Default
  #2
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 235
Rep Power: 9
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, 07:30
Default
  #3
New Member
 
Xinyu Li
Join Date: Aug 2020
Posts: 3
Rep Power: 2
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

Reply

Tags
coordinate files, streamline paraview

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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


All times are GMT -4. The time now is 06:24.