CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   ParaView (https://www.cfd-online.com/Forums/paraview/)
-   -   [General] How to move a slice following the particle coordinates (defined in a text file)? (https://www.cfd-online.com/Forums/paraview/140039-how-move-slice-following-particle-coordinates-defined-text-file.html)

Bombacar August 6, 2014 11:08

How to move a slice following the particle coordinates (defined in a text file)?
 
Hi everyone!

I would like to know how to define the origin property of a "slice filter" using a specific sphere's center (with its coordinates)?.

Until now, I am able to slice with the "slice filter" and I fix the values manually. But I would like a way to make it automatically. The goal is try to create an animation that only shows the intersection plane (that it moves with the choosen particle).

Some idea? Thanks in advance.

Nucleophobe March 29, 2015 11:10

Did you ever figure this our Bomcar? I'm trying to do the same thing.

You can do it with a programmable filter, but the details are a bit tricky. Here's some example code that does something similar:
http://permalink.gmane.org/gmane.com...view.user/6807

I think the code above is supposed to create a slice through the center of an object independent of the object's location. So, if the object moves, the slice moves. We want to do the same thing, but the slice should be applied to the volume field data rather than the object itself.

Anyway, hope you were able to figure something out. I'll post back if I get results.
-Nuc

Edit:
For my case, this script works. I am using Lagrangian particle cloud data to drive the position of a slice that cuts through the fluid domain. I apply the "Programmable Filter" to the Lagrangian data and run:
Code:

from paraview import simple
input0=inputs[0]
x = input0.GetPoints()[0][0]._Arrays[0]
y = input0.GetPoints()[0][1]._Arrays[0]
z = input0.GetPoints()[0][2]._Arrays[0]
print (x, y, z)
slice1 = simple.FindSource('Slice1')
slice1.SliceType.Origin = [x, y, z]

where 'Slice1' is the name of the slice that I am animating.

The only problem is the script fails to run in client-server mode, giving me the error:
Quote:

TypeError: 'NoneType' object is not subscriptable
which basically means that the "Programmable Filter" isn't receiving any data... Anyone know how to fix this?


All times are GMT -4. The time now is 15:02.