Skip to content
Discussion options

You must be logged in to vote

All three behaviours come from three explicit lines in the code. Line numbers below are for devito 4.8.23.

1. fd_order=2 turns into a forward difference. generic_derivative has a deliberate override:

# First order derivative with 2nd order FD is strongly discouraged so taking
# first order fd that is a lot better
if deriv_order == 1 and fd_order == 2 and side is None:
    fd_order = 1

This triggers only when the effective fd_order is exactly 2 and you did not pass side. The 3-point centered first derivative decouples odd and even grid points (checkerboard modes), which is why it is avoided. The default fd_order of u.dx is the Function's space_order, so:

  • space_order=2: u.dx has fd_order=2,…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cdelavegamartin
Comment options

Answer selected by cdelavegamartin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants