Skip to main content
Version: Next

Config File

CLI Usage

This documentation page is intended for the Command Line Interface (CLI). If you're new to DuneCopasi, we recommend starting with our Tutorials.

To express different mathematical problems we typically write a configuration file (with .ini extension by convention) which entails all the information that is needed for the DuneCopasi solver to construct the problem at hand. The configuration file consists of a parameter tree containing the simulation options. The nodes at the top level can be divided in 4 categories:

CategoryDescription
gridThe nodes under the grid header describe the basic properties of the grid. For example the dimension, extension, origin, etc.
parser_contextUnder this node we are able to define constant and functions that can be used to define the mathematical model.
compartmentsIn this category we define the properties related to division of the problem to multiple compartments.
modelThis is the heart of the mathematical problem where we define the reaction terms, diffusion, etc.

The ini files we use follow the DUNE convention. In short, the data is composed of a key鈥搗alue pairs on the form key = value. For example, to define a property of the category grid we write

config.ini
grid.property = value

In essence the ini file is nothing else than a parameter tree of key-value pairs. For convenience one can use sections to avoid rewriting the leading part and provide more structure. This is done by using [section.subsection] syntax. The keys below will now be within the designated subsection. As an example, the three following ini files, are equivalent

config.ini
# No preceding section (everything after a '#' will be ignored)
section.subsection.first = 1.0
section.subsection.second = 2.0
Examples
heat.ini
#########################################################################
# HEAT EQUATION:
#
# 鈭傗倻u = 鈭傗倱(T路鈭傗倱u) + 鈭傖掸(T路鈭傖掸u)
#
# where u(x,y,t) is the temperature at a time t on the domain for a
# thermal conductivity T.
#
# See: https://en.wikipedia.org/wiki/Heat_equation
#
#########################################################################

[grid]
# extensions of the grid in x and y directions
extensions = 1 0.1
# where the grid left-bottom corner starts
origin = 0.0 0.0
# number of cells of the initial grid in x and y directions
cells = 10 1
# number of times to refine the grid
refinement_level = 5

# defines a compartment with the name "domain"
[compartments.domain]
expression = 1

# Define a constant with name "T" to use in the equations
[parser_context.T]
type = constant
value = 0.005

# our model is linear because there is no reaction
[model]
is_linear = true

##### Definition of the equation to solve function u(x,y,t) ######

# Declares the compartment where this function is defined
[model.scalar_field.u]
compartment = domain

# Declares that the equation is transient
[model.scalar_field.u.storage]
expression = 1

# Declares the diffusion part on the diffusion-reaction equation
[model.scalar_field.u.cross_diffusion.u]
expression = T

[model.scalar_field.u.initial]
# Declares the value of the function at the initial time: u(x,y,0)
# Try changing this to be a function of x and y: use "position_x" and "position_y"
# to represents its values, for example:
# "expression = position_x^2"
# represents the case where u(x,y,0) := x^2
# ...
# function for u(x,y,0)
expression = 10

# Declares the diffusion part on the diffusion-reaction equation
# Here we use the following ExprTk syntax to constraint the left and right parts of
# the compartment: "condition ? if_true : if_false"
# the "if_true" part contains the values set on the left and right boundaries
[model.scalar_field.u.constrain.boundary]
expression = (position_x <= 0. or position_x >= 1.) ? 0. : no_value
parser_type = ExprTk

[model.time_step_operator]
# initial time of the simulation
time_begin = 0
# final time of the simulation
time_end = 10