setup.prop.1D: Attaches a Property to a One-Dimensional Grid

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This routine calculates the value of a given property at the middle of the grid cells (mid) and at the interfaces of the grid cells (int).

Two possibilities are available: either specifying a mathematical function (func) that describes the spatial dependency of the property, or obtaining the property from interpolation of a data series (via the input of the data matrix xy).

For example, in a sediment model, setup.prop.1D can be used to specify the porosity, the mixing intensity or some other parameter over the one-dimensional grid. Similarly, in a vertical water column model, setup.prop.1D can be used to specify the sinking velocity of particles or other model parameters changing with water depth.

Usage

1
2
3
4
5
setup.prop.1D(func = NULL, value = NULL, xy = NULL,
              interpolate = "spline", grid, ...)

## S3 method for class 'prop.1D'
plot(x, grid, xyswap = FALSE, ...)

Arguments

func

function that describes the spatial dependency. For example, one can use the functions provided in p.exp

value

constant value given to the property (no spatial dependency)

xy

a two-column data matrix where the first column (x) provides the position, and the second column (y) provides the values that needs interpolation over the grid

interpolate

specifies how the interpolation should be done, one of "spline" or "linear"; only used when xy is present

grid

list specifying the 1D grid characteristics, see setup.grid.1D for details on the structure of this list

x

the object of class prop.1D that needs plotting

xyswap

if TRUE, then x- and y-values are swapped and the y-axis is oriented from top to bottom. Useful for drawing vertical depth profiles

...

additional arguments that are passed on to func or to the S3 method

Details

There are two options to carry out the data interpolation:

Value

A list of type prop.1D containing:

mid

property value in the middle of the grid cells; vector of length N (where N is the number of grid cells)

int

property value at the interface of the grid cells; vector of length N+1

Author(s)

Karline Soetaert <karline.soetaert@nioz.nl>, Filip Meysman <filip.meysman@nioz.nl>

See Also

tran.1D, for a discretisation of the general transport equation in 1-D

setup.grid.1D, the creation of grids in 1-D

setup.prop.2D for defining properties on 2-D grids.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Construction of the 1D grid 

grid <- setup.grid.1D(x.up = 0, L = 10, N = 10)

# Porosity profile via function specification

P.prof <- setup.prop.1D(func = p.exp, grid = grid, y.0 = 0.9,
                        y.inf = 0.5, x.att = 3)

# Porosity profile via data series interpolation

P.data <- matrix(ncol = 2, data = c(0,3,6,10,0.9,0.65,0.55,0.5))
P.spline <- setup.prop.1D(xy = P.data, grid = grid)
P.linear <- setup.prop.1D(xy = P.data, grid = grid, interpolate = "linear")

# Plot different profiles 

plot(P.prof, grid = grid, type = "l",
     main = "setup.prop, function evaluation")
points(P.data, cex = 1.5, pch = 16) 
lines(grid$x.int, P.spline$int, lty = "dashed")
lines(grid$x.int, P.linear$int, lty = "dotdash")

ReacTran documentation built on May 2, 2019, 9:38 a.m.