on the discretization constructors, UpwindDifference and CenteredDifference
serval months ago @mjsheikh replied me on the use of UpwindDifference and RobinBC, thanks first.
In the documentation:
CenteredDifference{N}(derivative_order::Int,
approximation_order::Int, dx, len::Int, coeff_func=nothing)
dx: the spacing of the discretization. If dx is a Number, the operator is a uniform discretization. If dx is an array, then the operator is a non-uniform discretization. Its type needs to match the one from the Array to be differentiated. len: the length of the discretization in the direction of the operator.
However, this usage is relatively counterintuitive. When we have n points, we have n-1 intervals. But the constructor needs a dx including the intervals to the ghost points. But who knows the spacing between the first point and the left ghost point? So usually it is generated by:
dx = [x;(x[end]-x[end-1] - [-(x[[2]-x[1]);x]
then why don't we let the constructor do it? And does the distance between the ghost points and the first/last points matter?
It's just the spacing from the first/last interior point to the boundary.