DiffEqOperators.jl icon indicating copy to clipboard operation
DiffEqOperators.jl copied to clipboard

fornberg(2020) weights based on hermite-based finite difference

Open yewalenikhil65 opened this issue 3 years ago • 2 comments

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 the DiffEqOperators.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.

yewalenikhil65 avatar Dec 22 '21 14:12 yewalenikhil65

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.

xtalax avatar Jan 11 '22 19:01 xtalax

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 !

yewalenikhil65 avatar Jan 13 '22 16:01 yewalenikhil65