trixi-framework / trixi-framework/Trixi.jl

Reduce/remove annoying output after call to `solve`

Open
#2,349 6 comments 0 reactions 0 assignees View on GitHub
discussion low-priority
Dominant language
Julia
Stars
731
Forks
167
Avg merge
2d 18h
Merged PRs (30d)
25

Description

For some reason, appending a `;` to the call to `solve` still prints out lots of annoying information on the `sol` variable:

`trixi_include("examples/tree_2d_dgsem/elixir_advection_basic.jl")` (starting with `retcode: Success`):
```
[...]
save solution 2 1.13ms 14.4% 564μs 199KiB 72.3% 100KiB
~I/O~ 3 1.06ms 13.6% 354μs 24.5KiB 8.9% 8.17KiB
get element variables 2 125ns 0.0% 62.5ns 0.00B 0.0% 0.00B
get node variables 2 42.0ns 0.0% 21.0ns 0.00B 0.0% 0.00B
save mesh 2 41.0ns 0.0% 20.5ns 0.00B 0.0% 0.00B
calculate dt 19 2.50μs 0.0% 132ns 0.00B 0.0% 0.00B
────────────────────────────────────────────────────────────────────────────────────

retcode: Success
Interpolation: 1st order linear
t: 2-element Vector{Float64}:
0.0
1.0
u: 2-element Vector{Vector{Float64}}:
[1.0000000000000002, 1.0541631844724508, 1.1401754862127884, 1.1913417161825453, 1.0541631844724508, 1.1076889099201424, 1.1913417161825453, 1.2402560013122492, 1.1401754862127884, 1.1913417161825453 … 0.8086582838174547, 0.8598245137872117, 0.7597439986877507, 0.8086582838174547, 0.8923110900798576, 0.9458368155275493, 0.8086582838174547, 0.8598245137872117, 0.9458368155275493, 0.9999999999999999]
[1.4999654935217133, 1.497069049894122, 1.4799445215073146, 1.461938316883484, 1.497020278574678, 1.4882724496466786, 1.4619320705777972, 1.438489301290354, 1.4799285712762233, 1.4619601449045874 … 1.461931469299593, 1.479943113408951, 1.4384683959613058, 1.4619604180097443, 1.4882708806682756, 1.4970663963023827, 1.4618785784996724, 1.4799323096519648, 1.4970224403774355, 1.4999665716866932]
```

It's even worse for our custom integrators:

