Best Practice For Plotting Streamlines Around a Cylinder

I made a simulation using OpenFOAM for flow around a cylinder. StreamLines with ‘High resolution Line Source’, gives:


While I want a uniform streamline spacing, it is clear that in the behind of the cylinder, Streamlines are clustered and so close to each other. To achieve a uniform distribution of streamlines like the following image, I went through these steps…
flowOverCylRe20OF41-5
create ‘plane source’ -> ‘resample with dataset filter’ -> ‘another plane source’ -> ‘stream tracer with custom source’ [from this link]
I ended up with this:

I really appreciate anyone commenting on this question.
flowOverCylRe20OF41-streamlineWithCustomSource.pvsm (250.0 KB)

Can you share your data? If your data is in XY plane you can try EvenlySpacedStreamlines2D.

https://blog.kitware.com/evenly-spaced-streamlines-2d/

1 Like

This is EXACTLY what I meant! But, when I apply this on my case, nothing appears but this error

Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FROM_OUTPUT_PORT: 0
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0

I’ve included my case. Thank you so much!
flowOverCyl.tar.gz (3.7 MB)

How do you read the data you sent? It does not seem to be a .foam file. Thanks.

Generating an empty text file with .foam extension, works. Open this empty file in paraview, then you have access to all of the data.
Thank you.

Here is the picture I got with the default parameters and the ParaView state file I used to get that.

flow.pvsm (376.5 KB)

2 Likes

Okay, Here are is the procedure that worked for me.

  1. If your simulation is 3D,
    a) make a slice at your required position
    b) Convert 3D velocity field to 2D velocity field using calculator (U_xiHAT+U_yjHAT)
    c) Now Plot streamlines using evenly distributed streamlines filter
    d) Select your 2D velocity field as vector field
    e) Adjust start position such that it is away from cylinder body

Hope it works for you.
Best

1 Like

Dear Dan,
I reviewed your settings. Yes, it works, but as soon as I change ,for example, “start point” to (-1 0 0 ) or “separating distance” to 0.5, paraview crashes and is suddenly closed. I have to mention that this does not happen for every change that I make, but it does often.
Could you please provide optimum parameters’ values to obtain a “neat” picture as I have included in the question?
Best,
Ali

Dear Sana,
To work around 3D field, I used a slice filter so that steps a , b are not needed anymore. As I replied to Dan, right now, my problem is obtaining a “neat and tidy” picture of streamlines. I want to know what do filter’s parameters work?( “start point” , “separating distance", etc). This way I can find optimum parameters to obtain a tidy image.
Thank you,
Ali

What version of paraview are you using? I use ParaView master, probably 5.7 RC2 would work the same.

Here is the picture with separating distance 0.5, the same ParaView state file.
Seems like in the picture you sent originally the separating distance is variable, so you won’t be able to get something that matches exactly.

1 Like

Thank you Dan. I use paraview 5.6. Probably I have to install the newer version that you’ve mentioned.
Best,
Ali

Dear Ali,

I tried your methodology, however I got the errors:

  • vtkEvenlySpacedStreamlines2D does not support planes not aligned with XY.

and

Debug: Off
Modified Time: 1703398
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1
FROM_OUTPUT_PORT: 0

I also used the methodology suggested by Sana before and got the same error.
I am using Paraview 5.7.0 on windows.

Can you please point me to what I am doing wrong?
Thanks a lot.
Joao

Hi Joao,

Did you use “Slice” Filter first?
If not, use it first. Then apply EvenlySpacedStreamlines2D on that.

Best,
Ali

Dear Ali, I did used the slice filter. I took z normal so to get a XY plane where to do the streamlines. Still go the error. I see after the calculator filter that I can choose for “showing” the 3 directions however the z direction shows values from 0 to 1.2*10^-38.

Can this be the reason, that is still a 3D vector?
Thanks a lot.

Joao

If you attach your case I hope I can help better.

Dear Ali,

I sent you a message. How can I share my case here?
Thanks a lot.

Best wishes,

Joao

When you press reply button, a box appears, above of which are some keys like Hyperlink , Emoji , Upload… . press upload and attach your file. your stat file is not enough. Make a minimum sized zip file including stat and your case.

1 Like

Dear Ali, thanks once again for your help. This is the case. I shared like this as it is a quite large one (around 400 mb)
I tried to do a 2D slice at z=0 with normal (0 0 1) and plot the 2D streamlines

Thanks a lot in advance for any help.3D data

I tested the case, however unfortunately with no success. I also left a comment here in the hope that the issue be solved.

1 Like

A fix for this issue is at:
https://gitlab.kitware.com/vtk/vtk/merge_requests/6436

It will take a few weeks for this fix to be picked up by ParaView, but it will be eventually in ParaView master.

Here is a picture I generated from that dataset.

1 Like