How to subtract time(t) data from time(0) data

I need to visualize a displacement field for a Sierra run with its initial non-zero, spatially-varying displacement field subtracted off. Essentially, at every element I want [displacement(t) – displacement(t0)]. I thought the calculator filter may work for this but I don’t know how to subtract off something other than a constant.

Do you have any suggestions?

Thanks,

Alan

Alan,

You may use the ‘Force Time’ filter to extract the time(0) data. Then you can ‘Append Attributes’ with your original data. Your arrays are now duplicated, one for the original time(t) data and one for the time(0). Then the calculator can help you.

Note for the Append Attributes filter: in the pipeline, select both your original dataset item and Force Time item. They may have different geometry (if points move with time). The geometry used will be taken from the first item you had selected.

Can’t you just use the Python Calculator for this?
Lock one dataset at time=0 with Force Time
Select both original dataset and Force Time and call Python Calculator
Calculate something like:
DISPL_NET with expression:
inputs[0].PointData[‘DISPL’]-inputs[1].PointData[‘DISPL’]
Caveats:

  1. Which is inputs[0] or inputs[1] is unclear - check a few numbers to see you got them in the right order
  2. You now need to assign DISPL_NET to your point coordinates (maybe in a Programmable filter you could do something like Points = Points -DISPL + DISPL_NET to get new Point coordinates)

There is a dedicated filter for this actually, based on @DennisConklin @nicolas.vuaille design actually, it is called : “Temporal Array Operator”

@mwestphal. Indeed, I missed it. But can you use current timestep for one of the two arguments ?

Mathieu,

I forgot about that, but another question. The Temporal Array subtracts two discrete timesteps (as understand it - I’m definitely not familiar with it). If I want to display my displaced geometry over time - maybe animate it or just look at different times, then I don’t understand how the Temporal Array would handle this.

However, the Python Calculater + Programmable filter would update when you change the time you are viewing, so it is animation friendly.

Please correct me if I misunderstand, I’m just trying to wrap my head around it myself

BTW, would you consider renaming that filter to “Temporal Algebra” :wink:

The temporal array operator does not handle working with the current timestep, contrary to a @nicolas.vuaille or @DennisConklin solution. It works on static timesteps.

Dennis had the answer. I will write this up in Tips and Tricks. Here is what I did

  • Read in can. Turned off displacements. All variables on. Apply.
  • Force time. Time 0. Apply.
  • Highlighted can and Force Time.
  • Python Calculator filter. Output to DISPL_NET. Add next line as equation. Apply.
    inputs[0].PointData[‘DISPL’]-inputs[1].PointData[‘DISPL’]
  • Warp by Vector filter. DISPL_NET. Apply.

Heyo,
I have to restart the discussion here.
I am trying the above, but paraview keeps crashing when I apply the Python calculator.

One difference I have, is that I am dealing with CellData. But that shouldn’t make a difference, right?

Another way I tried also did not work:
Importing group of data (this i the time-series of cellData)
importing the data(t=0) and use the calculator to rename the “arr” as “base”/ or use the ForceTimeFilter
then use append datasets to combine data (of all time steps) with the calculated “base”
then use the “normal” calculator filter to subtract arr - base --> then my timesteps are lost, an the operation is only done for the first time step, which results in diffences of e-38, which I guess is the computational precision limit

Any suggestions?
I am using PV 5.4.1 on Ubuntu 18.04

but paraview keeps crashing when I apply the Python calculator.

Please precise steps to reproduce and error message

nothing more than:
Segmentation fault (core dumped)
and some generic warning for future version like
Generic Warning: In /build/paraview-lH8wFv/paraview-5.4.1+dfsg3/VTK/Rendering/VolumeOpenGL/vtkOpenGLVolumeTextureMapper3D.cxx, line 57
vtkOpenGLVolumeTextureMapper3D::vtkOpenGLVolumeTextureMapper3D was deprecated for VTK 7.0 and will be removed in a future version.

Please provide clear steps to reproduce.
Please try with ParaView 5.7.0 release : https://www.paraview.org/download/

Ok, kind of fixed
version 5.7 does not crash anymore and gives me the error message of that I use a wrong character in my python expression

An indeed it’s the small thing of ’ and ’ as string identifiers. ( I c+p from the discussion here) - which is again changed here on the webpage. So check your string identifier when writing input[0].CellData[“arr”]