# Results superposition

**URL:** https://discourse.paraview.org/t/results-superposition/10854
**Category:** ParaView Support
**Created:** [November 24, 2022, 12:10pm UTC](https://discourse.paraview.org/t/results-superposition/10854 "2022-11-24T12:10:18Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![FEngineer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@FEngineer](https://discourse.paraview.org/u/FEngineer)
#### Post date: [November 24, 2022, 12:10pm UTC](https://discourse.paraview.org/t/results-superposition/10854/1 "2022-11-24T12:10:18Z")

</div>

Hi,

how can I add together results from 2 different output databases (with the same geometry) or 2 different frames within a single database ? In the case of linear structural FEA it’s often necessary to add together results from separate analyses performed on the same model or from independent frames of a single analysis. I don’t know which filters in ParaView could help with that (I assume that two different filters will be needed depending on whether databases or frames are considered). To make it clear what I mean - here’s an example: if a point has a value of a particular variable equal to 3 in one database/frame and 5 in another database/frame then this point should have a value of 8 as a result of superposition.

---

<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: [November 24, 2022, 12:36pm UTC](https://discourse.paraview.org/t/results-superposition/10854/2 "2022-11-24T12:36:51Z")

</div>

Hi @FEngineer

PythonCalculator should be the right filter to use.

Best,

---

<div class="post-metadata">

### Author: ![FEngineer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@FEngineer](https://discourse.paraview.org/u/FEngineer)
#### Post date: [November 25, 2022, 11:32am UTC](https://discourse.paraview.org/t/results-superposition/10854/3 "2022-11-25T11:32:20Z")

</div>

I selected two data sets in the tree, added Python Calculator and typed this:

`(inputs[0].PointData['Displacement_Magnitude'])+(inputs[1].PointData['Displacement_Magnitude'])`

However, the result is just the value from the first data set, not a sum from both of them. Should I do it differently ?

---

<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: [November 25, 2022, 11:58am UTC](https://discourse.paraview.org/t/results-superposition/10854/4 "2022-11-25T11:58:54Z")

</div>

That sounds correct, could you share a statefile ?

---

<div class="post-metadata">

### Author: ![FEngineer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@FEngineer](https://discourse.paraview.org/u/FEngineer)
#### Post date: [November 25, 2022, 1:44pm UTC](https://discourse.paraview.org/t/results-superposition/10854/5 "2022-11-25T13:44:35Z")

</div>

Sure, here’s the state file:

[Superposition.pvsm](https://discourse.paraview.org/uploads/short-url/xcrfmtrX7O4ouB3GQxltdriKZ3m.pvsm) (454.8 KB)

---

<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: [November 28, 2022, 12:32pm UTC](https://discourse.paraview.org/t/results-superposition/10854/6 "2022-11-28T12:32:30Z")

</div>

I’m unable to reproduce your issue with your statefile and my own data, please share your data.

---

<div class="post-metadata">

### Author: ![FEngineer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@FEngineer](https://discourse.paraview.org/u/FEngineer)
#### Post date: [November 28, 2022, 2:20pm UTC](https://discourse.paraview.org/t/results-superposition/10854/7 "2022-11-28T14:20:32Z")

</div>

> [@mwestphal](#):
>
> please share your data

Here are both data sets:

[Pipe2D.vtk](https://discourse.paraview.org/uploads/short-url/sAbOKoLoS6srDN8HBNHAH0UtBtP.vtk) (2.8 MB)  
[Pipe2D\_PR0.vtk](https://discourse.paraview.org/uploads/short-url/o2QbKA40LRtvVbB3rZwILgv540p.vtk) (2.8 MB)

---

<div class="post-metadata">

### Author: ![FEngineer](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/5f8ce5/32.png) [@FEngineer](https://discourse.paraview.org/u/FEngineer)
#### Post date: [December 2, 2022, 3:25pm UTC](https://discourse.paraview.org/t/results-superposition/10854/8 "2022-12-02T15:25:43Z")

</div>

I tried with different data sets and the same behavior can be observed - instead of summing, values from the first data set are shown. Can it be a bug ?

I’ve found a different way to do this - using Programmable Filter with this code:

```auto
v_0 = inputs[0].PointData['Displacement Magnitude']
v_1 = inputs[1].PointData['Displacement Magnitude']
output.PointData.append(v_1 + v_0, 'sum')

```
