v5.9 crash after calling vtk module

Hello,

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()

Please help :frowning:

@bujack

Hello,

I am happy to look into the problem. Can you share the data with me in which you wanted to use it?

Best,
Roxana

1 Like

Hello Roxana,

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.

Regards,
Atcha-uea

I spotted some mistakes because I forgot to erase some lines of code but it didn’t contribute to the issue.

Here is the latest one.

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)

#Create line1
line1 = vtk.vtkLine()
line1.GetPointIds().SetId(0,0)
line1.GetPointIds().SetId(1,1)
 
#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()

I got the data, thank you :slight_smile:
How do I load it though? I mean, which file/folder do I drag into paraview?

You just have to open “foam.foam” file.

All right, that works :slight_smile: Thank you!!
I will keep you updated!

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.

Regards,

No, sorry, not yet.

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.

Thank you :smiley:

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. :frowning:

Haha! I see :slight_smile:

I am not aware of any.
But I am trying to get a grant to implement it. I work on vector field topology and need the surfaces for that.

Alright. Thank you.

I’ll keep the fingers crossed. :smile:

OK. I found the problem :slight_smile:
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.

1 Like

import vtk

input = self.GetInput()
block = input.GetBlock(0)
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)

#Create line1
line1 = vtk.vtkLine()
line1.GetPointIds().SetId(0,0)
line1.GetPointIds().SetId(1,1)

#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(block)
StreamSurface.SetSourceData(polydata)
StreamSurface.SetUseIterativeSeeding(1)
#StreamSurface.SetInterpolatorTypeToDataSetPointLocator()
StreamSurface.SetIntegrationDirectionToForward()
StreamSurface.SetIntegratorTypeToRungeKutta4()
StreamSurface.SetMaximumPropagation(200)
StreamSurface.SetInitialIntegrationStep(1)
StreamSurface.SetMaximumNumberOfSteps(100)
StreamSurface.Update()

output.DeepCopy(StreamSurface.GetOutput())
#output.DeepCopy(polydata)

1 Like

Wow! The stream surface looks magnificent! although it took quite a while to generate.



I have passed the field array by using Resample to Dataset.
Thank you very much for your help and effort. You’re the best!

Regards,
Atcha-uea