Add proper adaptive timestepping to elastic simulations #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Adaptive time stepping did not properly work with magnetoelastic simulations, because the absolute error of all Variables was used to gauge accuracy. An absolute error of 1e-5 or lower was seen as good enough for displacements of the order of ~1e-14 m and velocities of ~1e-4 m/s.
Solution
The essential difference is moving the maxError of adaptive time stepping from TimeSolver to DynamicEquation, so each equation has its own error to adhere to. This is not user-accessible, so the 3 relevant max errors can be set via the (Ferro)Magnet, with automatic telepathic pointer-communication (I'm not the biggest fan of this solution). This is the only (or maybe not) solver setting outside of TimeSolver :( but it also has a physical unit and is physics dependent.
As a consequence, the Relaxer cannot directly set maxError of the TimeSolver anymore. This is not a problem, because it needs to create new DynamicEquations anyway, so it can also assign a pointer to its own maxerr variable, then scale that.
Let me know if you have a better solution though.
Potential To-Do's
maxerr_
in Relaxer user-assignable? This used to start at maxError of TimeSolver.