flodym
The flodym (Flexibe Open Dynamic Material Systems Model) library provides key functionality for building material flow analysis models, including
the class
MFASystemacting as a template (parent class) for users to create their own material flow modelsthe class
FlodymArrayhandling mathematical operations between multi-dimensional arraysdifferent classes representing stocks accumulation, in- and outflows based on age cohort tracking and lifetime distributions. Those can be integrated in the
MFASystem.different options for data input and export, as well as visualization
flodym is based on the concepts of the Open Dynamic Material Systems Model ODYM (Pauliuk & Heeren, 2020). It is a re-implementation with a fundamentally overhauled API, internal dimension management, dynamic stock model integration, and other added features. As a result, flodym enables users to write customized, flexible MFAs, designed for maintainability and future extension.
Installation
flodym is published on PyPI and can be installed with your preferred Python package installer.
For example, with pip run python -m pip install flodym.
To install as a developer:
Install uv.
Clone the flodym repository using git.
From the project root, run
uv syncto create a virtual environment and install all development dependencies.
This workflow uses a project-local virtual environment (.venv) managed by uv.
Dimension Management
MFA models mainly consist of mathematical operations on different multi-dimensional arrays.
For example, the generation of different waste types waste might be a 3D-array defined over the dimensions time $t$, region $r$ and waste type $w$, and might be calculated from multiplying end_of_life_products (defined over time, region, and product type $p$) with a waste_share mapping from product type to waste type.
In numpy, the according matrix multiplication can be carried out nicely with the einsum function, were an index string indicates the involved dimensions:
waste = np.einsum('trp,pw->trw', end_of_life_products, waste_share)
flodym uses this function under the hood, but wraps it in a data type FlodymArray, which stores the dimensions of the array and internally manages the dimensions of different arrays involved in mathematical operations.
With this, the above example reduces to
waste[...] = end_of_life_products * waste_share
This gives a flodym-based MFA models the following properties:
Flexibility: When changing the dimensionality of any array in your code, you only have to apply the change once, where the array is defined, instead of adapting every operation involving it. This also allows, for example, to add or remove an entire dimension from your model with minimal effort.
Simplicity: Since dimensions are automatically managed by the library, coding array operations becomes much easier. No knowledge about the einsum function, about the dimensions of each involved array or their order are required.
Versatility: We offer different levels of flodym use: Users can choose to use the standard methods implemented for data read-in, system setup and visualization, or only use only some of the data types like
FlodymArray, and custom methods for the rest.Robustness: Through the use of Pydantic, the setup of the system is type-checked, highlighting errors early-on. The data read-in performs extensive checks on data sorting and completeness.
Performance: The use of numpy ndarrays ensures low model runtimes compared with dimension matching through pandas dataframes.
How to cite
If you use this software in publications, please cite our article in the Journal of Open Source Software:
@article{
Duerrwaechter2026,
author = {Dürrwächter, Jakob and Hosak, Merlin and Weiss, Bennet and Ueckerdt, Falko},
title = {flodym: A Python package for dynamic material flow analysis},
journal = {Journal of Open Source Software},
year = {2026},
doi = {10.21105/joss.10105},
url = {https://doi.org/10.21105/joss.10105},
publisher = {The Open Journal},
volume = {11},
number = {119},
pages = {10105}
}
flodym is based on the concepts of ODYM. Please consider also citing the according publication: Pauliuk & Heeren, 2020.
Contributing
Contribution instructions and development setup is documented in CONTRIBUTING.md.
How to report problems and get support
If you encounter a bug or unexpected behaviour, please open an issue on GitHub.
For questions and general support, use GitHub Discussions or contact jakob[dot]duerrwaechter[at]pik-potsdam.de.
Acknowledgements
We thank Stefan Pauliuk and the other contributors to ODYM, which forms the conceptual basis for flodym.
We gratefully acknowledge funding from the TRANSIENCE project, grant number 101137606, funded by the European Commission within the Horizon Europe Research and Innovation Programme, from the Kopernikus-Projekt Ariadne through the German Federal Ministry of Education and Research (grant no. 03SFK5A0-2), and from the PRISMA project funded by the European Commission within the Horizon Europe Research and Innovation Programme under grant agreement No. 101081604 (PRISMA).