-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First Order Schemes #64
Comments
Hi, if you want to enforce a specific difference scheme, you can use the import numpy as np
from findiff.stencils import Stencil
# some example data:
x = np.linspace(0, 1, 101)
dx = x[1] - x[0]
f = np.sin(x)
# define an explicit forward stencil for the first derivative along axis 0:
stencil = Stencil(offsets=[0, 1, 2], partials:{(1,): 1}, spacings=dx) Note that the
and
Apply the stencil at a given point, e.g. at stencil(f, at=5)
Out: 0.9987835384105308 Doing this point-wise is inefficient, though. But you can also apply the stencil to slices and masks instead of single points by using the I guess one could easily realize an upwind or TVD schemes using the Stencil class. By the way, I'm about to release a new major version (1.0.0) in the next two weeks or so. It will contain symbolic capabilities which allows one to derive discretization schemes and analyze their stability behavior analytically. Maybe that's interesting for you. |
Hi,
in case I want to use findiff for educational purpose, showing the differences in accuracy for first, second and higher order schemes, how can I enforce the usage of pure forward/backward differencing? Furthermore, e.g. thinking of advection, is it possible to realize upwind or TVD schemes with findiff?
Any help is greatly appreciated, kind regards!
The text was updated successfully, but these errors were encountered: