View source: R/flownet_finitedifferences.R
findiff_sparse_elements_realonly | R Documentation |
Function generates rows, column and values for sparse matrix to get a first order approximation of values for all real nodes in a regularly spaced, rectangular grid in either the x or y direction.
The function assumes a regular, square grid where nodes are numbered row-first. The grid does not contain any ghost nodes. The grid has a size 1*1.
For a 4*3 grid, the numbering is:
ix=1 | ix=2 | ix=3 | ix=4 | |
iy=3 | 9 | 10 | 11 | 12 |
iy=2 | 5 | 6 | 7 | 8 |
iy=1 | 1 | 2 | 3 | 4 |
The finite difference approximation is of the second order (central differences). When only real nodes are used and the node lies on an edge, a second order approximation is used (forwards or backwards, depending on the position)
findiff_sparse_elements_realonly( nx, ny, direction, i0 = 0, multiplier = 1, ... )
nx, ny |
number of real nodes in x and y-directions. There need to be
at least 3 (real or ghost) nodes in the direction of differentiation,
or 4 in case 2nd order differentiation is requested with
|
direction |
direction of differentiation
|
i0 |
optional index offset for node offset |
multiplier |
optional multipliers for all values in the finite difference matrix to differentiate real nodes |
... |
potential extra arguments |
a tibble with node indices for row (row
), column (col
) and
value (val
) columns of non-zero entries in the matrix
findiff_sparse_elements_realonly(9, 5, "y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.