Using an implicit-explicit (IMEX) Runge-Kutta solver based on Ariadne with Trixi.jl

using Trixi
using Theseus
using CairoMakie

Notes: 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_LOOPVECTORIZATION

First call to load callbacks

trixi_include(@__MODULE__, joinpath(examples_dir(), "p4est_2d_dgsem", "elixir_navierstokes_vortex_street.jl"), sol = nothing, analysis_interval = 10);

stepsize_callback = StepsizeCallback(cfl = 1.0)

callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, stepsize_callback)
# A short time span keeps the documentation build fast; each implicit step
# of this Navier-Stokes problem takes several seconds. Use a longer `tspan`,
# e.g. the elixir's default (0, 100), to see the vortex street develop.
tspan = (0.0, 0.1)
trixi_include(@__MODULE__, joinpath(examples_dir(), "p4est_2d_dgsem", "elixir_navierstokes_vortex_street.jl"), sol = nothing, callbacks = callbacks, tspan = tspan);
###############################################################################
[ 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.ARS443(); # ARS111, ARS222, ARS443
    dt = 0.001, # 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: ……………………………………………………………………………… P4estMesh{2, 2, Float64}                                    │
│ hyperbolic equations: …………………………………… CompressibleEulerEquations2D                                │
│ parabolic equations: ……………………………………… CompressibleNavierStokesDiffusion2D                         │
│ initial condition: …………………………………………… initial_condition                                           │
│ source terms: ………………………………………………………… nothing                                                     │
│ source terms parabolic: ……………………………… nothing                                                     │
│ solver: ………………………………………………………………………… DG                                                          │
│ parabolic solver: ……………………………………………… ParabolicFormulationBassiRebay1                             │
│ total #DOFs per field: ………………………………… 36128                                                       │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ P4estMesh{2, 2, Float64}                                                                         │
│ ════════════════════════                                                                         │
│ #trees: ………………………………………………………………………… 2258                                                        │
│ current #cells: …………………………………………………… 2258                                                        │
│ polydeg: ……………………………………………………………………… 3                                                           │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ CompressibleEulerEquations2D                                                                     │
│ ════════════════════════════                                                                     │
│ #variables: ……………………………………………………………… 4                                                           │
│ │ variable 1: ………………………………………………………… rho                                                         │
│ │ variable 2: ………………………………………………………… rho_v1                                                      │
│ │ variable 3: ………………………………………………………… rho_v2                                                      │
│ │ variable 4: ………………………………………………………… rho_e_total                                                 │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ DG{Float64}                                                                                      │
│ ═══════════                                                                                      │
│ basis: …………………………………………………………………………… LobattoLegendreBasis{Float64}(polydeg=3)                    │
│ mortar: ………………………………………………………………………… LobattoLegendreMortarL2{Float64}(polydeg=3)                 │
│ surface integral: ……………………………………………… SurfaceIntegralWeakForm                                     │
│ │ surface flux: …………………………………………………… FluxHLL(min_max_speed_davis)                                │
│ volume integral: ………………………………………………… VolumeIntegralWeakForm                                      │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ AnalysisCallback                                                                                 │
│ ════════════════                                                                                 │
│ interval: …………………………………………………………………… 10                                                          │
│ analyzer: …………………………………………………………………… LobattoLegendreAnalyzer{Float64}(polydeg=6)                 │
│ │ error 1: ………………………………………………………………… l2_error                                                    │
│ │ error 2: ………………………………………………………………… linf_error                                                  │
│ │ integral 1: ………………………………………………………… entropy_timederivative                                      │
│ save analysis to file: ………………………………… no                                                          │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ AliveCallback                                                                                    │
│ ═════════════                                                                                    │
│ interval: …………………………………………………………………… 1                                                           │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ StepsizeCallback                                                                                 │
│ ════════════════                                                                                 │
│ CFL Hyperbolic: …………………………………………………… Returns{Float64}(1.0)                                       │
│ CFL Parabolic: ……………………………………………………… Returns{Float64}(0.0)                                       │
│ Interval: …………………………………………………………………… 1                                                           │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Time integration                                                                                 │
│ ════════════════                                                                                 │
│ Start time: ……………………………………………………………… 0.0                                                         │
│ Final time: ……………………………………………………………… 0.1                                                         │
│ time integrator: ………………………………………………… ARS443                                                      │
│ adaptive: …………………………………………………………………… false                                                       │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Environment information                                                                          │
│ ═══════════════════════                                                                          │
│ #threads: …………………………………………………………………… 1                                                           │
│ threading backend: …………………………………………… static                                                      │
│ LoopVectorization: …………………………………………… disabled                                                    │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘

────────────────────────────────────────────────────────────────────────────────────────────────────
 Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
 #timesteps:                  0                run time:       1.30867422e+00 s
 Δt:             1.00000000e-03                └── 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:         36128                alloc'd memory:       1269.882 MiB
 #elements:                2258                device memory:           0.000 MiB

 Variable:       rho              rho_v1           rho_v2           rho_e_total
 L2 error:       8.96518598e-17   8.96518598e-17   0.00000000e+00   1.27756504e-15
 Linf error:     4.44089210e-16   4.44089210e-16   0.00000000e+00   2.66453526e-15
 ∑∂S/∂U ⋅ Uₜ :  -1.20647355e-03
────────────────────────────────────────────────────────────────────────────────────────────────────

#timesteps:      1 │ Δt: 4.6182e-03 │ sim. time: 4.6182e-03 (4.618%)   │ run time: 6.2319e+01 s
#timesteps:      2 │ Δt: 4.4948e-03 │ sim. time: 9.1130e-03 (9.113%)   │ run time: 7.4303e+01 s
#timesteps:      3 │ Δt: 4.4714e-03 │ sim. time: 1.3584e-02 (13.584%)  │ run time: 8.5599e+01 s
#timesteps:      4 │ Δt: 4.4766e-03 │ sim. time: 1.8061e-02 (18.061%)  │ run time: 9.7468e+01 s
#timesteps:      5 │ Δt: 4.4931e-03 │ sim. time: 2.2554e-02 (22.554%)  │ run time: 1.1035e+02 s
#timesteps:      6 │ Δt: 4.5254e-03 │ sim. time: 2.7079e-02 (27.079%)  │ run time: 1.2174e+02 s
#timesteps:      7 │ Δt: 4.5643e-03 │ sim. time: 3.1644e-02 (31.644%)  │ run time: 1.3374e+02 s
#timesteps:      8 │ Δt: 4.5740e-03 │ sim. time: 3.6218e-02 (36.218%)  │ run time: 1.4508e+02 s
#timesteps:      9 │ Δt: 4.5552e-03 │ sim. time: 4.0773e-02 (40.773%)  │ run time: 1.5638e+02 s

────────────────────────────────────────────────────────────────────────────────────────────────────
 Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
 #timesteps:                 10                run time:       1.69192812e+02 s
 Δt:             4.55501201e-03                └── GC time:    1.25211881e+01 s (7.401%)
 sim. time:      4.53278729e-02 (45.328%)      time/DOF/rhs!:  5.71462877e-06 s
                                               PID:            9.27968999e-05 s
 #DOFs per field:         36128                alloc'd memory:        810.130 MiB
 #elements:                2258                device memory:           0.000 MiB

 Variable:       rho              rho_v1           rho_v2           rho_e_total
 L2 error:       4.64923431e-03   8.85283724e-03   4.72300190e-03   4.80992841e-02
 Linf error:     7.16158036e-01   1.42833015e+00   6.28720604e-01   7.47949255e+00
 ∑∂S/∂U ⋅ Uₜ :  -1.98606192e-04
────────────────────────────────────────────────────────────────────────────────────────────────────

#timesteps:     11 │ Δt: 4.5783e-03 │ sim. time: 4.9906e-02 (49.906%)  │ run time: 1.7873e+02 s
#timesteps:     12 │ Δt: 4.6280e-03 │ sim. time: 5.4534e-02 (54.534%)  │ run time: 1.8935e+02 s
#timesteps:     13 │ Δt: 4.6537e-03 │ sim. time: 5.9188e-02 (59.188%)  │ run time: 1.9907e+02 s
#timesteps:     14 │ Δt: 4.6430e-03 │ sim. time: 6.3831e-02 (63.831%)  │ run time: 2.0881e+02 s
#timesteps:     15 │ Δt: 4.6370e-03 │ sim. time: 6.8468e-02 (68.468%)  │ run time: 2.1860e+02 s
#timesteps:     16 │ Δt: 4.5785e-03 │ sim. time: 7.3046e-02 (73.046%)  │ run time: 2.2836e+02 s
#timesteps:     17 │ Δt: 4.5293e-03 │ sim. time: 7.7576e-02 (77.576%)  │ run time: 2.3812e+02 s
#timesteps:     18 │ Δt: 4.4909e-03 │ sim. time: 8.2067e-02 (82.067%)  │ run time: 2.4792e+02 s
#timesteps:     19 │ Δt: 4.4629e-03 │ sim. time: 8.6529e-02 (86.529%)  │ run time: 2.5770e+02 s

────────────────────────────────────────────────────────────────────────────────────────────────────
 Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
 #timesteps:                 20                run time:       2.69008548e+02 s
 Δt:             4.44400238e-03                └── GC time:    2.26584074e+01 s (8.423%)
 sim. time:      9.09734380e-02 (90.973%)      time/DOF/rhs!:  5.85765557e-06 s
                                               PID:            5.51224164e-05 s
 #DOFs per field:         36128                alloc'd memory:        874.997 MiB
 #elements:                2258                device memory:           0.000 MiB

 Variable:       rho              rho_v1           rho_v2           rho_e_total
 L2 error:       6.53365544e-03   1.26659983e-02   7.73995358e-03   6.75443615e-02
 Linf error:     5.43630658e-01   1.03003896e+00   7.51581870e-01   5.56166488e+00
 ∑∂S/∂U ⋅ Uₜ :  -1.20583267e-04
────────────────────────────────────────────────────────────────────────────────────────────────────

#timesteps:     21 │ Δt: 4.4324e-03 │ sim. time: 9.5406e-02 (95.406%)  │ run time: 2.7728e+02 s
#timesteps:     22 │ Δt: 4.4259e-03 │ sim. time: 9.9832e-02 (99.832%)  │ run time: 2.8702e+02 s

────────────────────────────────────────────────────────────────────────────────────────────────────
 Simulation running 'CompressibleEulerEquations2D' with DGSEM(polydeg=3)
────────────────────────────────────────────────────────────────────────────────────────────────────
 #timesteps:                 23                run time:       2.92551479e+02 s
 Δt:             1.68301339e-04                └── GC time:    2.47460441e+01 s (8.459%)
 sim. time:      1.00000000e-01 (100.000%)     time/DOF/rhs!:  5.79468091e-06 s
                                               PID:            4.30843424e-05 s
 #DOFs per field:         36128                alloc'd memory:        624.749 MiB
 #elements:                2258                device memory:           0.000 MiB

 Variable:       rho              rho_v1           rho_v2           rho_e_total
 L2 error:       6.80936275e-03   1.32874209e-02   8.22762356e-03   7.03912967e-02
 Linf error:     5.48917718e-01   1.04295865e+00   7.53521411e-01   5.60792837e+00
 ∑∂S/∂U ⋅ Uₜ :  -1.23691020e-04
────────────────────────────────────────────────────────────────────────────────────────────────────

────────────────────────────────────────────────────────────────────────────────────────────────────
Trixi.jl simulation finished.  Final time: 0.1  Time steps: 23 (accepted), 23 (total)
────────────────────────────────────────────────────────────────────────────────────────────────────

─────────────────────────────────────────────────────────────────────────────────────────
               Trixi.jl                         Time                    Allocations
                                       ───────────────────────   ────────────────────────
           Tot / % measured:                 293s /  78.1%           52.3GiB /  85.5%

Section                        ncalls     time    %tot     avg     alloc    %tot      avg
─────────────────────────────────────────────────────────────────────────────────────────
parabolic rhs!                  1.11k     227s   99.4%   205ms   44.6GiB   99.7%  41.2MiB
  prolong2interfaces            1.11k     215s   93.8%   194ms   43.9GiB   98.3%  40.6MiB
  calculate gradient            1.11k    4.58s    2.0%  4.13ms   3.33KiB    0.0%    3.08B
    volume integral             1.11k    2.21s    1.0%  2.00ms     0.00B    0.0%    0.00B
    surface integral            1.11k    1.10s    0.5%   996μs     0.00B    0.0%    0.00B
    interface flux              1.11k    408ms    0.2%   369μs     0.00B    0.0%    0.00B
    Jacobian                    1.11k    369ms    0.2%   333μs     0.00B    0.0%    0.00B
    prolong2interfaces          1.11k    308ms    0.1%   278μs     0.00B    0.0%    0.00B
    reset gradients             1.11k    156ms    0.1%   141μs     0.00B    0.0%    0.00B
    boundary flux               1.11k   8.73ms    0.0%  7.88μs     0.00B    0.0%    0.00B
    prolong2boundaries          1.11k   6.49ms    0.0%  5.86μs     0.00B    0.0%    0.00B
    ~calculate gradient~        1.11k   4.28ms    0.0%  3.87μs   3.33KiB    0.0%    3.08B
    prolong2mortars             1.11k    500μs    0.0%   451ns     0.00B    0.0%    0.00B
    mortar flux                 1.11k    472μs    0.0%   426ns     0.00B    0.0%    0.00B
  prolong2boundaries            1.11k    3.71s    1.6%  3.35ms    671MiB    1.5%   620KiB
  volume integral               1.11k    1.80s    0.8%  1.62ms     0.00B    0.0%    0.00B
  calculate parabolic fluxes    1.11k    1.49s    0.7%  1.35ms     0.00B    0.0%    0.00B
  interface flux                1.11k    390ms    0.2%   352μs     0.00B    0.0%    0.00B
  transform variables           1.11k    323ms    0.1%   291μs     0.00B    0.0%    0.00B
  surface integral              1.11k    243ms    0.1%   219μs     0.00B    0.0%    0.00B
  Jacobian                      1.11k    192ms    0.1%   173μs     0.00B    0.0%    0.00B
  reset ∂u/∂t                   1.11k   65.1ms    0.0%  58.7μs     0.00B    0.0%    0.00B
  boundary flux                 1.11k   12.7ms    0.0%  11.5μs     0.00B    0.0%    0.00B
  ~parabolic rhs!~              1.11k   11.7ms    0.0%  10.5μs   5.67KiB    0.0%    5.24B
  prolong2mortars               1.11k   3.65ms    0.0%  3.29μs    207KiB    0.0%     191B
  mortar flux                   1.11k    429μs    0.0%   387ns     0.00B    0.0%    0.00B
  source terms parabolic        1.11k    125μs    0.0%   113ns     0.00B    0.0%    0.00B
analyze solution                    4    845ms    0.4%   211ms    130MiB    0.3%  32.5MiB
rhs!                              115    407ms    0.2%  3.54ms   4.78KiB    0.0%    42.6B
  volume integral                 115    217ms    0.1%  1.89ms     0.00B    0.0%    0.00B
  interface flux                  115   93.2ms    0.0%   810μs     0.00B    0.0%    0.00B
  prolong2interfaces              115   34.1ms    0.0%   297μs     0.00B    0.0%    0.00B
  Jacobian                        115   27.0ms    0.0%   235μs     0.00B    0.0%    0.00B
  surface integral                115   25.8ms    0.0%   224μs     0.00B    0.0%    0.00B
  reset ∂u/∂t                     115   6.27ms    0.0%  54.5μs     0.00B    0.0%    0.00B
  boundary flux                   115   2.63ms    0.0%  22.9μs     0.00B    0.0%    0.00B
  prolong2boundaries              115    621μs    0.0%  5.40μs     0.00B    0.0%    0.00B
  ~rhs!~                          115    472μs    0.0%  4.10μs   4.78KiB    0.0%    42.6B
  prolong2mortars                 115   56.3μs    0.0%   490ns     0.00B    0.0%    0.00B
  mortar flux                     115   34.0μs    0.0%   296ns     0.00B    0.0%    0.00B
  source terms                    115   3.83μs    0.0%  33.3ns     0.00B    0.0%    0.00B
calculate dt                       24   11.0ms    0.0%   457μs   3.38KiB    0.0%     144B
─────────────────────────────────────────────────────────────────────────────────────────

This page was generated using Literate.jl.