trixi-framework / trixi-framework/Trixi.jl

Switch to error-based step size control as default in elixirs

Open
#606 10 comments 1 reaction 0 assignees View on GitHub
enhancement performance
Dominant language
Julia
Stars
731
Forks
166
Avg merge
2d 18h
Merged PRs (30d)
25

Description

The Runge-Kutta methods with automatic step size control optimized for compressible fluid dynamics Lisandro Dalcin, Matteo Parsani, David Ketcheson, and I published a few weeks ago in a [preprint on arXiv](https://arxiv.org/abs/2104.06836) are now available in the Julia differential equations ecosystem.
```julia
julia> using OrdinaryDiffEq, Trixi
julia> trixi_include("examples/2d/elixir_euler_vortex.jl") # isentropic vortex standard setup using CFL-based step size control for the 2N method of Carpenter and Kennedy
[...]
Variable: rho rho_v1 rho_v2 rho_e
L2 error: 3.63431418e-06 3.21113799e-03 3.21114828e-03 4.54571590e-03
[...]
──────────────────────────────────────────────────────────────────────────────────
Trixi.jl Time Allocations
────────────────────── ───────────────────────
Tot / % measured: 575ms / 94.0% 4.91MiB / 95.5%
Section ncalls time %tot avg alloc %tot avg
──────────────────────────────────────────────────────────────────────────────────
rhs! 2.78k 455ms 84.2% 164μs 966KiB 20.1% 356B
volume integral 2.78k 167ms 30.9% 60.0μs 0.00B 0.00% 0.00B
interface flux 2.78k 135ms 24.9% 48.4μs 0.00B 0.00% 0.00B
surface integral 2.78k 66.5ms 12.3% 23.9μs 0.00B 0.00% 0.00B
prolong2interfaces 2.78k 65.3ms 12.1% 23.5μs 0.00B 0.00% 0.00B
Jacobian 2.78k 10.1ms 1.86% 3.62μs 0.00B 0.00% 0.00B
reset ∂u/∂t 2.78k 6.82ms 1.26% 2.45μs 0.00B 0.00% 0.00B
~rhs!~ 2.78k 4.28ms 0.79% 1.54μs 966KiB 20.1% 356B
prolong2boundaries 2.78k 143μs 0.03% 51.5ns 0.00B 0.00% 0.00B
prolong2mortars 2.78k 107μs 0.02% 38.3ns 0.00B 0.00% 0.00B
mortar flux 2.78k 72.4μs 0.01% 26.0ns 0.00B 0.00% 0.00B
boundary flux 2.78k 53.3μs 0.01% 19.2ns 0.00B 0.00% 0.00B
source terms 2.78k 46.1μs 0.01% 16.6ns 0.00B 0.00% 0.00B
I/O 15 59.9ms 11.1% 3.99ms 3.57MiB 76.1% 244KiB
save solution 7 55.1ms 10.2% 7.87ms 2.74MiB 58.3% 400KiB
~I/O~ 15 4.75ms 0.88% 317μs 835KiB 17.4% 55.7KiB
get element variables 7 49.6μs 0.01% 7.09μs 17.9KiB 0.37% 2.56KiB
save mesh 7 936ns 0.00% 134ns 0.00B 0.00% 0.00B
calculate dt 557 16.4ms 3.04% 29.5μs 0.00B 0.00% 0.00B
analyze solution 7 9.31ms 1.72% 1.33ms 181KiB 3.77% 25.9KiB
──────────────────────────────────────────────────────────────────────────────────
julia> sol = solve(ode, RDPK3SpFSAL49(), abstol=1.0e-6, reltol=1.0e-6,
save_everystep=false, callback=callbacks); summary_callback() # one of our methods
[...]
Variable: rho rho_v1 rho_v2 rho_e
L2 error: 3.64722648e-06 3.21113022e-03 3.21114614e-03 4.54571112e-03
[...]
──────────────────────────────────────────────────────────────────────────────────
Trixi.jl Time Allocations
────────────────────── ───────────────────────
Tot / % measured: 364ms / 89.4% 3.23MiB / 83.1%
Section ncalls time %tot avg alloc %tot avg
──────────────────────────────────────────────────────────────────────────────────
rhs! 1.90k 314ms 96.5% 165μs 664KiB 24.1% 358B
volume integral 1.90k 116ms 35.6% 60.9μs 0.00B 0.00% 0.00B
interface flux 1.90k 93.1ms 28.6% 48.9μs 0.00B 0.00% 0.00B
surface integral 1.90k 45.7ms 14.0% 24.0μs 0.00B 0.00% 0.00B
prolong2interfaces 1.90k 45.1ms 13.8% 23.7μs 0.00B 0.00% 0.00B
Jacobian 1.90k 7.10ms 2.18% 3.73μs 0.00B 0.00% 0.00B
reset ∂u/∂t 1.90k 4.08ms 1.25% 2.14μs 0.00B 0.00% 0.00B
~rhs!~ 1.90k 2.83ms 0.87% 1.49μs 664KiB 24.1% 358B
prolong2boundaries 1.90k 86.8μs 0.03% 45.7ns 0.00B 0.00% 0.00B
prolong2mortars 1.90k 67.8μs 0.02% 35.6ns 0.00B 0.00% 0.00B
mortar flux 1.90k 53.2μs 0.02% 28.0ns 0.00B 0.00% 0.00B
boundary flux 1.90k 39.5μs 0.01% 20.7ns 0.00B 0.00% 0.00B
source terms 1.90k 31.2μs 0.01% 16.4ns 0.00B 0.00% 0.00B
analyze solution 4 5.72ms 1.76% 1.43ms 104KiB 3.76% 25.9KiB
I/O 9 5.70ms 1.75% 634μs 1.94MiB 72.1% 220KiB
save solution 4 3.33ms 1.02% 833μs 1.53MiB 56.9% 392KiB
~I/O~ 9 2.35ms 0.72% 261μs 408KiB 14.8% 45.3KiB
get element variables 4 27.1μs 0.01% 6.79μs 10.2KiB 0.37% 2.56KiB
save mesh 4 392ns 0.00% 98.0ns 0.00B 0.00% 0.00B
──────────────────────────────────────────────────────────────────────────────────
```
As discussed on Slack, it would be nice to use these improvements by switching our default time integration methods.

However, we should discuss whether we consider this to be a breaking change. I don't think so since it's not documented anywhere. On the other hand, people might argue that their code could behaves differently when they just `trixi_include` some elixir distributed with Trixi.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the elixirs invoked through `trixi_include` and their default time-integration configuration, then compare the existing CFL-based setup with the `RDPK3SpFSAL49()` error-controlled example. Determine which defaults should change and how the possible breaking behavior should be handled before updating the relevant examples and checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
hpc
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.