Summary and Schedule
This lesson is intended for people who would like to combine several computational models into one big computational model. It covers the theory behind model coupling and teaches application via use of two different model coupling frameworks: MUSCLE3 and AMUSE.
Setup Instructions | Download files required for the lesson | |
Duration: 00h 00m | 1. Introduction to model coupling |
What is meant by a “model”? What is the difference between a mathematical model and a computational model? What is model coupling? Why would we want to couple simulation models? |
Duration: 00h 50m | 2. Model coupling theory: the Multiscale Modelling and Simulation Framework |
When coupling models together, how do you figure out which information needs to be exchanged when? How does that depend on the spatial and temporal scales of the simulated processes? What does that mean for how submodels should be implemented? |
Duration: 01h 35m | 3. MUSCLE3 - connecting a model to MUSCLE | How do you connect an existing python model code to MUSCLE3? |
Duration: 02h 35m | 4. MUSCLE3 - coupling and running |
How do you couple multiple sub-models using MUSCLE3? How do you run a coupled simulation with MUSCLE3? |
Duration: 03h 20m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Setup
Please perform this setup before you start with the first episode.
MUSCLE3
Installing MUSCLE3 on Python will install all the Python-based components of the system, i.e. the Python version of libmuscle, the YMMSL Python library, and the MUSCLE Manager. This requires at least Python 3.6.
MUSCLE3 is on PyPI as an ordinary Python package, so it can be installed via Pip in the usual way. It’s normally a good idea to make a virtual environment (virtualenv), if you don’t yet have one:
BASH
python3 -m venv muscle3_venv
. muscle3_venv/bin/activate
pip install -U pip setuptools wheel
pip install muscle3
pip install matplotlib
This will create a Python virtualenv in a directory named muscle3_venv in your home directory, and then activate it. This means that when you run Python, it will use the version of Python in the virtual environment, and see the packages you have installed there. Of course, you can put it wherever you want it.
Next, we upgrade pip, the Python package installer (most systems have an old version, and old versions sometimes give problems), setuptools (same thing) and we install wheel (which can cause packages to fail to install if it’s not there).
Having made a good environment, we can then install MUSCLE3 inside of it. Once that’s done, you can use MUSCLE3 whenever you have the virtualenv activated. This will also install the Python YMMSL library, and any required dependencies.
Conda users beware: due to a bug in Anaconda, one of the dependencies of MUSCLE3 cannot be installed using pip
in the Conda base environment. So, if you want to use Conda instead of virtualenv, you need to either make a separate Conda environment, and then pip install as described above, or, if you want to use the base environment anyway, do conda install -c conda-forge yatiml
and then pip install muscle3 as above.
Files
The exercises in this course use several prepared files, which you should download and unpack.