Understanding devito conventions and defaults #2805
|
I'm just getting started with devito and I have some questions: Switch of
|
Replies: 1 comment 1 reply
|
All three behaviours come from three explicit lines in the code. Line numbers below are for devito 4.8.23. 1. # 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 = 1This triggers only when the effective
2. Why
For u.dx(fd_order=1) # (u(x+h) - u(x))/h forward
u.dx(fd_order=1, side=left) # (u(x) - u(x-h))/h backward3. No error with To see what a more complex operator really does, print If this solves it, please mark it as the answer so others with the same problem can find it. |
All three behaviours come from three explicit lines in the code. Line numbers below are for devito 4.8.23.
1.
fd_order=2turns into a forward difference.generic_derivativehas a deliberate override:This triggers only when the effective
fd_orderis exactly 2 and you did not passside. The 3-point centered first derivative decouples odd and even grid points (checkerboard modes), which is why it is avoided. The defaultfd_orderofu.dxis the Function'sspace_order, so:space_order=2:u.dxhasfd_order=2,…