Deterministic Population Dynamics
Authors/Creators
Description
The model
This program simulates deterministic May-Leonard population dynamics of \(\mathtt{N_S}\) species. The system is described by \(\mathtt{N_S} \) non-linear differential equations and a constraint equation given by
\( \dot\phi_i = D\,\nabla^2\phi_i + r\,\phi_0\,\phi_i - p\,\phi_i\,\phi_j \, ,\)
\( \phi_0 = 1-\sum_{i=1}^{N_S}\phi_i \, .\)
The scalar fields \(\phi_i\) are fraction occupied by species \(i\) on the grid, while \(\phi_0\) is the portion of empty space left by selection. The parameters ( \(D\), \(r\), \(p\)) are the diffusion, reproduction and predation/selection rates, which are set equal to all species.
Code parameters: \(\mathtt{params.h}\)
The simulation happens in a grid of size \(\mathtt{L^{Dm}}\) with \(\mathtt{Dm}\) dimensions (\(\mathtt{Dm=1, 2, 3} \)), with \(\mathtt{N_X^{Dm} = (dx\cdot L)^{Dm}}\) discretized points, over a period \(\mathtt{T}\) with \(\mathtt{N_T = dt\cdot T}\) discretized time-loops, where \(\mathtt{dx}\) and \(\mathtt{dt}\) are the grid-spacing and the time interval.
At the initial condition, the \(\mathtt{N_S}\) species are setting by random, covering all grid space with values \([0:1]\), thus \(\phi_0(t=0) = 0\). The parameter \(\mathtt{seed}\) initializes the random distribution.
The fields output are recorded into \(\mathtt{N_F}\) files. For \(\mathtt{Dm = 1,3}\) we will obtain only the empty space field \(\phi_0\) , but for \(\mathtt{Dm=2}\) the species fields \(\phi_i\) are also shown since the species dynamic patterns in two-dimensions are better suited to qualitative analysis. The \(\mathtt{th}\) parameter is the \(\phi_0\) threshold to be considered in the snapshot – once all scalar fields cover the whole grid space.
Scheme of selection: \(\mathtt{params.h}\)
The scheme of selection between species is portrayed in an \(\mathtt{N_S\times N_C}\) array called \(\mathtt{scheme}\) . The parameter \(\mathtt{N_C}\) is the number of column of the scheme which depends on the number of selections. The arrange is the following:
• The first column establishes the species in the grid;
• The second column and followings establish those that will be selected
by the species of the first column;
• If one species selects fewer individuals than other species, set 0 to
complete the scheme.
For instance, in \(\texttt{scheme[2][2] = \{\{1,2\}, \{2,1\}\}}\) species 1 selects 2, and species 2 selects 1. For\(\texttt{scheme[3][3] = \{\{1,2,3\}, \{2,1,0\}, \{3,2,0\}\}}\), species 1 selects 2 and 3, species 2 selects 1, and species 3 selects 2. For spiral structures, \(\texttt{scheme[4][3] = \{\{1,2,3\}, \{2,3,4\}, \{3,4,1\}\}, \{4,1,2\}\}}\).
Program requirements
• gcc compiler: to compile the code that is written in C language;
• GSL – GNU Scientific Library: for random number generator;
• Gnuplot: to produce snapshots.
Summary
The directory program presents:
• \(\mathtt{params.h}\): parameters responsible by grid shape and time interval,
behaviour rates and the scheme of selection array;
• \(\mathtt{global.h}\): constant parameters;
• \(\mathtt{main.c}\): the code main part where the set of equations are solved by
using Runge-Kutta fourth-order;
• \(\mathtt{alloc.c}\): to perform vectorial dynamical allocation;
• \(\mathtt{ic.c}\): initial conditions;
• \(\mathtt{output.c}\): output of scalar fields;
• \(\mathtt{laplacian.c}\): Laplacian operator second-order.
• \(\mathtt{grid.plt}\): Gnuplot script to produce snapshots;
• \(\mathtt{makefile}\): files compilations;
• \(\mathtt{run.sh}\): Shell-script to run the code.
Files
Files
(3.6 kB)
| Name | Size | |
|---|---|---|
|
md5:f3812c36ace3e7f80a5f26a9f67d3c58
|
3.6 kB | Download |
Additional details
Related works
- Has part
- 10.1142/s1793962318500460 (DOI)