# How to create a variable to save initial condition

**URL:** https://discourse.paraview.org/t/how-to-create-a-variable-to-save-initial-condition/2150
**Category:** ParaView Support
**Created:** [July 1, 2019, 9:55pm UTC](https://discourse.paraview.org/t/how-to-create-a-variable-to-save-initial-condition/2150 "2019-07-01T21:55:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mariana\_Rodriguez](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mariana_rodriguez/32/1668_2.png) [@Mariana\_Rodriguez](https://discourse.paraview.org/u/Mariana_Rodriguez)
#### Post date: [July 1, 2019, 9:55pm UTC](https://discourse.paraview.org/t/how-to-create-a-variable-to-save-initial-condition/2150/1 "2019-07-01T21:55:54Z")

</div>

Hello, how can I create a variable in Paraview to save the initial pressure field?

I want to use it later to compute DP = p(t) - po, being po the pressure at initial time.

My Exodus file that contains the simulation results only contains P(t) at each node, but it does not have saved the initial pressure po.

I want to see how DP changes with time in ParaView view.

Thanks!

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [July 2, 2019, 12:14am UTC](https://discourse.paraview.org/t/how-to-create-a-variable-to-save-initial-condition/2150/2 "2019-07-02T00:14:08Z")

</div>

I don’t know of any direct way to get the pressure at a time step other than the current one, but you can use the `Force Time` filter to create a version of the data that is fixed at the initial time and then use the `Append Attributes` filter to bring the initial time values back into the data set that is changing over time.

Here are some steps that should work. The instructions that you have a point pressure field named `P` and you want to make a field named `DP` that is the delta pressure from the initial values. (You probably need ParaView 5.6 or later for this to work.)

1. Add the `Force Time` filter to your reader. The default values are probably right for the initial time, so `Apply`.
2. Add the `Calculator` filter to the `Force Time` data. Set the `Result Array Name` to `P0` and the expression to `P`. Then `Apply`. (This basically renames the array.)
3. Add the `Pass Arrays` filter to the `Calculator` data. Turn off all arrays except the `P0` array that you created in step 2.
4. Click the reader in the `Pipeline Browser` and then hold down the control key (or command key on Mac) and click on the `Pass Arrays` filter in the `Pipeline Browser`. (The order you select the items in the `Pipeline Browser` matters.) Then add the `Append Attributes` filter and `Apply`.
5. Hit the `Play` button. If your data looks stuck at time step 0, then the inputs to the `Append Attributes` filter were added backwards. Try deleting it, reselecting the inputs, and adding it again.
6. Add the `Calculator` filter to the `Append Attributes` data. Set the `Result Array Name` to `DP` and the expression to `P - P0`.

Attached here is an example state file that performs a similar operation for the `VEL` array of `can.ex2`, which is one of the example files that comes with ParaView (in the `Examples` directory.

[FieldAtTime0.pvsm](https://discourse.paraview.org/uploads/default/original/2X/7/7cdc42aca435415a486d307a40e90a545b90b04a.pvsm) (756.0 KB)

---

<div class="post-metadata">

### Author: ![Mariana\_Rodriguez](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mariana_rodriguez/32/1668_2.png) [@Mariana\_Rodriguez](https://discourse.paraview.org/u/Mariana_Rodriguez)
#### Post date: [July 3, 2019, 2:36am UTC](https://discourse.paraview.org/t/how-to-create-a-variable-to-save-initial-condition/2150/3 "2019-07-03T02:36:51Z")

</div>

Thanks so much! 🙂
