Closed Sh0cktr4p closed 3 years ago
The reason for the order switch was external forces. Without them the order doesn't make much of a difference but in the presence of non-smooth forces, semi-Lagrangian advection without prior diffusion can cause artifacts. A different advection scheme might not have this problem.
If the reversed order suits your case better, feel free to create a custom Physics class or simply call diffuse
and advect
in the order you like.
In the Burgers Physics class, in the step_velocity method, the advection step is performed after the diffusion step, in contrast to earlier versions. Unfortunately, I am not involved deeply enough in this topic to tell if this is a bug or intended behavior; however, reversing the order seemed to resolve an issue for me where velocity field effects were not correctly applied (see code at the end). Furthermore, the current version seemed more prone to instability issues when processing large fields (e.g. field size (128,)) with low diffusion substep counts (e. g. 1).