From e1770ae385be4266867e2e6c022ffa991eeb24dc Mon Sep 17 00:00:00 2001 From: bennibolm Date: Wed, 11 Dec 2024 15:23:59 +0100 Subject: [PATCH] Add some tests and comments --- .../t8code_2d_fv/elixir_advection_basic.jl | 14 ++++++++------ .../t8code_2d_fv/elixir_advection_gauss.jl | 6 +++--- src/callbacks_step/analysis.jl | 1 + src/solvers/fv_t8code/fv.jl | 19 ++++++++++--------- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/examples/t8code_2d_fv/elixir_advection_basic.jl b/examples/t8code_2d_fv/elixir_advection_basic.jl index d0c983dbe32..1aba4124870 100644 --- a/examples/t8code_2d_fv/elixir_advection_basic.jl +++ b/examples/t8code_2d_fv/elixir_advection_basic.jl @@ -67,7 +67,7 @@ mesh = T8codeMesh(trees_per_dimension, element_class, semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) -tspan = (0.0, 1.0) +tspan = (0.0, 0.0) ode = semidiscretize(semi, tspan); summary_callback = SummaryCallback() @@ -87,10 +87,12 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, ############################################################################### # run the simulation - -# sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), -# dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback -# save_everystep = false, callback = callbacks); -# summary_callback() +println("Directly before solve") +sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), + dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback + save_everystep = false, callback = callbacks, maxiters = 0); +println("Directly after solve") +summary_callback() +println("Directly after summary_callback") GC.enable(true) diff --git a/examples/t8code_2d_fv/elixir_advection_gauss.jl b/examples/t8code_2d_fv/elixir_advection_gauss.jl index 5afd4ac410f..3386e3e1d02 100644 --- a/examples/t8code_2d_fv/elixir_advection_gauss.jl +++ b/examples/t8code_2d_fv/elixir_advection_gauss.jl @@ -24,7 +24,7 @@ ode = semidiscretize(semi, (0.0, 0.0)); summary_callback = SummaryCallback() analysis_interval = 100 -analysis_callback = AnalysisCallback(semi, interval = analysis_interval) +# analysis_callback = AnalysisCallback(semi, interval = analysis_interval) alive_callback = AliveCallback(analysis_interval = analysis_interval) @@ -33,7 +33,7 @@ save_solution = SaveSolutionCallback(interval = 10, stepsize_callback = StepsizeCallback(cfl = 0.5) -callbacks = CallbackSet(summary_callback, save_solution, analysis_callback, alive_callback, +callbacks = CallbackSet(#=summary_callback,=# save_solution, #=analysis_callback,=# alive_callback, stepsize_callback) ############################################################################### @@ -42,4 +42,4 @@ callbacks = CallbackSet(summary_callback, save_solution, analysis_callback, aliv sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),#Euler(), dt = 5.0e-2, # solve needs some value here but it will be overwritten by the stepsize_callback save_everystep = false, callback = callbacks); -summary_callback() +# summary_callback() diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 0a26bbdbebe..85c9d444e72 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -233,6 +233,7 @@ end # This method gets called internally as the main entry point to the AnalysiCallback # TODO: Taal refactor, allow passing an IO object (which could be devnull to avoid cluttering the console) function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi) + println("Start of analysis_callback") mesh, equations, solver, cache = mesh_equations_solver_cache(semi) @unpack dt, t = integrator iter = integrator.stats.naccept diff --git a/src/solvers/fv_t8code/fv.jl b/src/solvers/fv_t8code/fv.jl index e531c6ee8a5..d6bd6e17782 100644 --- a/src/solvers/fv_t8code/fv.jl +++ b/src/solvers/fv_t8code/fv.jl @@ -162,43 +162,44 @@ end function rhs!(du, u, t, mesh::T8codeMesh, equations, boundary_conditions, source_terms::Source, solver::FV, cache) where {Source} + println("1. Start of actual rhs!") # Reset du @trixi_timeit timer() "reset ∂u/∂t" du.=zero(eltype(du)) - + println("2. actual rhs!") # Exchange solution between MPI ranks @trixi_timeit timer() "exchange_solution_data!" exchange_solution_data!(u, mesh, equations, solver, cache) - + println("3. of actual rhs!") @trixi_timeit timer() "gradient reconstruction" calc_gradient_reconstruction!(u, mesh, equations, solver, cache) - + println("4. of actual rhs!") # Prolong solution to interfaces @trixi_timeit timer() "prolong2interfaces" begin prolong2interfaces!(cache, mesh, equations, solver) end - + println("5. of actual rhs!") # Calculate interface fluxes @trixi_timeit timer() "interface flux" begin calc_interface_flux!(du, mesh, have_nonconservative_terms(equations), equations, solver, cache) end - + println("6. of actual rhs!") # Prolong solution to boundaries @trixi_timeit timer() "prolong2boundaries!" begin prolong2boundaries!(cache, mesh, equations, solver) end - + println("7. of actual rhs!") # Calculate boundary fluxes @trixi_timeit timer() "calc boundary flux" begin calc_boundary_flux!(du, cache, t, boundary_conditions, mesh, equations, solver) end - + println("8. of actual rhs!") @trixi_timeit timer() "volume" begin for element in eachelement(mesh, solver, cache) volume = cache.elements.volume[element] @@ -207,12 +208,12 @@ function rhs!(du, u, t, mesh::T8codeMesh, equations, end end end - + println("9. of actual rhs!") # Calculate source terms @trixi_timeit timer() "source terms" begin calc_sources!(du, u, t, source_terms, mesh, equations, solver, cache) end - + println("10. End of actual rhs!") return nothing end