Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yewalenikhil65
Copy link

@yewalenikhil65 yewalenikhil65 commented Dec 22, 2021

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.

@xtalax
Copy link
Member

xtalax commented Jan 11, 2022

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.

@yewalenikhil65
Copy link
Author

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 !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants