twallema / pySODM

Simulating and Optimising Dynamical Models in Python 3
Other
9 stars 2 forks source link

Different states can have different stratifications: coupled models and submodels #22

Closed twallema closed 1 year ago

twallema commented 1 year ago

The number one issue with pySODM's stratification concept is that all states must have the same number of stratifications (and thus be of the same size). However, this makes the coupling of completely different models, or models with submodels, impossible to simulate.

As an example, within the COVID-19 project, I want to couple the differentials of a macro-economic IO model, where every state is stratified into 64 economical sectors, to an epidemiological model where each age group is stratified into ten age groups. xarray allows to build datasets where the data_variables have different stratifications.

I think this issue can be fixed rather easily by defining an additional variable in the model declaration declaring the dimensions of every state. From this declaration, the size of every state can be deduced and saved. Then, these sizes can be used to adequately flatten/deflatten the model's states when they are sent to the integrator.

twallema commented 1 year ago

This issue has been resolved by PR #25