# How to load the initial solution field '\[soln-ics\]' from a .txt file?

**URL:** <https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292>\
**Category:** Cases\
**Tags:** config\
**Created:** [27 July 2020 13:12 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292 "2020-07-27T13:12:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiny\_Wan](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@Kiny\_Wan](https://pyfr.discourse.group/u/Kiny_Wan)\
**Post date:** [27 July 2020 13:12 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292/1 "2020-07-27T13:12:03Z")

</div>

Dear all,  
I want to validate a benchmark example about vortex pairing [1] and it requires to initialize solution with the pressure and density obtained from Poisson equation. I would like to know about how to use the function of patch.patch to load the data for initialization?

Regards

Kiny

[1] Classification and sound generation of two-dimensional interaction of two Taylor vortices

---

<div class="post-metadata">

**Author:** ![fdw](https://avatars.discourse-cdn.com/v4/letter/f/a587f6/32.png) [@fdw](https://pyfr.discourse.group/u/fdw)\
**Post date:** [27 July 2020 13:38 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292/2 "2020-07-27T13:38:50Z")

</div>

There is no functionality for this. If you wish to restart from an initial solution field of your own specification you will need to write a .pyfrs file and then restart the simulation from this file.

Regards, Freddie.

---

<div class="post-metadata">

**Author:** ![Kiny\_Wan](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@Kiny\_Wan](https://pyfr.discourse.group/u/Kiny_Wan)\
**Post date:** [27 July 2020 13:50 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292/3 "2020-07-27T13:50:08Z")

</div>

Hi Freddie, thanks for your quick reply. I will look into the data structure of .pyfrs file.

---

<div class="post-metadata">

**Author:** ![Amelius258](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/amelius258/32/587_2.png) [@Amelius258](https://pyfr.discourse.group/u/Amelius258)\
**Post date:** [22 January 2024 06:09 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292/4 "2024-01-22T06:09:05Z")

</div>

Greetings. I encounter the same issue as former discussions. Would you like to share some experience on modifying such .pyfrs file? Thanks!

---

<div class="post-metadata">

**Author:** ![WillT](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@WillT](https://pyfr.discourse.group/u/WillT)\
**Post date:** [22 January 2024 07:31 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292/5 "2024-01-22T07:31:47Z")

</div>

A pyfrs file is just an hdf5 file with a specific data layout. The best way to understand them is to run a simple test case and then use tools such as `h5ls` and `h5dump` to see what is being written.

For example, this is the output for a p=3, hex case with 32^3 elements in 3D for the Navier–Stokes equations.

```auto
config Dataset {SCALAR}
config-0 Dataset {SCALAR}
mesh_uuid Dataset {SCALAR}
soln_hex_p0 Dataset {64, 5, 32768}
stats Dataset {SCALAR}

```

So you can see the solution of the zeroth partition is in `soln_hex_p0` with the first dimension being the solution points, the next being the variables and the last being the element.

You can then use `h5dump -d stats` which shows you that the variables are specifically:

```auto
[data]
fields = rho,rhou,rhov,rhow,E
prefix = soln

```

---

<div class="post-metadata">

**Author:** ![Amelius258](https://yyz2.discourse-cdn.com/free1/user_avatar/pyfr.discourse.group/amelius258/32/587_2.png) [@Amelius258](https://pyfr.discourse.group/u/Amelius258)\
**Post date:** [22 January 2024 08:35 UTC](https://pyfr.discourse.group/t/how-to-load-the-initial-solution-field-soln-ics-from-a-txt-file/292/6 "2024-01-22T08:35:07Z")

</div>

Hi Will,

By using h5dump I managed to see the structure of .pyfrs file. Thank you for your swift reply!
