Saving results

In this section we look at how we can save simulation results to files that can be read externally. All operations can be performed using the LizzyModel user-facing methods. For more details about the underlying core components, please refer to the API Reference documentation.

Saving to file

Results are saved in the XDMF format, backed by an HDF5 binary file. This format is natively supported by Paraview and can be loaded directly for time-series visualisation.

To save results, use the save_results() method:

model.save_results()

This creates two files in a results/ folder in the current working directory:

  • <name>_RES.xdmf: the XDMF descriptor file (open this in Paraview).

  • <name>_RES.h5: the HDF5 binary file containing all field data.

By default, <name> is taken from the mesh file name. A custom name can be provided as the second argument:

model.save_results(result_name="my_simulation")

The following fields are saved at each write-out time step:

  • FillFactor: fill factor at each node (0 = empty, 1 = filled).

  • FreeSurface: flow front indicator.

  • Pressure: pressure field [Pa].

  • Velocity: Darcy velocity field [m/s].

To these, we can also add optionally the full 3×3 permeability tensor for each element as a cell field, by passing save_permeability=True:

model.save_results(save_permeability=True)

Note

If the model is run in “Lighweight mode”, Lizzy does not create any Solution object and save_results() cannot be called (will throw a ConfigurationError).

Viewing results in Paraview

To open the results from the .xdmf file in Paraview, it is necessary to select the reader Xdmf3 Reader S. This will be normally prompted for selection when the file is opened.

../_images/paraview_result_example.png

Example of simulation results visualised in Paraview