Skip to main content
Version: v2.1.0

Command Line Interface Usage

Installation Guide

Check out our Installation Documentation to find the optimal way to install dune-copasi and access the Command Line Interface!

CLI on the Web Browser

If you're interested in exploring and using the Command Line Interface (CLI) without installation, you're in luck! The Web Browser executable allows you to interact with the CLI directly from any device. No setup required—just open your browser and start experimenting!

In this form, we provide one executable named dune-copasi for running forward simulations from the command line. This executable is completely configurable from the command line arguments passed to it.

Configuration options​

By running the program with the command line arguments --help or --help-full, it will result in the possible configuration options to run the program:

Command Line Interface of DuneCopasi
~$ dune-copasi --help
USAGE: dune-copasi [options]

Numerical simulator for diffusion-reaction systems on single or multiple compartments

Website: <https://dune-copasi.netlify.app>

OPTIONS:

-h / --help - Display this help.
--help-full - Display this help with long descriptions.
--version - Display the version of this program.
--parser-default - Display the default parser.
--parser-list - Display the parsers available for this program.
--dimension-list - Display the grid dimensions available for this program.
--dump-config - Dumps configuration in the INI format to stdout.
--config=<string> - Specifies a config file in INI format. See Configuration Options.
--{key}={value} - Overrides key=value sections of the config file. See Configuration Options.

...
~$

Configuration Options

For more information on the possible options to successfully run a simulation, make sure to visit the Configuration Options, and the Tutorials documentations!

Version​

By running the program with the command line argument --version, you can find out the installed version of DuneCopasi:

Getting DuneCopasi version
~$ dune-copasi --version
2.1.0
~$

Running the program​

By parsing a initialization file config.ini to the DuneCopasi solver it will exactly know how to construct the problem and the simulation will be started. Once it finished you should get the message dune-copasi successfully finished :) by the end simulation logs.

configuration file example

Having installed we are now set to test the DuneCopasi solver. To do this we will create a simple initialization file. We write the code of the minimal example to the file config.ini:

~/workdir/config.ini
[grid]
dimension = 2
extensions = 2 2
origin = -1 -1
refinement_level = 5

[compartments.domain]
type = expression
expression = 1

[model.scalar_field.u]
compartment = domain
cross_diffusion.u.expression = 0.005
initial.expression = exp(-(position_x^2+position_y^2+position_z^2)/(4*0.005)) / (4*3.14159265359*0.005)
storage.expression = 1

[model.time_step_operator]
time_begin = 1
time_end = 4

In case of the example above, you have just set up the heat equation with an initial Gaussian distribution (it doesn't save it though).

Running DuneCopasi
~/workdir$ dune-copasi --config=config.ini
[2024-03-21 12:38:32.479] [info] Reading configuration file '~/workdir/config.ini'
[2024-03-21 12:38:32.479] [info] Starting dune-copasi (version: 2.0.0)
[2024-03-21 12:38:32.580] [info] Axis names are set to: ["x", "y", "z"]
...
...
[2024-03-21 12:38:32.723] [info] dune-copasi successfully finished :)
~/workdir$

Note that the output files produced by DuneCopasi are relative to the directory where dune-copasi is started, hence, it is recommended to run the program within a working directory, for example ~/workdir.

Simulation Failed?

A failed simulation may look instead like this:

Running DuneCopasi (failure)
~/workdir$ dune-copasi --config=config.ini
[2024-03-21 12:38:32.479] [info] Reading configuration file '~/workdir/config.ini'
[2024-03-21 12:38:32.479] [info] Starting dune-copasi (version: 2.0.0)
[2024-03-21 12:38:32.580] [info] Axis names are set to: ["x", "y", "z"]
...
...
[2024-03-21 12:38:32.723] [error] Dune reported error:
[2024-03-21 12:38:32.723] [error] Message: Basis has dimension 0, make sure to have at least one 'scalar_field' with a non-empty 'compartment'
[2024-03-21 12:38:32.723] [error] Exception type: Dune::InvalidStateException
[2024-03-21 12:38:32.723] [error] dune-copasi finished with some errors :(
~/workdir$

If your simulation failed, it's worth to ask yourself the following questions:

  • What are the contents of your configuration options and what's the expected behavior?
  • What are the warning and error logs provided by program? Do they give you hints on how to solve the problem?
  • What is stage of the simulation where the problem failed?

In particular, remember that providing no configuration options gives an invalid simulation (what would be the simulation for this?), therefore the program rightfully fails.