Learn R Programming

ReacTran (version 1.4.3.1)

setup.grid.2D: Creates a Finite Difference Grid over a Two-Dimensional Rectangular Domain

Description

Creates a finite difference grid over a rectangular two-dimensional model domain starting from two separate one-dimensional grids (as created by setup.grid.1D).

Usage

setup.grid.2D(x.grid = NULL, y.grid = NULL)

Arguments

x.grid

list containing the one-dimensional grid in the vertical direction - see setup.grid.1D for the structure of the list

y.grid

list containing the one-dimensional grid in the horizontal direction - see setup.grid.1D for the structure of the list

Value

a list of type grid.2D containing:

x.up

position of the upstream interface in x-direction (i.e. if x is vertical, the upper boundary); one value

x.down

position of the downstream interface in x-direction (i.e. if x is vertical, the lower boundary); one value

x.mid

position of the middle of the grid cells in x-direction; vector of length x.N

x.int

position of the interfaces of the grid cells in x-direction; vector of length x.N+1

dx

distance between adjacent cell interfaces in x-direction (thickness of grid cells); vector of length x.N

dx.aux

auxiliary vector containing the distance between adjacent cell centers; at the upstream and downstream boundary calculated as (x[1]-x.up) and (x.down-x[x.N]) respectively; vector of length x.N+1

x.N

total number of grid cells in the x direction; one value

y.left

position of the upstream interface in y-direction (i.e. if y us the horizontal, the left boundary); one value

y.right

position of the downstream interface in y-direction (i.e. if y us the horizontal, the right boundary); one value

y.mid

position of the middle of the grid cells in y-direction; vector of length y.N

y.int

position of the interfaces of the grid cells in y-direction; vector of length y.N+1

dy

distance between adjacent cell interfaces in y-direction (thickness of grid cells); vector of length y.N

dy.aux

auxiliary vector containing the distance between adjacent cell centers; at the upstream and downstream boundary calculated as (y[1]-y.up) and (y.down-y[y.N]) respectively; vector of length y.N+1

y.N

total number of grid cells in the y direction; one value

See Also

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

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

setup.prop.2D for defining properties on the 2-D grid.

Examples

Run this code
# NOT RUN {
# test of the setup.grid.2D functionality
x.grid  <- setup.grid.1D(x.up = 0, L = 10, N = 5)
y.grid  <- setup.grid.1D(x.up = 0, L = 20, N = 10)
(grid2D <- setup.grid.2D(x.grid, y.grid))

# }

Run the code above in your browser using DataLab