Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/solvers/dgmulti/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function allocate_nested_array(uEltype, nvars, array_dimensions, dg)
nvars))
end

function reset_du!(du, dg::DGMulti, other_args...)
function set_zero!(du, dg::DGMulti, other_args...)
@threaded for i in eachindex(du)
du[i] = zero(eltype(du))
end
Expand Down Expand Up @@ -665,7 +665,7 @@ end
function rhs!(du, u, t, mesh, equations,
boundary_conditions::BC, source_terms::Source,
dg::DGMulti, cache) where {BC, Source}
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

@trixi_timeit timer() "volume integral" begin
calc_volume_integral!(du, u, mesh,
Expand Down
8 changes: 4 additions & 4 deletions src/solvers/dgmulti/dg_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function calc_gradient!(gradients, u::StructArray, t, mesh::DGMultiMesh,
boundary_conditions, dg::DGMulti, parabolic_scheme,
cache, cache_parabolic)
for dim in eachindex(gradients)
reset_du!(gradients[dim], dg)
set_zero!(gradients[dim], dg)
end

calc_gradient_volume_integral!(gradients, u, mesh, equations, dg, cache,
Expand Down Expand Up @@ -303,7 +303,7 @@ function calc_viscous_fluxes!(flux_viscous, u, gradients, mesh::DGMultiMesh,
equations::AbstractEquationsParabolic,
dg::DGMulti, cache, cache_parabolic)
for dim in eachdim(mesh)
reset_du!(flux_viscous[dim], dg)
set_zero!(flux_viscous[dim], dg)
end

(; local_u_values_threaded) = cache_parabolic
Expand Down Expand Up @@ -430,7 +430,7 @@ function calc_divergence!(du, u::StructArray, t, flux_viscous, mesh::DGMultiMesh
equations::AbstractEquationsParabolic,
boundary_conditions, dg::DGMulti, parabolic_scheme, cache,
cache_parabolic)
reset_du!(du, dg)
set_zero!(du, dg)

calc_divergence_volume_integral!(du, u, flux_viscous, mesh, equations, dg, cache,
cache_parabolic)
Expand Down Expand Up @@ -474,7 +474,7 @@ function rhs_parabolic!(du, u, t, mesh::DGMultiMesh,
equations_parabolic::AbstractEquationsParabolic,
boundary_conditions, source_terms,
dg::DGMulti, parabolic_scheme, cache, cache_parabolic)
reset_du!(du, dg)
set_zero!(du, dg)

@trixi_timeit timer() "transform variables" begin
(; u_transformed, gradients, flux_viscous) = cache_parabolic
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 @@ -618,7 +618,7 @@ end
# Also called by DGMultiFluxDiff{<:GaussSBP} solvers.
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)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# this function evaluates the solution at volume and face quadrature points (which was previously
# done in `prolong2interfaces` and `calc_volume_integral`)
Expand Down Expand Up @@ -664,7 +664,7 @@ end
function rhs!(du, u, t, mesh, equations,
boundary_conditions::BC, source_terms::Source,
dg::DGMultiFluxDiffSBP, cache) where {BC, Source}
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

@trixi_timeit timer() "volume integral" calc_volume_integral!(du, u, mesh,
have_nonconservative_terms(equations),
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 @@ -585,7 +585,7 @@ end
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)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# this function evaluates the solution at volume and face quadrature points (which was previously
# done in `prolong2interfaces` and `calc_volume_integral`)
Expand Down
6 changes: 3 additions & 3 deletions src/solvers/dgsem_p4est/dg_2d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function rhs_parabolic!(du, u, t, mesh::Union{P4estMesh{2}, P4estMesh{3}},
# TODO: parabolic; reconsider current data structure reuse strategy

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down Expand Up @@ -158,8 +158,8 @@ function calc_gradient!(gradients, u_transformed, t,

# Reset du
@trixi_timeit timer() "reset gradients" begin
reset_du!(gradients_x, dg, cache)
reset_du!(gradients_y, dg, cache)
set_zero!(gradients_x, dg, cache)
set_zero!(gradients_y, dg, cache)
end

# Calculate volume integral
Expand Down
6 changes: 3 additions & 3 deletions src/solvers/dgsem_p4est/dg_3d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ function calc_gradient!(gradients, u_transformed, t,

# Reset du
@trixi_timeit timer() "reset gradients" begin
reset_du!(gradients_x, dg, cache)
reset_du!(gradients_y, dg, cache)
reset_du!(gradients_z, dg, cache)
set_zero!(gradients_x, dg, cache)
set_zero!(gradients_y, dg, cache)
set_zero!(gradients_z, dg, cache)
end

# Calculate volume integral
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 @@ -29,7 +29,7 @@ function rhs!(du, u, t,
end

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_structured/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function rhs!(du, u, t,
boundary_conditions, source_terms::Source,
dg::DG, cache) where {Source}
# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/dgsem_tree/dg_1d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function rhs_parabolic!(du, u, t, mesh::TreeMesh{1},
# TODO: parabolic; reconsider current data structure reuse strategy

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down Expand Up @@ -508,7 +508,7 @@ function calc_gradient!(gradients, u_transformed, t, mesh::TreeMesh{1},

# Reset du
@trixi_timeit timer() "reset gradients" begin
reset_du!(gradients, dg, cache)
set_zero!(gradients, dg, cache)
end

# Calculate volume integral
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 @@ -111,7 +111,7 @@ function rhs!(du, u, t,
boundary_conditions, source_terms::Source,
dg::DG, cache) where {Source}
# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down
6 changes: 3 additions & 3 deletions src/solvers/dgsem_tree/dg_2d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function rhs_parabolic!(du, u, t, mesh::Union{TreeMesh{2}, TreeMesh{3}},
# TODO: parabolic; reconsider current data structure reuse strategy

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down Expand Up @@ -906,8 +906,8 @@ function calc_gradient!(gradients, u_transformed, t,

# Reset du
@trixi_timeit timer() "reset gradients" begin
reset_du!(gradients_x, dg, cache)
reset_du!(gradients_y, dg, cache)
set_zero!(gradients_x, dg, cache)
set_zero!(gradients_y, dg, cache)
end

# Calculate volume integral
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 @@ -472,7 +472,7 @@ function rhs!(du, u, t,
end

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down
6 changes: 3 additions & 3 deletions src/solvers/dgsem_tree/dg_3d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1091,9 +1091,9 @@ function calc_gradient!(gradients, u_transformed, t,

# Reset du
@trixi_timeit timer() "reset gradients" begin
reset_du!(gradients_x, dg, cache)
reset_du!(gradients_y, dg, cache)
reset_du!(gradients_z, dg, cache)
set_zero!(gradients_x, dg, cache)
set_zero!(gradients_y, dg, cache)
set_zero!(gradients_z, dg, cache)
end

# Calculate volume integral
Expand Down
3 changes: 1 addition & 2 deletions src/solvers/dgsem_tree/subcell_limiters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ function (limiter::SubcellLimiterIDP)(u, semi, equations, dg::DGSEM,
t, dt;
kwargs...)
@unpack alpha = limiter.cache.subcell_limiter_coefficients
# TODO: Do not abuse `reset_du!` but maybe implement a generic `set_zero!`
@trixi_timeit timer() "reset alpha" reset_du!(alpha, dg, semi.cache)
@trixi_timeit timer() "reset alpha" set_zero!(alpha, dg, semi.cache)

if limiter.local_twosided
@trixi_timeit timer() "local twosided" idp_local_twosided!(alpha, limiter,
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 @@ -39,7 +39,7 @@ function rhs!(du, u, t,
boundary_conditions, source_terms::Source,
dg::DG, cache) where {Source}
# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)
@trixi_timeit timer() "reset ∂u/∂t" set_zero!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#! format: noindent

# Used by both `dg::DGSEM` and `dg::FDSBP`
function reset_du!(du, dg, cache)
function set_zero!(du, dg, cache)
# du .= zero(eltype(du)) doesn't scale when using multiple threads.
# See https://github.com/trixi-framework/Trixi.jl/pull/924 for a performance comparison.
@threaded for element in eachelement(dg, cache)
Expand Down
Loading