I am using Paraview v5.9 and trying to plot stream surface using vtkStreamSurface in Paraview using Python Programmable Filter. I use the motorbike tutorial case in OpenFOAM as my data, just to try if the vtk module works.
However, paraview crashed right after I inputted update() and clicked apply.
Please see my script below.
import vtk
input = self.GetInput()
output = self.GetOutput()
#Create the points fot the lines.
points = vtk.vtkPoints()
points.InsertPoint(0, 0, -0.5, 2) # id, x,y,z location
points.InsertPoint(1, 0, 0.5, 2)
points
#Create line1
line1 = vtk.vtkLine()
line1.GetPointIds().SetId(0,0)
line1.GetPointIds().SetId(1,1)
line1
#Create a cellArray containing the lines
lines =vtk.vtkCellArray()
lines.InsertNextCell(line1)
#Create the vtkPolyData to contain the points and cellArray with the lines
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.SetLines(lines)
StreamSurface = vtk.vtkStreamSurface()
StreamSurface.SetInputDataObject(input)
StreamSurface.SetSourceData(polydata)
StreamSurface.SetUseIterativeSeeding(1)
StreamSurface.SetInterpolatorTypeToDataSetPointLocator()
StreamSurface.SetComputeVorticity(1)
StreamSurface.SetIntegrationDirectionToBoth()
StreamSurface.SetIntegratorTypeToRungeKutta45()
StreamSurface.SetIntegrationStepUnit(2)
StreamSurface.SetMaximumPropagation(200)
StreamSurface.SetInitialIntegrationStep(0.01)
#crashed after inserting below
StreamSurface.Update()
Thank you for your immediate response.
Just to let you know, I’m using Paraview v5.9 on Windows10 using .exe file as installer and also compiled source code on WSL. Both have the same issue.
The dataset that I used can be downloaded in the below link.
BTW, can this StreamSurface filter be used with parallel processing? For instance, Paraview connects to pvserver on local machine using 30 cores.
I have a number of large OpenFOAM results and they have been decomposed into 30 partitions.
I can already offer you a quick work around. You can apply the vtkRuledSurface on the output of the vtkStreamTracer. It will produce a stream surface, too. But it does not come with iterative seeding and might look ugly.
Yes. I have already tried vtkRuledSurface but it’s not applicable for my data. Also, the surfaces generated by the vtkRuledSurface could produce unrealistic results, at least for my case.
Yes, that is what I expected.
I can see the data. It looks really cool!!! Can I ask you what you are working on?
In case, I get it fixed, can I use it as an example maybe? With proper acknowledgement of course.
This data is actually one of the most popular tutorial cases in OpenFOAM.
I use this data because I want to try out and see how the filter works. Then I will apply it to my research which is about the flow past vortex generators and flow separation behind the backward facing ramp.
I have found that not many people use stream surface to show the flow structure. Maybe it’s because it’s still not available for most CFD post-processing softwares, although the algorithm had been published for a few decades. I find this filter very helpful to understand the flow behavior.
In case you get this fixed, I will acknowledge you in my research paper. (sounds like bribing, but I’m really appreciated.)
At the meantime, maybe you could suggest to me the software that is able to plot stream surface in parallel? I have been finding for the software that people used to visualize their data and publish in papers but couldn’t find any.
OK. I found the problem
The streamSurface filter can’t handle multiblock datasets.
But your data has actually only one block of type unstructured grid . So if you unwrap it, it runs.
I found a bug on the fly and that is that the streamsurface can’t handle StreamSurface.SetIntegrationDirectionToBoth()
but only forward or backward. So if you want both, you have to run it twice. I will fix that later though.
#Create a cellArray containing the lines
lines =vtk.vtkCellArray()
lines.InsertNextCell(line1)
#Create the vtkPolyData to contain the points and cellArray with the lines
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.SetLines(lines)