Visualizing complex vibration modes

Is it possible to construct an animation of complex vibration modes? Obviously, the actual shape is described by a real field, composed of a real part and an imaginary part of a vector V:
v = ReVcos(at) - ImVsin(at).

Has anyone done this? Got any pointers?

1 Like

At first I was going to suggest using Python Calculator, but due to a bug I just found, I expect that won’t work for you.

Until that’s fixed, you’ll probably have to use the Programmable Filter. You can use that to get the real and imaginary fields from your data as well as the current time from the pipeline. From there, you can compute the instant value of the vibration. Here is an example Script for the Programmable Filter:

real = inputs[0].PointData['Real']
imag = inputs[0].PointData['Imag']

executive = self.GetExecutive()
time_value = executive.GetOutputInformation(0).Get(executive.UPDATE_TIME_STEP())

vibrate = real * cos(6.28 * time_value) - imag * sin(6.28 * time_value)

output.PointData.append(vibrate, 'vibrate')

However, that alone won’t do it because you also have to tell the VTK pipeline what time you want. If you don’t, the pipeline won’t give you any time. So, you will need to also set the the RequestInformation Script (an advanced property). The following RequestInformation Script sets up 100 time steps between time 0 and time 1.

executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)

for i in range(0, 100):
  outInfo.Append(executive.TIME_STEPS(), i/100)

outInfo.Append(executive.TIME_RANGE(), 0)
outInfo.Append(executive.TIME_RANGE(), 1)

Here is an example state file that creates some fabricated data with real and imaginary components and then applies a Programmable Filter to animate the vibration: vibration-animation-example.pvsm (583.1 KB)

1 Like

Many thanks, I will give it a shot.

Where do I find this RequestInformation script text box? I don’t see where to input this.

Press the Toggle Advanced Properties button and the RequestInformation Script text box will appear after the main Script box.

1 Like

Many thanks, I realize it was an embarrassing question. :slight_smile: But in all my years of using paraview I’ve never once needed advanced properties, and I had no idea what the gear was for.

I have it now set up like this:

There is no error, but there is no change in shape either.
Shape.vtk has 2 point-data sets, one for the real part of the vector field, and one for the imaginary part.

The output of this Programmable Filter will just create a field named vibrate that will change over time. If you want to use the vibrate field as displacements to change the shape, you will have to apply the Warp by Vector filter.

Perfect. That makes sense. Thanks!

Many thanks for your help!

Neat! I’m glad it worked.

Thank you so much for this discussion, and the code.

I want to do something similar. However, I want it to work as a “representation”, like the one described in the following link:

I’ve been reading, and I’m thinking on doing the following:

  • pull the docker image kitware/paraview
  • compile paraview within a container using this image
  • following this documentation modify the example “Examples/Plugins/Representation”
  • compile the example

Am I in the right track?

The reason for doing this is to animate the acoustic fields here

Thank you, again.