create.roots {SoPhy} | R Documentation

## Simulation of roots

### Description

This function generates root systems within a profile according to a given specification of the soil and the root model.

### Usage

    create.roots(h, trials = 10, PrintLevel=RFparameters()$PrintLevel,
                             message=NULL)

### Arguments

`h` | a list of the same format as the output `xswms2d`, see there for a description of the components.
`trials` | number of trials to find a realisation of the plant positions (by a trial and error algorithm) where the distances have a distance of at least `$plants.mindist`.
`PrintLevel` | The higher the value the more tracing information is given; up to value 2, no information is given. Note that if `PrintLevel>2` a running counter is shown that includes the printing of backspaces (^H). The backspaces may have undesirable interactions with some few other R functions, e.g. `Sweave`. See package RandomFields for the default option `RFparameters``()$Print`.
`message` | function with one parameter (string). The function is used to plot messages.

### Details

The simulation algorithm works currently as follows.

1. For each plant type and according to `$plants.lambda` a Poisson random variable is drawn which gives the number of plants of this type. The starting points of the plants are created successively where the horizontal positions are uniformly distributed over the profile. The vertical position of the starting point is 1 plus the vertical position of the first pixel that is not air at the drawn horizontal pixel. If the simulated horizontal distance has distance less than `$plants.mindist` to any other plant of this type, the horizontal distance is redrawn up to `trials` - 1 times. If still not successful the last drawn position is taken.
2. In the second step the root growth is simulated, for each plant separately and independently. For each plant the following steps are iterates until or root segments have stopped growing or the aimed total root length has been reached. In each step a list of active root segments is considered that is ordered with respect to some priority value v
   1. The root with the highest priority stops growing with probability `$stop.probab`. If this happens this root segment is dropped from the list. This step is repeated until the list is void (then the simulation of the root system is terminated) or the growth does not stop.
   2. The list p of neighbours of the selected root is determined. Out of the 8 potential neighbours only those are selected which do not leave the profile and that do not entre free air or a stone. In case `no.own.root` is `TRUE` the neighbouring pixel may also not be a already simulated segment of the current root system.
   3. The priority number of the remaining potential new root segments is a sum of the following values
      1. the direction change from previous segment to current to next is calculated (separately for x and y coordinate); this value is the mean and the standard deviation (up to `$dir.ch.s`) of a Gaussian random variable.
      2. `$depth.bonus` or `$side.bonus` if the neighbouring pixel will be in one of the three pixels in vertical direction or in one of the two horizontal directions.
      3. `$rf.link` function value for `rf` that can be interpreted as water availability of soil quality.
   4. if the distance to the previous knot is greater than `knot.mindist` then the current root segment is a knot with probility `$knot.probab`.

      The number of children is determined both by the number of available neighbouring pixels and the values of `shoots.4` and `shoots.3`.

   5. The lengths of the root segments to be added are calculated. If then the aimed total length is exceeded, (biased) coins are thrown which of the neighbouring pixels are kept
   6. The remaining children/neighbouring pixels are added to the list of active root segments; The current, selected root segment is deleted from the list.
   7. The priority of root segments that have already been created in former steps are multiplied by `$age.bonus`.

### Value

The function returns the input argument `h` except that `h$plants`, `h$plant.idx` and `h$rf` have been updated.

`$plants` | is a list of simulated plants where each components contains the positions of the roots. The latter is given by a matrix of 8 columns: horizontal coordinate of a root segment. The coordinate is given in pixels. vertical coordinate of a root segment, For the first pixel it is 1 plus the vertical position of the first pixel that is not air at the drawn horizontal pixel. index for the parent root pixel index where the subsequent root pixel is found; `NA` if it is a terminating root segment. If the pixel is a knot with k children then the value gives the position of the first child, the others follow immediately. number of children in case it is a knot, 1 otherwise the number of preceding knots until and including this position aimed random total length of the roots if it is the first pixel, and the current distance to the surface along the roots, otherwise. distance to the preceding knot
`$plant.idx` | vector or `NULL`. `h$plant.idx[i]` gives the plant type (1,...,`plant.types`) of the `i`th simulated plant.
`$Root.RF` | `$Stone.RF` modified as follows: if `h$root[[i]]$rf.Kf` is `TRUE` then the locations of the roots of plant type i get the value of the function `h$Kf`.

### Author(s)

Martin Schlather, schlath@hsu-hh.de http://www.unibw-hamburg.de/WWEB/math/schlath/schlather.html

### References

Schlather, M. and Huwe, B. (2006) Modelling inhomogeneous soils: Theory. In preparation.

### See Also

`SoPhy`, `xswms2d`

### Examples

    ## get a standard definition first
    h <- xswms2d(xlim=c(1, 100), ylim=c(1, 100), step=1, new=NULL)
    h$root[[1]]$plants.lambda <- 0.02
    h <- simulateHorizons(h)
    for (i in 1:5) {
      plotRF(create.roots(h), cex.pch=0.5, pch=16, root.col=1)
      readline("Press return")
    }

[Package SoPhy version 1.0.28 Index]