porepy.viz.data_saving_model_mixin module

This mixin class is used to save data from a model to file.

It is combined with a Model class and provides methods for saving data to file.

We provide basic Exporter functionality, but the user is free to override and extend this class to suit their needs. This could include, e.g., saving data to a database, or to a file format other than vtu.

class DataSavingMixin[source]

Bases: object

Class for saving data from a simulation model.

Contract with other classes:

The model should/may call save_data_time_step() at the end of each time step. The model should/may call finalize_save_data() at the end of the simulation.

data_to_export()[source]

Return data to be exported.

Return type should comply with pp.exporter.DataInput.

Returns

List containing all variable names.

finalize_data_saving()[source]

Export pvd file and finalize export.

Return type

None

initialize_data_saving()[source]

Initialize data saving.

This method is called by prepare_simulation() to initialize the exporter, and any other data saving functionality (e.g., empty data containers to be appended in save_data_time_step()).

Return type

None

save_data_time_step()[source]

Export the model state at a given time step.

Return type

None

equation_system: EquationSystem

Equation system manager.

mdg: MixedDimensionalGrid

Mixed dimensional grid for the simulation.

params: dict[str, Any]

Dictionary of parameters. May contain data saving parameters.

property suppress_export: bool

Suppress export of data to file.

time_manager: TimeManager

Time manager for the simulation.