simpgs {RGeostats}R Documentation

Plurigaussian Conditional Simulations

Description

Plurigaussian conditional simulations

Usage

simpgs(dbin = NA, dbout, dbprop = NA,
rule = rule.input(), model1 = NA, model2 = NA, 
neigh=neigh.input(),props = NA, domain=0,
flag.res=TRUE,flag.gaus = FALSE, 
flag.prop=FALSE, flag.check=FALSE, flag.show = FALSE, seed = 232131, 
nbsimu = 1, nbtuba = 100, nboot = 10, niter = 100, percent=0.1, toleps=1, 
delta = NA, accept.fun = NA, accept.nloop.max = 10, accept.verbose=TRUE,
radix = "SimPGS", modify.target = db.locmod())

Arguments

dbin

The db-class structure containing the data file. If not provided, non-conditional simulations are performed

dbout

The db-class structure which will contain the simulation outputs

dbprop

The db-class where the proportion variables must be located in the non-stationary case. See details in rule.check.

rule

The rule-class structure which defines the Lithotype rule

model1

The model-class structure containing the Model information for the first underlying gaussian random function. This model must be provided if the first gaussian random function is involved in the Lithotype rule.

model2

The model-class structure containing the Model information for the second underlying gaussian random function. This model must be provided if the second gaussian random function is involved in the Lithotype rule

neigh

The neigh-class structure containing the Neighborhood information. Only the Unique or Bench neighborhoods are authorized.

props

Array giving the (constant) proportions of the different facies involved in the Lithotype rule. See details in rule.check.

domain

When (strictly) positive, it corresponds to the reference domain value. If a Db attribute is defined as a Domain variable in a Db file, a sample will be selected only if the corresponding Domain variable is equal to the reference domain value. This Domain selection can serve as a secondary selection for the sample in the Input Db or as a mask in the Output Db.

flag.res

When TRUE, the procedure returns results in the Output Db. When FALSE, the procedure returns results in the Input Db

flag.gaus

When FALSE, the simulation outcome is coded into facies. When TRUE, the (conditional) simulation is kept in the gaussian scale

flag.prop

When TRUE, the procedure returns the proportion of facies, rather than the simulations

flag.check

When TRUE (and if dbin is defined and flag.res), the facies of conditioning data is compared to the facies of the closest grid node.

flag.show

When TRUE (and if dbin is defined and flag.res), the grid node which coincides with a data is represented with the data facies (with a negative sign).

seed

Seed used for the generation of random numbers. When 0, the seed is not initialized.

nbsimu

Number of simulations

nbtuba

Number of turning bands

nboot

Number of iterations performed for bootstrap

niter

Maximum number of iterations for calculating the conditional expectation

percent

Amount of nugget effect added to the model if this initial model only contains Gaussian structures. If set to zero, the initial model is kept unchanged. This amount is defined as a percentage of the global variance.

toleps

Relative difference between the previous and the new value at a sample location below which the sample is considered as immobile

delta

Spatial distance for generating the replicates in case of conditional simulations for shadow option.

accept.fun

An acceptation function. See details for more information.

accept.nloop.max

Maximum number of iterations before 'nbsimu' acceptable simulation outcomes is reached.

accept.verbose

When TRUE, the activity of the acceptation function is echoed.

radix

Radix of the name given to the simulation outcomes stored in the output Db.

modify.target

Decides whether or not the newly created variables will have their locator defined or not. For more information, see db.locmod.

Value

The data Db where the simulations outcomes have been added.

Examples

# Acceptation function #
accept <- function(db,iatt) 
{
                                        # Locations of wells in the grid #
  ranks = c(5021, 5081)

                                        # Perform the Connected components #
  a = db
  a = db.locate(a,iatt,"z")
  a = morpho(a,1,2,oper="cc")

                                        # Do all wells belong to same CC #
  test = TRUE
  cc = a[ranks[1],a$natt]
  for (i in 1:length(ranks))
    if (cc != a[ranks[i],a$natt]) test = FALSE
  test
}

# Perform a conditional simulation of facies #
nbsimu = 25
grid   = db.create(nx=c(100,100))
model  = model.create(vartype="Cubic",range=30)
rule   = rule.create(c("S","F1","F2"))
x1 = c(20,80,50)
x2 = c(50,50,50)
z1 = c(1,1,2)
data=db.create(x1=x1,x2=x2,z1=z1)
neigh = neigh.create(type=0)

grid = simpgs(data,grid,rule=rule,model1=model,neigh=neigh,
       accept.fun=accept,nbsimu=nbsimu,nbtuba=1000)
grid = db.compare(grid,names="SimPGS*",fun="mean")
plot(grid,title="Connectivity probability",pos.legend=1)
plot(data,add=TRUE,name.post=1,pch=19,col=c("yellow","red")[z1])

rm(grid,model,rule,data,neigh,nbsimu,accept,x1,x2,z1)

[Package RGeostats version 11.0.6 Index]