ianhinder / Kranc

A Mathematica package for generating code for solving time dependent partial differential equations
http://kranccode.org
GNU General Public License v2.0
29 stars 10 forks source link

Don't apply Jacobian to dissipation operators #57

Closed eschnett closed 12 years ago

eschnett commented 12 years ago

Kranc applies the Jacobian transformation even to dissipation operators. However, it seems to transform these in the same way as first derivatives, not the N-th derivatives they are.

I find that transforming the dissipation terms as first derivatives is unstable, while not transforming them leads to stable evolutions.

ianhinder commented 12 years ago

Yes, I think that not transforming them is the correct thing to do. There is also the issue of what to do with the upwinding direction in any advection derivatives (for McLachlan, at least). Also, since the Courant limit is typically inversely proportional to the maximum characteristic speed, which will transform by being multiplied by the (spatially-varying) determinant of the Jacobian from global to local, the Courant limit probably also transforms in this way. So the local Courant factor should be bounded by this if we want the system to be stable.

ianhinder commented 12 years ago

Maybe we want to allow "tags" or "options" for derivative operators, similar to "prolongation = none" for grid functions in Cactus. i.e. we could have "JacobianTransformation -> None" for dissipation operators. At some point, dissipation operators could be provided by default in Kranc, once we figure out how to do them efficiently.

eschnett commented 12 years ago

I apply dissipation in a calculation on its own. A tag for calculations would work just as fine.

Instead of tags, there could also be special names for derivative operators, allowing me to access the un-jacobianised derivatives.

eschnett commented 12 years ago

I have now a situation where applying Jacobians to dissipation makes a simulation unstable. Since this is a multi-block simulation, I have to manually change the generated source code, setting use_dissipation to 0.

eschnett commented 12 years ago

I should add that this simulation also uses ZeroDimensions = {3}. It seems the Jacobian mixes in this third dimension, which is probably the cause for the instability.

eschnett commented 12 years ago

I have committed code implementing this to the branch eschnett/vector-optimisations. Please review.

eschnett commented 12 years ago

Applied.