# 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

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

### Arguments

`x.grid ` |
list containing the one-dimensional grid in the vertical
direction - see |

`y.grid ` |
list containing the one-dimensional grid in the horizontal
direction - see |

### 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.int ` |
position of the interfaces of the grid cells in x-direction;
vector of length |

`dx ` |
distance between adjacent cell interfaces in x-direction
(thickness of grid cells); vector of length |

`dx.aux ` |
auxiliary vector containing the distance between adjacent
cell centers; at the upstream and downstream boundary calculated as
( |

`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.int ` |
position of the interfaces of the grid cells in y-direction;
vector of length |

`dy ` |
distance between adjacent cell interfaces in y-direction
(thickness of grid cells); vector of length |

`dy.aux ` |
auxiliary vector containing the distance between adjacent
cell centers; at the upstream and downstream boundary calculated as
( |

`y.N ` |
total number of grid cells in the y direction; one value |

### Author(s)

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

### 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

1 2 3 4 | ```
# 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))
``` |