# Problems with Catalyst2 and Paraview Live Visualization

**URL:** https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401
**Category:** In Situ Support
**Created:** [February 14, 2023, 1:03pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401 "2023-02-14T13:03:12Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [February 14, 2023, 1:03pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401/1 "2023-02-14T13:03:12Z")

</div>

Hello!

I recently started taking a closer look into implementing Catalyst2 capabilities into an in-house fluid dynamics solver.

My main goal is to be able to have a live representation of the solution, which means loading up a Catalyst state with predefined filters (Slices, Calculators etc) and have the ParaView windows automatically update with the new flow characteristics.

I started with this guide:

> [@How to try out Catalyst2](https://discourse.paraview.org/t/how-to-try-out-catalyst2/9008):
>
> Catalyst is an in-situ framework created as a part of ParaView a few years ago. With time and use, we saw the different drawbacks of our approach and then it was decided to create a new architecture, [Catalyst2](https://catalyst-in-situ.readthedocs.io/en/latest/index.html) With this new implementation, it is: easier to implement in your simulation (less knowledges required) easier to update from a version to another (less dependencies, binary compatibility) possible to activate Steering mode, where ParaView can modify simulation parameters at runtime A…

I faced the same problem mentioned in the following comment of the aforementioned guide:

> [@How to try out Catalyst2](https://discourse.paraview.org/t/how-to-try-out-catalyst2/9008/4):
>
> Thank you Nicolas! This is really great! I’m trying to test the example. However, I get an error. I have already followed your instruction as follows: 1 - Build and Install Catalyst ([https://catalyst-in-situ.readthedocs.io](https://catalyst-in-situ.readthedocs.io)) 1.1 - Using CMake mkdir \<test\_catalyst\> cd \<test\_catalyst\> mkdir libcatalyst mkdir catalyst-build git clone https://gitlab.kitware.com/paraview/catalyst.git cd catalyst-build ccmake -G Ninja -DCMAKE\_INSTALL\_PREFIX=\<test\_catalyst\>/libcatalyst \<test\_cat…

which I also managed to solve by downloading and building ParaView from source.

Up to that point:

- Catalyst is built correctly, tests are passed succesfully
- ParaView is also build correctly, binaries work as intended

I then tried some of the examples.

**Catalyst examples (legacy)**

All examples work as intended.  
I am able to connect ParaView to the simulation and visualize whatever I want.  
Catalyst breakpoints also work as intended.  
All and all, legacy Catalyst examples work just fine.  
Therefore, I think my ParaView and Catalyst builds are OK.

**Catalyst2 examples**

I tried the CxxFullExample that is mentioned in the guide.

I compiled the example using:

> cmake -DCMAKE\_PREFIX\_PATH=#ParaViewBuildPath# #exampleSourcePath#  
> make

It is built succesfully.

In order to run the example, I also needed to set:

> export CATALYST\_IMPLEMENTATION\_PATHS=“#ParaviewBuildPath#/lib/catalyst”  
> export CATALYST\_IMPLEMENTATION\_NAME=paraview

I then open ParaView and connect it to catalyst, also setting in to pause on the first iteration,  
and run the example with:

> ./bin/CxxFullExampleV2 catalyst2\_pipeline.py

ParaView connects to catalyst successfully:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/dcbe54dec04520961cc4e0753d45981ca14a1c90.png)

The simulation also pauses on the first iteration, with a warning:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/d0b0384a42106a000a9b77d2c4f8715b13989d87.png)

The warning reads:

> GetVoidPointer called. This is very expensive for non-array-of-structs subclasses, as the scalar array must be generated for each call. Using the vtkGenericDataArray API with vtkArrayDispatch are preferred. Define the environment variable VTK\_SILENCE\_GET\_VOID\_POINTER\_WARNINGS to silence this warning.

To continue, I just extract the grid and choose to see the velocity contour:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/c/c85f148559ca93fc9a603b07b441cab91f3e2797.png)

**Here is where the problems start**

When I go to Catalyst/Continue, the ParaView window just freezes until the end of the simulation.  
I cannot do or change anything:

- The solution does not update as the example iterates
- I am not able to change the view in any way, the window is frozen
- In addition, Catalyst/Set Breakpoint does not seem to do anything, no matter what I set as a breakpoint the simulation iterates until the end and then stops

 ![image](https://discourse.paraview.org/uploads/default/original/2X/e/e7745db97218976e5aa8f121c909195499744489.png)

When I click “OK”, the view updates to the final values and Catalyst closes:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/b/bc7ec1e249361adda2ae6de90f138f6dafa5ba80.png)

Is there anything I am missing here?  
The Catalyst legacy examples work just fine.  
Is there anything else I need to do for Catalyst2?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 14, 2023, 1:04pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401/2 "2023-02-14T13:04:52Z")

</div>

@Lucas_Givord @Francois_Mazen @nicolas.vuaille

---

<div class="post-metadata">

### Author: ![Lucas\_Givord](https://discourse.paraview.org/user_avatar/discourse.paraview.org/lucas_givord/32/6851_2.png) [@Lucas\_Givord](https://discourse.paraview.org/u/Lucas_Givord)
#### Post date: [February 14, 2023, 2:27pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401/3 "2023-02-14T14:27:42Z")

</div>

Hello @SadBoySquad,

I quickly tested the same example with Catalyt2 and I have exactly like you.

Regarding the freeze issue, it would seem that it is due to the fact that the simulation is faster than the visualization pipeline, by consequent paraview has still not finished treating the step 1 that it already receives data for step2 and so on until the end of the simulation. To confirm that, I simply add a `time.sleep(1)` in the `catalyst_execute` in the `catalyst_pipeline.py` and I can have an interactive pipeline.

For the breakpoint issue, if you’re interested I opened last month an issue about it [https://gitlab.kitware.com/paraview/paraview/-/issues/21735](https://gitlab.kitware.com/paraview/paraview/-/issues/21735) 🙂

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [February 14, 2023, 2:56pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401/4 "2023-02-14T14:56:14Z")

</div>

@Lucas_Givord

So, it seems that that breakpoint thing is indeed a bug…

Regarding the addition of `time.sleep(1)`, where exactly do you add it?  
Are you utilizing the original `catalyst_pipeline.py` that is present in the repository, or are you using the modified `catalyst2_pipeline.py` mentioned in the guide written by @nicolas.vuaille?

On one hand, `catalyst2_pipeline.py` does not contain any definitions for `catalyst_execute`. So I assume you are using the original `catalyst_pipeline.py`.

However, if I add `time.sleep(1)` inside the definition, I get the following error:

> module.catalyst\_execute(info)  
> File “/home/sadboysquad/lib/paraview/Examples/Catalyst2/CxxFullExample/catalyst\_pipeline.py”, line 18, in catalyst\_execute  
> time.sleep(1)  
> NameError: name ‘time’ is not defined

Perhaps you are also importing something additional?

---

<div class="post-metadata">

### Author: ![Lucas\_Givord](https://discourse.paraview.org/user_avatar/discourse.paraview.org/lucas_givord/32/6851_2.png) [@Lucas\_Givord](https://discourse.paraview.org/u/Lucas_Givord)
#### Post date: [February 14, 2023, 3:00pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401/5 "2023-02-14T15:00:44Z")

</div>

Yes I use the original pipeline and I also added `import time` to be able to call `sleep`

---

<div class="post-metadata">

### Author: ![SadBoySquad](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sadboysquad/32/11775_2.png) [@SadBoySquad](https://discourse.paraview.org/u/SadBoySquad)
#### Post date: [February 14, 2023, 5:11pm UTC](https://discourse.paraview.org/t/problems-with-catalyst2-and-paraview-live-visualization/11401/6 "2023-02-14T17:11:05Z")

</div>

@Lucas_Givord

Thank you for the quick fix!  
It indeed does work!

I guess you are right, the influx of data from the example code is too much for ParaView to be able to handle and render before receiving new data.

I have a couple more questions regarding Catalyst2.

When I run the Catalyst2 enabled example and go to ParaView, the `grid` filter in the pipeline has the correct attributes (Cells, Points, etc):

 ![image](https://discourse.paraview.org/uploads/default/original/2X/0/05814ca02ade285ff3c0441993dc4748988fb632.png)

If I try to create a Slice inside the catalyst pipeline, the slice is not created.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/7/7fea9013ad21558b18bbf9bc10366a9a3f906b2a.png)  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/4/413e046b14602bc3719c72a4c24c32f2361aa248.png)

As you can see, it has zero Cells/Points etc.  
I have to **extract** the grid and **then** create the slice:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/4/4688d59ba9705c39a65ba95e0f9fab2dd35b55ea.png)

However, when running Catalyst Legacy examples I am able to add slices, calculators etc inside the catalyst pipeline, without needing to extract the grid first.

Moreover, how would I go about adding a slice, or any other filter for that matter, in `catalyst_pipeline.py`?  
If I add:

> Slice1 = Slice( guiName=“Slice1”, Crinkleslice=0, SliceOffsetValues=[0.0], Triangulatetheslice=1, SliceType=“Plane” )  
> Slice1.SliceType.Offset = 0.0  
> Slice1.SliceType.Origin = [34.5, 32.45, 27.95]  
> Slice1.SliceType.Normal = [1.0, 0.0, 0.0]

The catalyst pipeline contains a slice filter, but it is again empty.

Is there a way to alter the state via the python script, or do I need to have dummy data to create a new state from scratch?
