Paraview Catalyst: co-processing visualization window cannot be launched

Hi, I am trying to use Catalyst to visualize my on-going simulation concurrently. I am in the process of recovering a sample test found in the source code. I was able to launch the run successfully, but the Paraview visualization window did not show up as expected. I tested it on both Windows machine and mac system, but it all failed to provide the visualization.

Attached are the driver and co-processing files:
CatalystWaveletCoprocessing.py (3.1 KB)
CatalystWaveletDriver.py (3.3 KB)

I use the following command to launch the case:
<full path to Paraview pvbatch>/pvbatch CatalystWaveletDriver.py CatalystWaveletCoprocessing.py 1000

Here are the timely outputs:
[0/1]: Timestep 0 of 1000 (time=0.000000)
script name is CatalystWaveletCoprocessing.py
[0/1]: Timestep 1 of 1000 (time=0.001000)
script name is CatalystWaveletCoprocessing.py
[0/1]: Timestep 2 of 1000 (time=0.002000)
script name is CatalystWaveletCoprocessing.py
[0/1]: Timestep 3 of 1000 (time=0.003000)
script name is CatalystWaveletCoprocessing.py
[0/1]: Timestep 4 of 1000 (time=0.004000)
script name is CatalystWaveletCoprocessing.py
[0/1]: Timestep 5 of 1000 (time=0.005000)
.
.
.

The code run successfully, but no visualization was given. Any suggestions will be appreciated.

I figured out what is going on. I should also launch the Paraview GUI and connect the port to build the connection. However, I still did not see the conour in the render. I attached a figure to show what I am getting.

Any ideas?

Click on the icon on the left of “Contour1” in the pipeline browser.

I clicked it, but still nothing shows up.

@nicolas.vuaille

Clicking on the icon left to Contour1 in the pipeline (under catalyst) should create an item in the pipeline, called Extract: Contour1, under builtin. Then you should be able to display it by clicking on the closed eye (on the left of it). See below:

Hi, thank you for the help. This solves my issue. Another question is that the Paraview interface must be launched separately, and I need to manuualy connect to the port by clicking the “Catalyst” dropdown menu. I was wondering if it would be possible to acomplish this using macro (python script) or by adding flags while launching Paraview interface from the command line.

For now clicking in the menu is the only way, but I’m working on allowing this in python script. It should be available in next ParaView release (and before this summer in the main codebase).

Thanks. I will be awesome if these features could be added into the Python script. I still have one more, hopefully the last, question. Now, I need to use Catalyst to viusalize the results of my own code. Do you happen to have a tutorial or video to show how to generate the driver and co-processing script? I believe the format of my results will be different from those used in the example.

To create the adaptor (= the code that links your simu to Catalyst), you can look at those examples : https://gitlab.kitware.com/paraview/paraview/-/tree/master/Examples/Catalyst

To create a coprocessing python script, I will suggest to do so:

  • get some representative data. For instance run your simu and use the SampleScripts/allinputsgridwriter.py script from the Catalyst examples.
  • load this data in PV
  • setup the pipeline you want
  • open Export Inspector (Catalyst / Define Export)
  • setup the script

More info in the CatalystUserGuide chapter 2.

Really appreciate your help. I will look into these examples.

Hi, I am back with more questions. I have looked into those examples and have a better understanding of the Catalyst workflow, but I am still struggling with writing my own adaptor. I found 2 examples written in Python, which is of my interest.

Example 1: can crash

Example 2: wavelet

