Skip to content

Commit

Permalink
Remove initial_condition from rhs!, rhs_parabolic! (trixi-frame…
Browse files Browse the repository at this point in the history
…work#2037)

* Remove `initial_condition` from `rhs!`, `rhs_parabolic!`

* remove from docs

* news entry

* Update NEWS.md

* Update NEWS.md

---------

Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
DanielDoehring and ranocha authored Oct 7, 2024
1 parent fa43fb2 commit 480aea9
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 25 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))



Expand Down
2 changes: 1 addition & 1 deletion src/semidiscretization/semidiscretization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/semidiscretization/semidiscretization_hyperbolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgmulti/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgmulti/dg_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/solvers/dgmulti/flux_differencing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgmulti/flux_differencing_gauss_sbp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_p4est/dg_2d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_p4est/dg_3d_parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_structured/dg_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_structured/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_structured/dg_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_1d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_2d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_2d_parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_unstructured/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 480aea9

Please sign in to comment.