db.diffusion {RGeostats} | R Documentation |

Calculate the diffusion coefficient over coarse cells

db.diffusion(dbgin, dbgout, orient=0, niter=100, nseed=100, seed=43243, verbose=FALSE, radix = "Diffusion", modify.target = db.locmod())

`dbgin` |
The |

`dbgout` |
The |

`orient` |
Diffusion orientation: 0 for Euclidean distance, 1 for distance along X, 2 for distance along Y and 3 for distance along Z. Its value must be consistent with the Space Dimension of the Input Grid Db. |

`niter` |
Number of time iterations for the random walk |

`nseed` |
Number of independent trajectories. |

`seed` |
Seed used to initialze the random number generator. When 0, the seed is not initialized. |

`verbose` |
Verbose option |

`radix` |
Radix of the name given to the upscaled variable. |

`modify.target` |
Decides whether or not the newly created variables will have their
locator defined or not. For more information, see |

The principle is to calculate the average diffusion coefficient over a set of coarse cells (of the output Db Grid) starting from the information provided on small cells (of the input Db Grid). Each fine cell contains a real value which could be:

either 1 for porous medium or 0

or a positive value such that the largest value corresponds to the most porous medium.

Each coarse cell is treated separately.

The idea is to perform a Monte-Carlo simulation in order to derive the upscaled diffusion coefficient. The principle is to launch a series of independent particles which follow a Brownian motion within the cell At each time iteration, we simply calculate the euclidean distance between the initial and the final locations for each particle. We finally establish the regression of the average of these squared distances as a function of the iteration rank. When this regression becomes linear, the slope of this linear regression (up to a scaling coefficient) provides the diffusion coefficient.

For each time lag, each particle may move to the neighboring location, according to the neighboring option, i.e. (for the 2-D case):

0 +X -X +Y -Y

1 +X -X +Y -Y +X+Y +X-Y -X+Y -X-Y

The user can choose this option by:

set.keypair("Diffusion.Converge.Morpho",0)

He may also specify that the particle MUST move (cannot stay at the same location) at each iteration:

set.keypair("Diffusion.Converge.Center",1)

If the user wishes to check the convergence used to calculate the diffusion coefficient from the Monte-Carlo simulation, he may examine the behavior of the regression on a target cell (starting from 1) by:

set.keypair("Diffusion.Converge.Block",0)

The estimation of the Slope and Intercept is determined based on a the values for a given range of iteration ranks. Note that the calculations are performed from the largest to the lowest ranks. Finally the Slope assigned to each output cell is calculated at a given iteration (defined by its percentage with respect to the total number of iterations), 75

set.keypair("Diffusion.Converge.PMid",75)

The results (as a function of the iteration) are provided as a matrix (Nrow = niter; Ncol = 3) and can be loaded by using:

get.keypair("Diffusion.Converge")

The first column corresponds to the mean squared distance, the second column to the diffusion coefficient and the third column to the origin of the linear regression (of squared distance versus iteration).

[Package *RGeostats* version 11.1.2 Index]