Miniker 102 manual: 3.9 Entering model size explicitely

[ < ] | [ > ] |  | [Contents] | [Index] | [ ? ]

## 3.9 Entering model size explicitely

It is possible to enter the model dimensions explicitely, instead of generating them automatically, as it was done previously. This feature is turned on by `sel dimetaphi` in ‘`selseq.kumac`’ with cmz and `dimetaphi` added to the `SEL` variable in the ‘`Makefile`’ with make.

[ < ] | [ > ] |  | [Contents] | [Index] | [ ? ]

### 3.9.1 The explicit size sequence

The dimension of the model is entered in the sequence ‘`dimetaphi`’, using the fortran `parameter np` for `eta(.)` and `mp` for `ff(.)`. For the Lotka-Volterra model, we have two cell components and only one transfer.

    parameter (np=2,mp=1);

You should not change the layout of the parameter statement as the mortran preprocessor matches the line.

You also have to provide other parameters even if you don’t have any use for them. If you don’t it will trigger fortran errors. It includes the `maxstep` parameter that can have any value but 0, `lp` and `mobs` that should be 0 in the example, and `nxp`, `nyp` and `nzp` that should also be 0. The layout is the following:

    parameter (np=2,mp=1);
    parameter (mobs=0);

    parameter (nxp=0,nyp=0,nzp=0);
    parameter (lp=0);
    parameter (maxstep=1);

If there are observations, (see Observations), the size of the observation vector is set in the ‘`dimetaphi`’ sequence by the `mobs` parameter. For example if there is one observation:

    parameter (mobs=1);

To specify parameters (see Parameters), the number of such parameters has to be declared in ‘`dimetaphi`’ with the parameter `lp`. Then, if there are two parameters, they are first declared with

    parameter (lp=2);

[ < ] | [ > ] |  | [Contents] | [Index] | [ ? ]

### 3.9.2 Entering the model equations, with explicit sizes

When sizes are explicit, another possibility exists for entering the model equations. The use of symbolic names, as described in Model equations is still possible, and it also becomes possible to set directly the equations associated with the `eta(.)` and `ff(.)` vectors.

In case the symbolic names are not used, the model equations for cells and transfers are entered using a mortran macro, `f_set`(4), setting the `eta(.)` evolution with `deta_tef(.)` and the transfer definitions `ff(.)` with `Phi_tef(.)`.

Macro: f_set Phi_tef(i) = f(eta(.),ff(.))

  This macro defines the transfer i static equation. `f` is a fortran expression which may be function of cell state variables, ‘`eta(1)`’…‘`eta(np)`’ and transfers ‘`ff(1)`’…‘`ff(mp)`’.

In the case of the predator-prey model, the transfer definition for φmeet is:

    f_set Phi_tef(1) = eta(1)*eta(2);

Macro: f_set deta_tef(i) = g(eta(i),ff(.))

  This macro defines the cell state component i time evolution model. `g` is a expression which may be function of cell state variables, ‘`eta(1)`’…‘`eta(np)`’ and transfers ‘`ff(1)`’…‘`ff(mp)`’.

The two cell equations of the predator-prey model are, with index 1 for the prey ( ηprey) and index 2 for the predator ( ηpred):

    f_set  deta_tef(1) = apar*eta(1)-apar*ff(1);
    f_set  deta_tef(2) = - cpar*eta(2) + cpar*ff(1);

The whole model is:

    !%%%%%%%%%%%%%%%%%%%%%%
    ! Transfer definition
    !%%%%%%%%%%%%%%%%%%%%%%
    ! rencontres (meeting)
        f_set Phi_tef(1) = eta(1)*eta(2);

    !%%%%%%%%%%%%%%%%%%%%%%
    ! Cell definition
    !%%%%%%%%%%%%%%%%%%%%%%
    ! eta(1) : prey
    ! eta(2) : predator

        f_set  deta_tef(1) = apar*eta(1)-apar*ff(1);
        f_set  deta_tef(2) = - cpar*eta(2) + cpar*ff(1);

The starting points for cells are entered like:

    !     initial state
    !     -------------
         eta(1) = 1.;
         eta(2) = 1.;

If there are observations, they are entered as special transferts with index above `mp`, for example:

    f_set Phi_tef(mp+1) = ff(1) ;

[Contents] | [Index] | [ ? ]

This document was generated by a tester on a sunny day using texi2html.