`trixi_include("examples/tree_2d_dgsem/elixir_advection_timeintegration.jl")`:
```
[...]
initial condition AMR 1 1.06ms 7.5% 1.06ms 951KiB 60.2% 951KiB
AMR 3 784μs 5.5% 261μs 951KiB 60.2% 317KiB
refine 3 722μs 5.1% 241μs 698KiB 44.2% 233KiB
mesh 2 469μs 3.3% 235μs 9.50KiB 0.6% 4.75KiB
refine_unbalanced! 2 449μs 3.2% 224μs 640B 0.0% 320B
~mesh~ 2 17.5μs 0.1% 8.75μs 6.06KiB 0.4% 3.03KiB
rebalance! 2 2.79μs 0.0% 1.40μs 2.81KiB 0.2% 1.41KiB
solver 2 250μs 1.8% 125μs 686KiB 43.4% 343KiB
~refine~ 3 3.25μs 0.0% 1.08μs 1.95KiB 0.1% 667B
indicator 3 34.5μs 0.2% 11.5μs 29.4KiB 1.9% 9.81KiB
~AMR~ 3 26.7μs 0.2% 8.90μs 224KiB 14.2% 74.5KiB
coarsen 3 292ns 0.0% 97.3ns 96.0B 0.0% 32.0B
~initial condition AMR~ 1 274μs 1.9% 274μs 672B 0.0% 672B
calculate dt 1 208ns 0.0% 208ns 0.00B 0.0% 0.00B
─────────────────────────────────────────────────────────────────────────────────────────

Trixi.TimeIntegratorSolution{Tuple{Float64, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SemidiscretizationHyperbolic{TreeMesh{2, Trixi.SerialTree{2, Float64}, Float64}, LinearScalarAdvectionEquation2D{Float64}, typeof(initial_condition_gauss), Trixi.BoundaryConditionPeriodic, Nothing, DGSEM{LobattoLegendreBasis{Float64, 4, SVector{4, Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}, Trixi.LobattoLegendreMortarL2{Float64, 4, Matrix{Float64}, Matrix{Float64}}, SurfaceIntegralWeakForm{FluxLaxFriedrichs{typeof(max_abs_speed_naive)}}, VolumeIntegralWeakForm}, @NamedTuple{elements::Trixi.ElementContainer2D{Float64, Float64}, interfaces::Trixi.InterfaceContainer2D{Float64}, boundaries::Trixi.BoundaryContainer2D{Float64, Float64}, mortars::Trixi.L2MortarContainer2D{Float64}, fstar_primary_upper_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}, fstar_primary_lower_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}, fstar_secondary_upper_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}, fstar_secondary_lower_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}}}, ODEFunction{true, SciMLBase.FullSpecialize, typeof(Trixi.rhs!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardODEProblem}}((0.0, 1.0), ([1.9287498479639178e-22, 1.0532739621647459e-21, 1.447315469962333e-20, 6.760364845869282e-20, 1.0532739621647459e-21, 5.7518399316808886e-21, 7.903667244141636e-20, 3.69177800553284e-19, 1.447315469962333e-20, 7.903667244141636e-20 … 7.903667244141636e-20, 1.447315469962333e-20, 3.69177800553284e-19, 7.903667244141636e-20, 5.7518399316808886e-21, 1.0532739621647459e-21, 6.760364845869282e-20, 1.447315469962333e-20, 1.0532739621647459e-21, 1.9287498479639178e-22], [-4.7028264543387594e-17, -2.3649236694622056e-17, 4.953271106352551e-18, -3.269511449480071e-17, -1.5963333986794213e-17, -8.046359641421703e-18, 1.6331718490063806e-18, -1.2210016309445209e-17, 9.468020675388847e-16, 4.623235817850765e-16 … 3.0291805273324884e-18, -8.787648684799852e-19, 1.542112520852698e-15, 4.975565682128771e-16, -5.635500239504129e-17, 1.4425097647475527e-17, 2.5319820989017235e-16, 6.180102786190519e-17, -8.615110475437578e-18, 4.613837382523998e-18]), ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, SemidiscretizationHyperbolic{TreeMesh{2, Trixi.SerialTree{2, Float64}, Float64}, LinearScalarAdvectionEquation2D{Float64}, typeof(initial_condition_gauss), Trixi.BoundaryConditionPeriodic, Nothing, DGSEM{LobattoLegendreBasis{Float64, 4, SVector{4, Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}, Trixi.LobattoLegendreMortarL2{Float64, 4, Matrix{Float64}, Matrix{Float64}}, SurfaceIntegralWeakForm{FluxLaxFriedrichs{typeof(max_abs_speed_naive)}}, VolumeIntegralWeakForm}, @NamedTuple{elements::Trixi.ElementContainer2D{Float64, Float64}, interfaces::Trixi.InterfaceContainer2D{Float64}, boundaries::Trixi.BoundaryContainer2D{Float64, Float64}, mortars::Trixi.L2MortarContainer2D{Float64}, fstar_primary_upper_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}, fstar_primary_lower_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}, fstar_secondary_upper_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}, fstar_secondary_lower_threaded::Vector{StaticArraysCore.MMatrix{1, 4, Float64, 4}}}}, ODEFunction{true, SciMLBase.FullSpecialize, typeof(Trixi.rhs!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}, SciMLBase.StandardODEProblem}(ODEFunction{true, SciMLBase.FullSpecialize, typeof(Trixi.rhs!), LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing, Nothing, Nothing}(Trixi.rhs!, LinearAlgebra.UniformScaling{Bool}(true), nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing, SciMLBase.DEFAULT_OBSERVED, nothing, nothing, nothing, nothing), [1.9287498479639178e-22, 1.0532739621647459e-21, 1.447315469962333e-20, 6.760364845869282e-20, 1.0532739621647459e-21, 5.7518399316808886e-21, 7.903667244141636e-20, 3.69177800553284e-19, 1.447315469962333e-20, 7.903667244141636e-20 … 7.903667244141636e-20, 1.447315469962333e-20, 3.69177800553284e-19, 7.903667244141636e-20, 5.7518399316808886e-21, 1.0532739621647459e-21, 6.760364845869282e-20, 1.447315469962333e-20, 1.0532739621647459e-21, 1.9287498479639178e-22], (0.0, 1.0), SemidiscretizationHyperbolic(TreeMesh{2, Trixi.SerialTree{2, Float64}} with length 561, LinearScalarAdvectionEquation2D with one variable, initial_condition_gauss, boundary_condition_periodic, nothing, DG{Float64}(LobattoLegendreBasis{Float64}(polydeg=3), LobattoLegendreMortarL2{Float64}(polydeg=3), SurfaceIntegralWeakForm{FluxLaxFriedrichs{typeof(max_abs_speed_naive)}}(FluxLaxFriedrichs(max_abs_speed_naive)), VolumeIntegralWeakForm()), cache(elements interfaces boundaries mortars fstar_primary_upper_threaded fstar_primary_lower_threaded fstar_secondary_upper_threaded fstar_secondary_lower_threaded)), Base.Pairs{Symbol, Union{}, Tuple{}, @NamedTuple{}}(), SciMLBase.StandardODEProblem()))
```

Appending `;` to `trixi_include` fixes the issue. Does anyone know why this is happening or how to prevent it?

Contributor guide

Open the contributing guide

Research direction

Reproduce the output using examples/tree_2d_dgsem/elixir_advection_basic.jl and examples/tree_2d_dgsem/elixir_advection_timeintegration.jl through trixi_include, with and without a trailing semicolon. Start by tracing trixi_include and the call to solve; done means the solution is not dumped after solve without requiring `;`, including with the custom integrators.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.