From 480aea9a6731dc49eee3dfbe10a139560fdd80e1 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Mon, 7 Oct 2024 13:01:39 +0200 Subject: [PATCH] Remove `initial_condition` from `rhs!`, `rhs_parabolic!` (#2037) * Remove `initial_condition` from `rhs!`, `rhs_parabolic!` * remove from docs * news entry * Update NEWS.md * Update NEWS.md --------- Co-authored-by: Hendrik Ranocha --- NEWS.md | 2 ++ .../src/rhs_structure_figure.jl | 2 +- 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 +- 21 files changed, 26 insertions(+), 25 deletions(-) diff --git a/NEWS.md b/NEWS.md index 37711d8e575..3d64f7b78f7 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`. ([#2037]) + Users should not be affected by this. ## Changes in the v0.8 lifecycle 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)) 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 6c6aa5b457c..ffe74af14cf 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 4bf4c79ebee..23968a2bfac 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 6023c9e6192..39bece53ca9 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 e8430eaa491..616a6b15131 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 641c944d5f7..d9a8cc8bc6d 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 fb96e0535ad..034b1b73b82 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 734a31d5470..03f28659f5e 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 f84a08cb69b..9123a3bcd21 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 d7b76f5773a..d0287e00b88 100644 --- a/src/solvers/dgsem_tree/dg_2d_parallel.jl +++ b/src/solvers/dgsem_tree/dg_2d_parallel.jl @@ -450,7 +450,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 acd90cee09d..85150bc3040 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 a531ded91cc..1f8c1ffa16a 100644 --- a/src/solvers/dgsem_unstructured/dg_2d.jl +++ b/src/solvers/dgsem_unstructured/dg_2d.jl @@ -36,7 +36,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)