# Subtract from one slice result to another slice result

**URL:** https://discourse.paraview.org/t/subtract-from-one-slice-result-to-another-slice-result/9593
**Category:** ParaView Support
**Created:** [May 9, 2022, 7:56pm UTC](https://discourse.paraview.org/t/subtract-from-one-slice-result-to-another-slice-result/9593 "2022-05-09T19:56:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![limpideyes](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/f475e1/32.png) [@limpideyes](https://discourse.paraview.org/u/limpideyes)
#### Post date: [May 9, 2022, 7:56pm UTC](https://discourse.paraview.org/t/subtract-from-one-slice-result-to-another-slice-result/9593/1 "2022-05-09T19:56:21Z")

</div>

Dear ParaViewers,

I have got a question about subtracting slice results. I have two simulation results: results.foam-1 and results.foam-2. And I sliced those results at 1.5m of Z axis for each: Slice1 and Slice2.

Slice1 from results.foam1

 ![Slice1](https://discourse.paraview.org/uploads/default/original/2X/a/a632df477b263f7613d61d15780c263f0135fd30.jpeg)

Slice2 from results.foam2

 ![Slice2](https://discourse.paraview.org/uploads/default/original/2X/1/11c514d0f97a10e6ff6d3d0c38ddbdea55c3f20f.jpeg)

I want to have the result that Slice 2 is subtracted by Slice 1. So, I’d visualise the difference of Umagnitudes between them. And I’d represent Umagnitude based on Cells, not points.

Do I have to do with calculator filter or python calculator filter? If so, how can I do that? Can anyone please let me know the fomula for the calculator or python calculater?

Please help.

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [May 10, 2022, 12:15am UTC](https://discourse.paraview.org/t/subtract-from-one-slice-result-to-another-slice-result/9593/2 "2022-05-10T00:15:28Z")

</div>

If the geometries in Slice1 and Slice2 match exactly, including the order of Cell Id, apply the `AppendAttributes` filter and then use the `Calculator` filter to take the difference “U-U\_input\_1” of the **Vectors** of the **Cell Data**.

 ![cell_data_diff](https://discourse.paraview.org/uploads/default/original/2X/a/acbb34706881afe0b87016077ff7f0b1955382ff.png)

If only the order of Cell Id is different between Slice 1 and Slice 2, you should take the difference to **Point Data** instead of Cell Data in the `Calculator` filter, and then apply the `PointDatatoCell` Data filter.

![point_data_diff](https://discourse.paraview.org/uploads/default/original/2X/9/9dbc9ef69f6cc7bf096b5abdf5e21b6b11e205a0.png)

---

<div class="post-metadata">

### Author: ![scabo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@scabo](https://discourse.paraview.org/u/scabo)
#### Post date: [August 3, 2024, 2:10pm UTC](https://discourse.paraview.org/t/subtract-from-one-slice-result-to-another-slice-result/9593/3 "2024-08-03T14:10:36Z")

</div>

Hi,  
What is meant by U\_input\_1? I have 2 slices/surface vectors, if i want to subtract one from another the term sqrt(U\_Y_U\_Y+U\_Z_U\_Z) should i write sqrt(U\_Y_U\_Y+U\_Z_U\_Z)\_SurfaceVectors1-sqrt(U\_Y_U\_Y+U\_Z_U\_Z)\_SurfaceVectors2?

But this is not working… I have attached the state file. Can some one please help me out. Thanks!  
[paraview\_support.pvsm](https://discourse.paraview.org/uploads/short-url/hqOuvwqA978HBcvahzwpMnP9wx9.pvsm) (2.2 MB)
