Model

class unifhy.Model(identifier, config_directory, saving_directory, surfacelayer, subsurface, openwater, nutrientsurfacelayer, nutrientsubsurface, nutrientopenwater, _to_yaml=True)

Model is the core element of the modelling framework.

It is responsible for configuring the simulation, checking the compatibility between Components, and controlling the simulation workflow.

Instantiation

Parameters
identifier: str

A name to identify the model files.

config_directory: str

The path to the directory where to save the model configuration files.

saving_directory: str

The path to the directory where to save the model exchanger dump files and model record files.

surfacelayer: SurfaceLayerComponent object

The Component responsible for the surface layer compartment of the hydrological cycle.

subsurface: SubSurfaceComponent object

The Component responsible for the subsurface compartment of the hydrological cycle.

openwater: OpenWaterComponent object

The Component responsible for the open water compartment of the hydrological cycle.

nutrientsurfacelayer: NutrientSurfaceLayerComponent object

The Component responsible for the surface layer compartment of any nutrient modelling.

nutrientsubsurface: NutrientSubSurfaceComponent object

The Component responsible for the subsurface compartment of any nutrient modelling.

nutrientopenwater: NutrientOpenWaterComponent object

The Component responsible for the open water compartment of any nutrient modelling.

Methods

Construction

from_yaml

Instantiate a Model from a YAML configuration file.

to_yaml

Store configuration of Model as a YAML file in the configuration directory.

Initialisation

initialise_transfers_from_dump

Initialise the transfers of the Exchanger from a dump file.

Simulation

spin_up

Run model spin-up simulation to initialise states of each Component of the Model.

simulate

Run model simulation over period defined in its components' timedomains.

resume

Resume model spin up or main simulation run on latest snapshot in dump files or at the given snapshot.

Attributes

identifier

Return the name used to identify the model files.

config_directory

Return the directory used to store the model configurations.

saving_directory

Return the directory used to store the model output files.

surfacelayer

Return the surface layer component of the model.

subsurface

Return the sub-surface component of the model.

openwater

Return the open water component of the model.

nutrientsurfacelayer

Return the nutrient surface layer component of the model.

nutrientsubsurface

Return the nutrient sub-surface component of the model.

nutrientopenwater

Return the nutrient open water component of the model.