create.stones {SoPhy}R Documentation

Simulation of stones

Description

This function simulates stones within a profile according to a given soil definition. The algorithm returns an intermediate stage of the random sequential adsoption (RSA) model.

Usage

create.stones(h, trials = 10)

Arguments

h a list of the same format as the output of xswms2d
trials parameter for the number of trials after which the simulation for a horizon terminates and a warning is given. The number of trials equals, for each horizon, trials times the Poisson random number of stones to simulate, see also Details.

Details

In the simulation, each horizon is considered separately in the ordering they are defined. The ordering is important in case the stones are allowed to reach into neighbouring horizons. For each horizon:

  1. a Poisson number p of stones is drawn with mean h$stone$lambda times modulus of the area of the horizon [in the given units].
  2. while not all p points are simulated and the total number of trials for the horizon is less than trials times p:

    1. within the rectangle that is given by cut.x and cut.y and that encloses the area of the horizon a uniformly distributed point P is draw. If the point is outside the horizon, the drawing is repeated, up to trials times. If still not successful, the simulaton for a horizon terminates, a warning is given, the stones simulated up to now are kept and the next horizon is simulated.
    2. According to
      $stone$phi.distr, $stone$phi.mean, $stone$phi.s,
      $stone$main.distr, $stone$main.mean, $stone$main.s,
      $stone$sec.distr, $stone$sec.mean, and $stone$sec.s,
      an ellipse is simulated with centre P. The length of the main axis is given by a random variable with distribution stone$main.distr, mean parameter $stone$main.mean and standard deviation $stone$main.s. The length of the secondary axis and the angle between the main axis and the horizon are given in a similar way.
    3. The pixels that are covered by the ellipse are determined.
    4. The ellipse including P is rejected in the following cases

      1. x $stone$no.overlap is TRUE and any of the pixels belong already to a stone
      2. $stone$no.lower is TRUE and any pixel belongs to a horizon or polygon that precedes the current one.
      3. $stone$no.upper is TRUE and any pixel belongs to a horizon or polygon that follows the current one.

  3. if the total number of trials is reached without having p points, the algorithm fails.

Value

The function returns the input argument h except that h$idx.rf and h$Stone.RF have been updated.

$idx.rf gives, at first instance, the association of a pixel to a horizon (0,...,h$n-1). If the pixel belongs to one or more stones the value of the maximum number of horizons is added.
$Stone.RF RF, modified at the locations with stones according to the h[[...]]$stone$values.

Author(s)

Martin Schlather, martin.schlather@math.uni-goettingen.de http://www.stochastik.math.uni-goettingen.de/institute

References

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

Stoyan, D., Kendall, W.S., Mecke, J. (1995) Stochastic Geometry and its Applications Chichester: Wiley, 2nd edition.

RSA model (also called SSI process in stochastic geometry)

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 <- simulateHorizons(h)
h$H1$stone$lambda <- 0.002       ## in average 20 stones 
h$H1$stone$no.overlap  <- FALSE ## allow for overlapping stones
for (i in 1:5) {
  plotRF(create.stones(h), what="Stone") 
  readline("Press return")
}

[Package SoPhy version 1.0.34 Index]