Performing paraview operations remotely

Hi guys,

I’ve been trying to extract data for analysis from a vti file outputted from a LBM CFD code. I’ve basically been taking the solved field, rescaling the velocity, generating streamlines and extracting that streamline data to a csv file for future use.

Up to this point I’ve been doing this manually using the paraview interactive GUI. Now that I know what I want to do, I’ve been trying to automate this to run on a remote cluster because I have approx. 50 differnt runs to collect data from, I think using a python script. (i.e. I want a python script that can find data within a sub-folder, feed it to paraview, perform manipulations, save the output to a csv file or something universal).

My question is that I’ve been searching around a lot and have been trying to use the paraview library in python to this end. (Note that while there is a lot of information avaiable, it is generally fairly high level and I could not find a introduction to running jobs in a non-interactive way)

  1. Is this the correct approach -> using the paraview.simple python library
  2. I’ve been trying to use the ‘trace’ functionalility but I have a feeling that this includes actions which rely on using the GUI. How do I know which functions are useful to me? It seems this tool is made to run with the GUI in it’s own python terminal, more like an additional method than an alternative? Such as:
# # set active source

SetActiveSource(vtkFilenamevti)
# # show data in view

vtkFilenamevtiDisplay = Show(vtkFilenamevti, renderView1, 'UniformGridRepresentation')
  1. If I want to do any manipulation the data what is the best way to interact with paraview classes (I think my data is saved as a ‘paraview.servermanager’ class however I’m not sure if thats a class assosiated with the data or the GUI while its being run). As an example, I have an issue that streamlines ignore the periodic boundary conditions at the edge of my boundary and just end, so I would like to add a ‘boarder’ of each x and y boundary (i.e. concatinate my domain to add periodicity to the sides.) Paraview adds no functionality to this regard so can I do this by just editing the class properties directly.

Sorry if any of this is not clear, I know exactly what Im TRYING to do but it’s relatively hard to converse succinctly when my knowledge of this program and this subject matter is relatively limited.

Yes

This is the right approach, but in same case the resulting script require manual edition.

This is much harder than anything you mentioned before. You will need to take a look into the VTK class doing the stream tracing (vtkStreamTracer) and create a new inheriting one for your needs, that you can then load as a plugin in ParaView. Not trivial and requires to be VTK programmer.

This is much harder than anything you mentioned before. You will need to take a look into the VTK class doing the stream tracing (vtkStreamTracer) and create a new inheriting one for your needs, that you can then load as a plugin in ParaView. Not trivial and requires to be VTK programmer.
[/quote]

Is there a simple work around? For example I was wondering if converting to an alternative file type, performing whatever manipulations I want to the data and then converting back to vtk/vti may be a viable option? I looked into doing this on MATLAB, but it seems python has better libaries concerning the loading of vtk data.

The is multiple way to manipulate the data in a non standard way in ParaView. In order of difficulty it would be :

  • Calculator
  • Python Calculator
  • Python Programmable Filter
  • Custom C++ Plugin

The change you mentioned (adding the concept of boundary to the stream tracer) immediatly jump to the last one.

That being said, the lagrangian particle tracker support boundaries, so that may be ok for you :

Is there a simple work around? For example I was wondering if converting to an alternative file type, performing whatever manipulations I want to the data and then converting back to vtk/vti may be a viable option? I looked into doing this on MATLAB, but it seems python has better libaries concerning the loading of vtk data.

Of course, this would be a solution, I’d not recommend matlab for this task as VTK support in matlab is not great.

I thought I might add this to the bottom here in the hope you might answer this without starting a new thread, it is related to the workaround I proposed. I had a look around, but couldnt find a satisfactory answer:

Because of clashes when using paraview and pyvista packages together, I had to write my numpy array to the .vti file in acsii form using a loop. (I tried for a long time using numpy_to_vtk but couldnt get it to work)

In the .VTI file there is a line that says ‘’

What does ‘RangeMax’ represent?