Using an implicit-explicit (IMEX) Runge-Kutta solver based on Ariadne with Trixi.jl
using Trixi
using Theseus
using CairoMakieNotes: You must disable both Polyester and LoopVectorization for Enzyme to be able to differentiate Trixi.jl.
LocalPreferences.jl
[Trixi]
loop_vectorization = false
backend = "static"@assert Trixi._PREFERENCE_THREADING !== :polyester
@assert !Trixi._PREFERENCE_LOOPVECTORIZATIONFirst call to load callbacks
trixi_include(@__MODULE__, joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_diffusion.jl"), sol = nothing);
stepsize_callback = StepsizeCallback(cfl = 1.0)
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, stepsize_callback)
trixi_include(@__MODULE__, joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_diffusion.jl"), sol = nothing, callbacks = callbacks);
###############################################################################[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.
[ Info: You just called `trixi_include`. Julia may now compile the code, please be patient.run the simulation
sol = solve(
ode,
Theseus.SSP3433();
dt = 0.01, # solve needs some value here but it will be overwritten by the stepsize_callback
ode_default_options()..., callback = callbacks,
krylov_algo = :gmres,
);
████████╗██████╗ ██╗██╗ ██╗██╗
╚══██╔══╝██╔══██╗██║╚██╗██╔╝██║
██║ ██████╔╝██║ ╚███╔╝ ██║
██║ ██╔══██╗██║ ██╔██╗ ██║
██║ ██║ ██║██║██╔╝ ██╗██║
╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ SemidiscretizationHyperbolicParabolic │
│ ═════════════════════════════════════ │
│ #spatial dimensions: ………………………… 2 │
│ mesh: ………………………………………………………………… TreeMesh{2, Trixi.SerialTree{2, Float64}} with length 341 │
│ hyperbolic equations: ……………………… LinearScalarAdvectionEquation2D │
│ parabolic equations: ………………………… LaplaceDiffusion2D │
│ initial condition: ……………………………… initial_condition_diffusive_convergence_test │
│ source terms: …………………………………………… nothing │
│ solver: …………………………………………………………… DG │
│ parabolic solver: ………………………………… ViscousFormulationBassiRebay1 │
│ total #DOFs per field: …………………… 4096 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ TreeMesh{2, Trixi.SerialTree{2, Float64}} │
│ ═════════════════════════════════════════ │
│ center: …………………………………………………………… [0.0, 0.0] │
│ length: …………………………………………………………… 2.0 │
│ periodicity: ……………………………………………… (true, true) │
│ current #cells: ……………………………………… 341 │
│ #leaf-cells: ……………………………………………… 256 │
│ maximum #cells: ……………………………………… 30000 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ LinearScalarAdvectionEquation2D │
│ ═══════════════════════════════ │
│ #variables: ………………………………………………… 1 │
│ │ variable 1: …………………………………………… scalar │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DG{Float64} │
│ ═══════════ │
│ basis: ……………………………………………………………… LobattoLegendreBasis{Float64}(polydeg=3) │
│ mortar: …………………………………………………………… LobattoLegendreMortarL2{Float64}(polydeg=3) │
│ surface integral: ………………………………… SurfaceIntegralWeakForm │
│ │ surface flux: ……………………………………… FluxLaxFriedrichs(max_abs_speed) │
│ volume integral: …………………………………… VolumeIntegralWeakForm │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ AnalysisCallback │
│ ════════════════ │
│ interval: ……………………………………………………… 100 │
│ analyzer: ……………………………………………………… LobattoLegendreAnalyzer{Float64}(polydeg=6) │
│ │ error 1: …………………………………………………… l2_error │
│ │ error 2: …………………………………………………… linf_error │
│ │ integral 1: …………………………………………… entropy_timederivative │
│ save analysis to file: …………………… no │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ AliveCallback │
│ ═════════════ │
│ interval: ……………………………………………………… 10 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ StepsizeCallback │
│ ════════════════ │
│ CFL Advective: ………………………………………… Returns{Float64}(1.0) │
│ CFL Diffusive: ………………………………………… Returns{Float64}(0.0) │
│ Interval: ……………………………………………………… 1 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Time integration │
│ ════════════════ │
│ Start time: ………………………………………………… 0.0 │
│ Final time: ………………………………………………… 1.5 │
│ time integrator: …………………………………… SSP3433 │
│ adaptive: ……………………………………………………… false │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Environment information │
│ ═══════════════════════ │
│ #threads: ……………………………………………………… 1 │
│ threading backend: ……………………………… static │
│ LoopVectorization: ……………………………… disabled │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Simulation running 'LinearScalarAdvectionEquation2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
#timesteps: 0 run time: 5.11000000e-07 s
Δt: 1.00000000e-02 └── GC time: 0.00000000e+00 s (0.000%)
sim. time: 0.00000000e+00 (0.000%) time/DOF/rhs!: NaN s
PID: Inf s
#DOFs per field: 4096 alloc'd memory: 572.394 MiB
#elements: 256
Variable: scalar
L2 error: 3.94120825e-06
Linf error: 1.23670425e-05
∑∂S/∂U ⋅ Uₜ : -1.23370054e-01
────────────────────────────────────────────────────────────────────────────────────────────────────
┌ Warning: TODO forward zero-set of memorycopy used memset rather than runtime type
│ Caused by:
│ Stacktrace:
│ [1] copy
│ @ ./array.jl:350
│ [2] unaliascopy
│ @ ./abstractarray.jl:1516
│ [3] unalias
│ @ ./abstractarray.jl:1500
│ [4] broadcast_unalias
│ @ ./broadcast.jl:946
│ [5] preprocess
│ @ ./broadcast.jl:953
│ [6] preprocess_args
│ @ ./broadcast.jl:956
│ [7] preprocess_args
│ @ ./broadcast.jl:955
│ [8] preprocess
│ @ ./broadcast.jl:952
│ [9] preprocess_args
│ @ ./broadcast.jl:956
│ [10] preprocess_args
│ @ ./broadcast.jl:955
│ [11] preprocess
│ @ ./broadcast.jl:952
│ [12] preprocess_args
│ @ ./broadcast.jl:955
│ [13] preprocess
│ @ ./broadcast.jl:952
│ [14] override_bc_copyto!
│ @ ~/.julia/packages/Enzyme/xxXAx/src/compiler/interpreter.jl:818
│ [15] copyto!
│ @ ./broadcast.jl:925
│ [16] materialize!
│ @ ./broadcast.jl:883
│ [17] materialize!
│ @ ./broadcast.jl:880
│ [18] RKIMEX
│ @ ~/work/Ariadne.jl/Ariadne.jl/libs/Theseus/src/imex/imex.jl:33
└ @ Enzyme.Compiler ~/.julia/packages/Enzyme/xxXAx/src/rules/llvmrules.jl:806
┌ Warning: TODO forward zero-set of memorycopy used memset rather than runtime type
│ Caused by:
│ Stacktrace:
│ [1] copy
│ @ ./array.jl:350
│ [2] unaliascopy
│ @ ./abstractarray.jl:1516
│ [3] unalias
│ @ ./abstractarray.jl:1500
│ [4] broadcast_unalias
│ @ ./broadcast.jl:946
│ [5] preprocess
│ @ ./broadcast.jl:953
│ [6] preprocess_args
│ @ ./broadcast.jl:956
│ [7] preprocess_args
│ @ ./broadcast.jl:955
│ [8] preprocess
│ @ ./broadcast.jl:952
│ [9] preprocess_args
│ @ ./broadcast.jl:956
│ [10] preprocess_args
│ @ ./broadcast.jl:955
│ [11] preprocess
│ @ ./broadcast.jl:952
│ [12] override_bc_copyto!
│ @ ~/.julia/packages/Enzyme/xxXAx/src/compiler/interpreter.jl:818
│ [13] copyto!
│ @ ./broadcast.jl:925
│ [14] materialize!
│ @ ./broadcast.jl:883
│ [15] materialize!
│ @ ./broadcast.jl:880
│ [16] RKIMEX
│ @ ~/work/Ariadne.jl/Ariadne.jl/libs/Theseus/src/imex/imex.jl:33
└ @ Enzyme.Compiler ~/.julia/packages/Enzyme/xxXAx/src/rules/llvmrules.jl:806
#timesteps: 10 │ Δt: 1.2500e-02 │ sim. time: 1.2500e-01 (8.333%) │ run time: 5.0494e+01 s
#timesteps: 20 │ Δt: 1.2500e-02 │ sim. time: 2.5000e-01 (16.667%) │ run time: 5.0631e+01 s
#timesteps: 30 │ Δt: 1.2500e-02 │ sim. time: 3.7500e-01 (25.000%) │ run time: 5.0759e+01 s
#timesteps: 40 │ Δt: 1.2500e-02 │ sim. time: 5.0000e-01 (33.333%) │ run time: 5.0894e+01 s
#timesteps: 50 │ Δt: 1.2500e-02 │ sim. time: 6.2500e-01 (41.667%) │ run time: 5.1026e+01 s
#timesteps: 60 │ Δt: 1.2500e-02 │ sim. time: 7.5000e-01 (50.000%) │ run time: 5.1159e+01 s
#timesteps: 70 │ Δt: 1.2500e-02 │ sim. time: 8.7500e-01 (58.333%) │ run time: 5.1301e+01 s
#timesteps: 80 │ Δt: 1.2500e-02 │ sim. time: 1.0000e+00 (66.667%) │ run time: 5.1448e+01 s
#timesteps: 90 │ Δt: 1.2500e-02 │ sim. time: 1.1250e+00 (75.000%) │ run time: 5.1602e+01 s
────────────────────────────────────────────────────────────────────────────────────────────────────
Simulation running 'LinearScalarAdvectionEquation2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
#timesteps: 100 run time: 5.17601412e+01 s
Δt: 1.25000000e-02 └── GC time: 2.85625423e-01 s (0.552%)
sim. time: 1.25000000e+00 (83.333%) time/DOF/rhs!: 7.47841658e-08 s
PID: 3.15912598e-05 s
#DOFs per field: 4096 alloc'd memory: 599.392 MiB
#elements: 256
Variable: scalar
L2 error: 4.05750117e-05
Linf error: 8.88786807e-05
∑∂S/∂U ⋅ Uₜ : -1.04542976e-02
────────────────────────────────────────────────────────────────────────────────────────────────────
#timesteps: 110 │ Δt: 1.2500e-02 │ sim. time: 1.3750e+00 (91.667%) │ run time: 5.1929e+01 s
────────────────────────────────────────────────────────────────────────────────────────────────────
Simulation running 'LinearScalarAdvectionEquation2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
#timesteps: 120 run time: 5.21128977e+01 s
Δt: 1.25000000e-02 └── GC time: 2.98398101e-01 s (0.573%)
sim. time: 1.50000000e+00 (100.000%) time/DOF/rhs!: 7.47598424e-08 s
PID: 1.07327187e-06 s
#DOFs per field: 4096 alloc'd memory: 599.985 MiB
#elements: 256
Variable: scalar
L2 error: 3.87974068e-05
Linf error: 2.32515652e-04
∑∂S/∂U ⋅ Uₜ : -6.38139887e-03
────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────────────────────────
Trixi.jl simulation finished. Final time: 1.5 Time steps: 120 (accepted), 120 (total)
────────────────────────────────────────────────────────────────────────────────────────────────────
───────────────────────────────────────────────────────────────────────────────────────
Trixi.jl Time Allocations
─────────────────────── ────────────────────────
Tot / % measured: 52.1s / 2.3% 2.78GiB / 0.3%
Section ncalls time %tot avg alloc %tot avg
───────────────────────────────────────────────────────────────────────────────────────
parabolic rhs! 5.59k 1.16s 95.8% 206μs 8.70KiB 0.1% 1.59B
calculate gradient 5.59k 517ms 42.8% 92.3μs 3.33KiB 0.0% 0.61B
volume integral 5.59k 330ms 27.4% 59.0μs 0.00B 0.0% 0.00B
Jacobian 5.59k 56.4ms 4.7% 10.1μs 0.00B 0.0% 0.00B
surface integral 5.59k 40.5ms 3.4% 7.24μs 0.00B 0.0% 0.00B
interface flux 5.59k 36.5ms 3.0% 6.52μs 0.00B 0.0% 0.00B
prolong2interfaces 5.59k 34.9ms 2.9% 6.24μs 0.00B 0.0% 0.00B
reset gradients 5.59k 11.6ms 1.0% 2.07μs 0.00B 0.0% 0.00B
~calculate gradient~ 5.59k 5.15ms 0.4% 920ns 3.33KiB 0.0% 0.61B
prolong2mortars 5.59k 490μs 0.0% 87.5ns 0.00B 0.0% 0.00B
prolong2boundaries 5.59k 406μs 0.0% 72.6ns 0.00B 0.0% 0.00B
mortar flux 5.59k 382μs 0.0% 68.2ns 0.00B 0.0% 0.00B
boundary flux 5.59k 176μs 0.0% 31.5ns 0.00B 0.0% 0.00B
volume integral 5.59k 343ms 28.5% 61.4μs 0.00B 0.0% 0.00B
calculate viscous fluxes 5.59k 110ms 9.2% 19.7μs 0.00B 0.0% 0.00B
transform variables 5.59k 37.2ms 3.1% 6.64μs 0.00B 0.0% 0.00B
interface flux 5.59k 36.0ms 3.0% 6.43μs 0.00B 0.0% 0.00B
surface integral 5.59k 35.7ms 3.0% 6.38μs 0.00B 0.0% 0.00B
prolong2interfaces 5.59k 33.4ms 2.8% 5.96μs 0.00B 0.0% 0.00B
Jacobian 5.59k 28.3ms 2.3% 5.05μs 0.00B 0.0% 0.00B
~parabolic rhs!~ 5.59k 7.18ms 0.6% 1.28μs 5.38KiB 0.1% 0.98B
reset ∂u/∂t 5.59k 5.77ms 0.5% 1.03μs 0.00B 0.0% 0.00B
prolong2mortars 5.59k 456μs 0.0% 81.5ns 0.00B 0.0% 0.00B
prolong2boundaries 5.59k 379μs 0.0% 67.7ns 0.00B 0.0% 0.00B
mortar flux 5.59k 352μs 0.0% 63.0ns 0.00B 0.0% 0.00B
boundary flux 5.59k 165μs 0.0% 29.5ns 0.00B 0.0% 0.00B
rhs! 480 47.7ms 4.0% 99.4μs 4.78KiB 0.1% 10.2B
volume integral 480 32.2ms 2.7% 67.1μs 0.00B 0.0% 0.00B
interface flux 480 3.94ms 0.3% 8.21μs 0.00B 0.0% 0.00B
surface integral 480 3.72ms 0.3% 7.74μs 0.00B 0.0% 0.00B
Jacobian 480 3.39ms 0.3% 7.06μs 0.00B 0.0% 0.00B
prolong2interfaces 480 3.27ms 0.3% 6.81μs 0.00B 0.0% 0.00B
~rhs!~ 480 631μs 0.1% 1.31μs 4.78KiB 0.1% 10.2B
reset ∂u/∂t 480 371μs 0.0% 773ns 0.00B 0.0% 0.00B
prolong2mortars 480 72.2μs 0.0% 150ns 0.00B 0.0% 0.00B
mortar flux 480 33.0μs 0.0% 68.7ns 0.00B 0.0% 0.00B
prolong2boundaries 480 29.9μs 0.0% 62.3ns 0.00B 0.0% 0.00B
boundary flux 480 14.0μs 0.0% 29.1ns 0.00B 0.0% 0.00B
source terms 480 13.9μs 0.0% 29.0ns 0.00B 0.0% 0.00B
analyze solution 3 3.14ms 0.3% 1.05ms 7.24MiB 99.6% 2.41MiB
calculate dt 121 84.0μs 0.0% 694ns 17.0KiB 0.2% 144B
───────────────────────────────────────────────────────────────────────────────────────This page was generated using Literate.jl.