From 23271b4087881e223a9ae34971b2ac38bfe36829 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 15 Aug 2024 10:52:51 +0200 Subject: [PATCH 1/5] Remove `initial_condition` from `rhs!`, `rhs_parabolic!` --- src/semidiscretization/semidiscretization.jl | 2 +- src/semidiscretization/semidiscretization_hyperbolic.jl | 4 ++-- .../semidiscretization_hyperbolic_parabolic.jl | 7 +++---- src/solvers/dgmulti/dg.jl | 2 +- src/solvers/dgmulti/dg_parabolic.jl | 2 +- src/solvers/dgmulti/flux_differencing.jl | 4 ++-- src/solvers/dgmulti/flux_differencing_gauss_sbp.jl | 2 +- src/solvers/dgsem_p4est/dg_2d_parabolic.jl | 2 +- src/solvers/dgsem_p4est/dg_3d_parallel.jl | 2 +- src/solvers/dgsem_structured/dg_1d.jl | 2 +- src/solvers/dgsem_structured/dg_2d.jl | 2 +- src/solvers/dgsem_structured/dg_3d.jl | 2 +- src/solvers/dgsem_tree/dg_1d.jl | 2 +- src/solvers/dgsem_tree/dg_1d_parabolic.jl | 2 +- src/solvers/dgsem_tree/dg_2d.jl | 2 +- src/solvers/dgsem_tree/dg_2d_parabolic.jl | 2 +- src/solvers/dgsem_tree/dg_2d_parallel.jl | 2 +- src/solvers/dgsem_tree/dg_3d.jl | 2 +- src/solvers/dgsem_unstructured/dg_2d.jl | 2 +- 19 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/semidiscretization/semidiscretization.jl b/src/semidiscretization/semidiscretization.jl index c6b82d5f37b..4fef0a893ce 100644 --- a/src/semidiscretization/semidiscretization.jl +++ b/src/semidiscretization/semidiscretization.jl @@ -421,7 +421,7 @@ end # - calc_error_norms(func, u, t, analyzer, mesh, equations, initial_condition, solver, cache, cache_analysis) # - allocate_coefficients(mesh, equations, solver, cache) # - compute_coefficients!(u, func, mesh, equations, solver, cache) -# - rhs!(du, u, t, mesh, equations, initial_condition, boundary_conditions, source_terms, solver, cache) +# - rhs!(du, u, t, mesh, equations, boundary_conditions, source_terms, solver, cache) # end # @muladd diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 7c82a132a0b..a93745f2132 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -409,14 +409,14 @@ function compute_coefficients!(u_ode, t, semi::SemidiscretizationHyperbolic) end function rhs!(du_ode, u_ode, semi::SemidiscretizationHyperbolic, t) - @unpack mesh, equations, initial_condition, boundary_conditions, source_terms, solver, cache = semi + @unpack mesh, equations, boundary_conditions, source_terms, solver, cache = semi u = wrap_array(u_ode, mesh, equations, solver, cache) du = wrap_array(du_ode, mesh, equations, solver, cache) # TODO: Taal decide, do we need to pass the mesh? time_start = time_ns() - @trixi_timeit timer() "rhs!" rhs!(du, u, t, mesh, equations, initial_condition, + @trixi_timeit timer() "rhs!" rhs!(du, u, t, mesh, equations, boundary_conditions, source_terms, solver, cache) runtime = time_ns() - time_start put!(semi.performance_counter, runtime) diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 16f8da21c1e..87204843ed9 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -296,14 +296,14 @@ function semidiscretize(semi::SemidiscretizationHyperbolicParabolic, tspan; end function rhs!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabolic, t) - @unpack mesh, equations, initial_condition, boundary_conditions, source_terms, solver, cache = semi + @unpack mesh, equations, boundary_conditions, source_terms, solver, cache = semi u = wrap_array(u_ode, mesh, equations, solver, cache) du = wrap_array(du_ode, mesh, equations, solver, cache) # TODO: Taal decide, do we need to pass the mesh? time_start = time_ns() - @trixi_timeit timer() "rhs!" rhs!(du, u, t, mesh, equations, initial_condition, + @trixi_timeit timer() "rhs!" rhs!(du, u, t, mesh, equations, boundary_conditions, source_terms, solver, cache) runtime = time_ns() - time_start put!(semi.performance_counter.counters[1], runtime) @@ -312,7 +312,7 @@ function rhs!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabolic, t) end function rhs_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabolic, t) - @unpack mesh, equations_parabolic, initial_condition, boundary_conditions_parabolic, source_terms, solver, solver_parabolic, cache, cache_parabolic = semi + @unpack mesh, equations_parabolic, boundary_conditions_parabolic, source_terms, solver, solver_parabolic, cache, cache_parabolic = semi u = wrap_array(u_ode, mesh, equations_parabolic, solver, cache_parabolic) du = wrap_array(du_ode, mesh, equations_parabolic, solver, cache_parabolic) @@ -321,7 +321,6 @@ function rhs_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabol time_start = time_ns() @trixi_timeit timer() "parabolic rhs!" rhs_parabolic!(du, u, t, mesh, equations_parabolic, - initial_condition, boundary_conditions_parabolic, source_terms, solver, solver_parabolic, diff --git a/src/solvers/dgmulti/dg.jl b/src/solvers/dgmulti/dg.jl index 695260f4b9b..be7dd3241d3 100644 --- a/src/solvers/dgmulti/dg.jl +++ b/src/solvers/dgmulti/dg.jl @@ -642,7 +642,7 @@ function calc_sources!(du, u, t, source_terms, end function rhs!(du, u, t, mesh, equations, - initial_condition, boundary_conditions::BC, source_terms::Source, + boundary_conditions::BC, source_terms::Source, dg::DGMulti, cache) where {BC, Source} @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgmulti/dg_parabolic.jl b/src/solvers/dgmulti/dg_parabolic.jl index 7dfe4430244..c0ecb4f1b5d 100644 --- a/src/solvers/dgmulti/dg_parabolic.jl +++ b/src/solvers/dgmulti/dg_parabolic.jl @@ -426,7 +426,7 @@ end # boundary conditions will be applied to both grad(u) and div(u). function rhs_parabolic!(du, u, t, mesh::DGMultiMesh, equations_parabolic::AbstractEquationsParabolic, - initial_condition, boundary_conditions, source_terms, + boundary_conditions, source_terms, dg::DGMulti, parabolic_scheme, cache, cache_parabolic) reset_du!(du, dg) diff --git a/src/solvers/dgmulti/flux_differencing.jl b/src/solvers/dgmulti/flux_differencing.jl index 36aa50dff4e..a2edf4ceca8 100644 --- a/src/solvers/dgmulti/flux_differencing.jl +++ b/src/solvers/dgmulti/flux_differencing.jl @@ -620,7 +620,7 @@ end # an entropy conservative/stable discretization. For modal DG schemes, an extra `entropy_projection!` # is required (see https://doi.org/10.1016/j.jcp.2018.02.033, Section 4.3). # Also called by DGMultiFluxDiff{<:GaussSBP} solvers. -function rhs!(du, u, t, mesh, equations, initial_condition, boundary_conditions::BC, +function rhs!(du, u, t, mesh, equations, boundary_conditions::BC, source_terms::Source, dg::DGMultiFluxDiff, cache) where {Source, BC} @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) @@ -666,7 +666,7 @@ end # for such schemes is very similar to the implementation of `rhs!` for standard DG methods, # but specializes `calc_volume_integral`. function rhs!(du, u, t, mesh, equations, - initial_condition, boundary_conditions::BC, source_terms::Source, + boundary_conditions::BC, source_terms::Source, dg::DGMultiFluxDiffSBP, cache) where {BC, Source} @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl b/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl index 63a37f6780b..5be36a62d7b 100644 --- a/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl +++ b/src/solvers/dgmulti/flux_differencing_gauss_sbp.jl @@ -582,7 +582,7 @@ end # Specialize RHS so that we can call `invert_jacobian_and_interpolate!` instead of just `invert_jacobian!`, # since `invert_jacobian!` is also used in other places (e.g., parabolic terms). -function rhs!(du, u, t, mesh, equations, initial_condition, boundary_conditions::BC, +function rhs!(du, u, t, mesh, equations, boundary_conditions::BC, source_terms::Source, dg::DGMultiFluxDiff{<:GaussSBP}, cache) where {Source, BC} @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_p4est/dg_2d_parabolic.jl b/src/solvers/dgsem_p4est/dg_2d_parabolic.jl index ed21f371449..24a561dd049 100644 --- a/src/solvers/dgsem_p4est/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_p4est/dg_2d_parabolic.jl @@ -51,7 +51,7 @@ instead of =# function rhs_parabolic!(du, u, t, mesh::Union{P4estMesh{2}, P4estMesh{3}}, equations_parabolic::AbstractEquationsParabolic, - initial_condition, boundary_conditions_parabolic, source_terms, + boundary_conditions_parabolic, source_terms, dg::DG, parabolic_scheme, cache, cache_parabolic) @unpack viscous_container = cache_parabolic @unpack u_transformed, gradients, flux_viscous = viscous_container diff --git a/src/solvers/dgsem_p4est/dg_3d_parallel.jl b/src/solvers/dgsem_p4est/dg_3d_parallel.jl index e504e06d2c4..635c8dc795e 100644 --- a/src/solvers/dgsem_p4est/dg_3d_parallel.jl +++ b/src/solvers/dgsem_p4est/dg_3d_parallel.jl @@ -7,7 +7,7 @@ function rhs!(du, u, t, mesh::Union{ParallelP4estMesh{3}, ParallelT8codeMesh{3}}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Start to receive MPI data @trixi_timeit timer() "start MPI receive" start_mpi_receive!(cache.mpi_cache) diff --git a/src/solvers/dgsem_structured/dg_1d.jl b/src/solvers/dgsem_structured/dg_1d.jl index 3d63cc5af36..4827063559b 100644 --- a/src/solvers/dgsem_structured/dg_1d.jl +++ b/src/solvers/dgsem_structured/dg_1d.jl @@ -7,7 +7,7 @@ function rhs!(du, u, t, mesh::StructuredMesh{1}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_structured/dg_2d.jl b/src/solvers/dgsem_structured/dg_2d.jl index 51b91eac6be..0f52c420f1d 100644 --- a/src/solvers/dgsem_structured/dg_2d.jl +++ b/src/solvers/dgsem_structured/dg_2d.jl @@ -7,7 +7,7 @@ function rhs!(du, u, t, mesh::Union{StructuredMesh{2}, StructuredMeshView{2}}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_structured/dg_3d.jl b/src/solvers/dgsem_structured/dg_3d.jl index 1df9f408895..fc0aec43f19 100644 --- a/src/solvers/dgsem_structured/dg_3d.jl +++ b/src/solvers/dgsem_structured/dg_3d.jl @@ -7,7 +7,7 @@ function rhs!(du, u, t, mesh::StructuredMesh{3}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_tree/dg_1d.jl b/src/solvers/dgsem_tree/dg_1d.jl index 225b85a0598..84a5fd45f3c 100644 --- a/src/solvers/dgsem_tree/dg_1d.jl +++ b/src/solvers/dgsem_tree/dg_1d.jl @@ -76,7 +76,7 @@ end function rhs!(du, u, t, mesh::TreeMesh{1}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_tree/dg_1d_parabolic.jl b/src/solvers/dgsem_tree/dg_1d_parabolic.jl index 0017f9ca88e..5449f6d5208 100644 --- a/src/solvers/dgsem_tree/dg_1d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_1d_parabolic.jl @@ -15,7 +15,7 @@ # boundary conditions will be applied to both grad(u) and div(f(u, grad(u))). function rhs_parabolic!(du, u, t, mesh::TreeMesh{1}, equations_parabolic::AbstractEquationsParabolic, - initial_condition, boundary_conditions_parabolic, source_terms, + boundary_conditions_parabolic, source_terms, dg::DG, parabolic_scheme, cache, cache_parabolic) @unpack viscous_container = cache_parabolic @unpack u_transformed, gradients, flux_viscous = viscous_container diff --git a/src/solvers/dgsem_tree/dg_2d.jl b/src/solvers/dgsem_tree/dg_2d.jl index 4f2c72cd677..52392ffe480 100644 --- a/src/solvers/dgsem_tree/dg_2d.jl +++ b/src/solvers/dgsem_tree/dg_2d.jl @@ -112,7 +112,7 @@ end function rhs!(du, u, t, mesh::Union{TreeMesh{2}, P4estMesh{2}, T8codeMesh{2}}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_tree/dg_2d_parabolic.jl b/src/solvers/dgsem_tree/dg_2d_parabolic.jl index a6c962e03cd..92a14f032e6 100644 --- a/src/solvers/dgsem_tree/dg_2d_parabolic.jl +++ b/src/solvers/dgsem_tree/dg_2d_parabolic.jl @@ -15,7 +15,7 @@ # boundary conditions will be applied to both grad(u) and div(f(u, grad(u))). function rhs_parabolic!(du, u, t, mesh::Union{TreeMesh{2}, TreeMesh{3}}, equations_parabolic::AbstractEquationsParabolic, - initial_condition, boundary_conditions_parabolic, source_terms, + boundary_conditions_parabolic, source_terms, dg::DG, parabolic_scheme, cache, cache_parabolic) @unpack viscous_container = cache_parabolic @unpack u_transformed, gradients, flux_viscous = viscous_container diff --git a/src/solvers/dgsem_tree/dg_2d_parallel.jl b/src/solvers/dgsem_tree/dg_2d_parallel.jl index 157d462aa2f..906b83dd383 100644 --- a/src/solvers/dgsem_tree/dg_2d_parallel.jl +++ b/src/solvers/dgsem_tree/dg_2d_parallel.jl @@ -448,7 +448,7 @@ end function rhs!(du, u, t, mesh::Union{ParallelTreeMesh{2}, ParallelP4estMesh{2}, ParallelT8codeMesh{2}}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Start to receive MPI data @trixi_timeit timer() "start MPI receive" start_mpi_receive!(cache.mpi_cache) diff --git a/src/solvers/dgsem_tree/dg_3d.jl b/src/solvers/dgsem_tree/dg_3d.jl index 2e7e882f5ef..05d4bfbbe3e 100644 --- a/src/solvers/dgsem_tree/dg_3d.jl +++ b/src/solvers/dgsem_tree/dg_3d.jl @@ -144,7 +144,7 @@ end function rhs!(du, u, t, mesh::Union{TreeMesh{3}, P4estMesh{3}, T8codeMesh{3}}, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) diff --git a/src/solvers/dgsem_unstructured/dg_2d.jl b/src/solvers/dgsem_unstructured/dg_2d.jl index ce602e178d8..6abd7cff601 100644 --- a/src/solvers/dgsem_unstructured/dg_2d.jl +++ b/src/solvers/dgsem_unstructured/dg_2d.jl @@ -33,7 +33,7 @@ end function rhs!(du, u, t, mesh::UnstructuredMesh2D, equations, - initial_condition, boundary_conditions, source_terms::Source, + boundary_conditions, source_terms::Source, dg::DG, cache) where {Source} # Reset du @trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache) From 02ea229c477d385e2a474927a378935e651b843e Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 15 Aug 2024 10:56:42 +0200 Subject: [PATCH 2/5] remove from docs --- .../src/rhs_structure_figure.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/literate/src/files/behind_the_scenes_simulation_setup_plots/src/rhs_structure_figure.jl b/docs/literate/src/files/behind_the_scenes_simulation_setup_plots/src/rhs_structure_figure.jl index 19083dad68c..75c2e03188b 100644 --- a/docs/literate/src/files/behind_the_scenes_simulation_setup_plots/src/rhs_structure_figure.jl +++ b/docs/literate/src/files/behind_the_scenes_simulation_setup_plots/src/rhs_structure_figure.jl @@ -35,7 +35,7 @@ plot!(Shape([(-1.7,-11), (1.7,-11), (1.7,-17), (-1.7,-17)]), linecolor=:blue, fi annotate!(1.5, -14, ("Trixi.jl", 12, :blue, :center)) plot!(Shape([(-1.4,-14.5), (1.4,-14.5), (1.4,-16.5), (-1.4,-16.5)]), linecolor="black", fillcolor="white", label=false,linewidth=2) -annotate!(0, -15.5, ("Trixi.rhs!(du, u, t, mesh, equations, initial_condition, \nboundary_conditions, source_terms, dg, cache)", 12, :black, :center)) +annotate!(0, -15.5, ("Trixi.rhs!(du, u, t, mesh, equations, \nboundary_conditions, source_terms, dg, cache)", 12, :black, :center)) From b9573b555d11eb5d403657ab3af4843a216548ee Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 7 Oct 2024 06:14:51 +0000 Subject: [PATCH 3/5] news entry --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 37711d8e575..923ccaaa3ed 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,8 @@ for human readability. - We removed the first argument `semi` corresponding to a `Semidiscretization` from the `AnalysisSurfaceIntegral` constructor, as it is no longer needed (see [#1959]). The `AnalysisSurfaceIntegral` now only takes the arguments `boundary_symbols` and `variable`. ([#2069]) +- In functions `rhs!`, `rhs_parabolic` we removed the unused argument `initial_condition`. + Users should not be affected by this. ## Changes in the v0.8 lifecycle From c81b47123a659f41b1069722f1baf456a38dfa8f Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 7 Oct 2024 08:15:25 +0200 Subject: [PATCH 4/5] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 923ccaaa3ed..5a3463379cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ for human readability. - We removed the first argument `semi` corresponding to a `Semidiscretization` from the `AnalysisSurfaceIntegral` constructor, as it is no longer needed (see [#1959]). The `AnalysisSurfaceIntegral` now only takes the arguments `boundary_symbols` and `variable`. ([#2069]) -- In functions `rhs!`, `rhs_parabolic` we removed the unused argument `initial_condition`. +- In functions `rhs!`, `rhs_parabolic!` we removed the unused argument `initial_condition`. Users should not be affected by this. ## Changes in the v0.8 lifecycle From 77d4869c90574183d7f1e7a08c10ccc722e1ed9e Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 7 Oct 2024 08:18:07 +0200 Subject: [PATCH 5/5] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 5a3463379cd..3d64f7b78f7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,7 @@ for human readability. - We removed the first argument `semi` corresponding to a `Semidiscretization` from the `AnalysisSurfaceIntegral` constructor, as it is no longer needed (see [#1959]). The `AnalysisSurfaceIntegral` now only takes the arguments `boundary_symbols` and `variable`. ([#2069]) -- In functions `rhs!`, `rhs_parabolic!` we removed the unused argument `initial_condition`. +- In functions `rhs!`, `rhs_parabolic!` we removed the unused argument `initial_condition`. ([#2037]) Users should not be affected by this. ## Changes in the v0.8 lifecycle