I got the point that the results from the simulation will be transferred to Paraview by the “coProcess(data, time, step, coprocessing_file, …)” function. My question is how the first argument “data” looks like. What is the structure of the data (or data class)? I am a little confused since the given examples pass the results all in different formats. Example 1 uses a method in the classExodusIIReader - GetClientSideObject().GetOutputDataObject(0), which I did not find it in the class description (https://kitware.github.io/paraview-docs/latest/python/paraview.simple.ExodusIIReader.html). Example 2 uses the server manager to extract the results - pvsimple.servermanager.Fetch(wavelet). I tried to search and dig into the source code to find possible similarities or hints, but I could not find the inforamtion I need.

In my case, the results are in vtk format. I presume I should use the LegacyVTKReader to load the results, which is most similar to the situation in example 1. What about next? Are there any methods I could use to convert/process the results so that the function “coProcess” can take it and pass it to Paraview?

Sorry for so many questions. I am actually a beginner of both Python and Paraview. I planed to upload the files of the can crash case, but it was too big to be accepted by the browser. BTW, I already posted the wavelet source code. Looking forward to your reply.

Do not post picture of code please, but copy your code.
http://idownvotedbecau.se/imageofcode

Hi, I am back with more questions. I have looked into those examples and have a better understanding of the Catalyst workflow, but I am still struggling with writing my own adaptor. I found 2 examples written in Python, which is of my interest.

Example 1: can crash

    input_ds = pvsimple.ExodusIIReader( FileName=[sys.argv[2]])
    input_ds.ElementVariables = ['EQPS']
    input_ds.EdgeBlocks = []
    input_ds.GlobalVariables = ['KE', 'XMOM', 'YMOM', 'ZMOM', 'NSTEPS', 'TMSTEP']
    input_ds.ElementBlocks = ['Unnamed block ID: 1 Type: HEX', 'Unnamed block ID: 2 Type: HEX']
    input_ds.PointVariables = ['DISPL', 'VEL', 'ACCL']
    input_ds.FaceBlocks = []
    timeArray = input_ds.TimestepValues
    for step in range(len(timeArray)):
        time = input_ds.TimestepValues[step]
        input_ds.UpdatePipeline(time)
        dataset = input_ds.GetClientSideObject().GetOutputDataObject(0)
        # "perform" coprocessing.  results are outputted nly if
        # the passed in script says we should at time/step
        coProcess(dataset, time, step, sys.argv[1])

Example 2: wavelet

    pm = pvsimple.servermanager.vtkProcessModule.GetProcessModule()
    rank = pm.GetPartitionId()
    nranks = pm.GetNumberOfLocalPartitions()
    for step in range(numsteps):
        # assume simulation time starts at 0
        time = step/float(numsteps)
        print("[%d/%d]: Timestep %d of %d (time=%f)" % (rank, nranks, step, numsteps, time))
        # create the input to the coprocessing library.  normally
        # this will come from the adaptor
        wavelet = pvsimple.Wavelet()
        wholeExtent = wavelet.WholeExtent
        # put in some variation in the point data that changes with time
        wavelet.Maximum = 255+200*math.sin(step * math.pi / 100)
        wavelet.UpdatePipeline()
        imageData = pvsimple.servermanager.Fetch(wavelet)
        # note that we delete wavelet now since.  if not, it will
        # get deleted automatically in the coprocessing script
        pvsimple.Delete(wavelet)
        wavelet = None
        # "perform" coprocessing.  results are outputted only if
        # the passed in script says we should at time/step
        coProcess(imageData, time, step, sys.argv[1], wholeExtent)
        imageData = None
        import time
        time.sleep(1)

I got the point that the results from the simulation will be transferred to Paraview by the “coProcess(data, time, step, coprocessing_file, …)” function. My question is how the first argument “data” looks like. What is the structure of the data (or data class)? I am a little confused since the given examples pass the results all in different formats. Example 1 uses a method in the classExodusIIReader - GetClientSideObject().GetOutputDataObject(0), which I did not find it in the class description (https://kitware.github.io/paraview-docs/latest/python/paraview.simple.ExodusIIReader.html). Example 2 uses the server manager to extract the results - pvsimple.servermanager.Fetch(wavelet). I tried to search and dig into the source code to find possible similarities or hints, but I could not find the information I need.

In my case, the results are in vtk format. I presume I should use the LegacyVTKReader to load the results, which is most similar to the situation in example 1. What about next? Are there any methods I could use to convert/process the results so that the function “coProcess” can take it and pass it to Paraview?

Sorry for so many questions. I am actually a beginner of both Python and Paraview. I planed to upload the files of the can crash case, but it was too big to be accepted by the browser. BTW, I attached the wavelet source code again to this post in case you need more information. Looking forward to your reply.

CatalystWaveletCoprocessing.py (3.1 KB)
CatalystWaveletDriver.py (3.3 KB)

Hi, I typed the code instead of copying the image, and posted my questoin again.

The examples you pasted here are not adaptor but some fake simulation code : see the for loop over timesteps in each.
The coProcess method from your examples are defined in the adaptor, so the arguments are those you will defined :slight_smile:
An adaptor is a kind of wrapper around a vtkCPProcessor object.

Example of adaptor : https://gitlab.kitware.com/paraview/paraview/-/blob/master/Examples/Catalyst/PythonFullExample/coprocessor.py Be careful of the outdated modules … it will not run directly but the architecture is still correct.

  • initialize() creates the vtkCPProcessor
  • finalize() finalizes …
  • addScript() adds script describing pipeline to execute
  • coprocess() does the coprocessing. Here grid is your data from your simulation. In this example it is not a vtk object so we create a vtkImageData and fill it with simu values (the AddArray lines). As you have vtkDataObject, you can ignore lines 77 to 87

I have figured out the way to build the connection. Thank you so much for your help.