DiffEqOperators.jl
DiffEqOperators.jl copied to clipboard
fornberg(2020) weights based on hermite-based finite difference
As per discussion earlier today with @ChrisRackauckas on slack, this PR extends DiffEqOperators.calculate_weights
function to include recent algorithm of hermite-based finite difference weights by fornberg(2020)
- The original fornberg(1988) algorithm is invoked by default. (Earlier state of
DiffEqOperators.calculate_weights
function..no changes here!) - To invoke hermite-based FD fornberg(2020), one just needs to pass kwarg
dfdx = true
to theDiffEqOperators.calculate_weights
function, thus, returning the weights/stencil for function values and weights/stencil for the first-derivative values of the function respectively.
This algorithm uses same matrix of weights generated from fornberg(1988) algorithm to generate new set of weights.
Corresponding tests for both cases are added, and docstrings are also updated.
I do not yet know how to use these weights for MOL/discretisation and other boundary conditions functions etc, hence by default calculate_weights
invokes same classical fornberg algorithm . I will try to cover those next time.
Excellent stuff, if the error characteristics from the paper hold this represents a massive step up in accuracy. What we need to make use of this is allowing users to specify the first derivatives of a variable as additional argument to discretize
, or recognizing when such an equation exits within a PDESystem
and automatically dispatching methods using these weights to these variables.
I'll create an issue to track this, I'd appreciate your input there. Link to follow.
or recognizing when such an equation exits within a
PDESystem
and automatically dispatching methods using these weights to these variables.
Do you think something similar to Automatic Transformation of Nth Order ODEs to 1st Order ODEs could help us ? It lowers the order by introducing new variables which are generally derivatives of original state variable !