Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
JoshuaLampert and ranocha authored Dec 10, 2024
1 parent 9e9d472 commit 874028b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/equations/svaerd_kalisch_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,7 @@ function create_cache(mesh, equations::SvaerdKalischEquations1D,
solver, initial_condition,
::BoundaryConditionReflecting,
RealT, uEltype)
if !isapprox(equations.alpha, 0, atol = 1e-14) ||
!isapprox(equations.gamma, 0, atol = 1e-14)
if !iszero(equations.alpha) || !iszero(equations.gamma,)
throw(ArgumentError("Reflecting boundary conditions for Svärd-Kalisch equations only implemented for alpha = gamma = 0"))
end
D1 = solver.D1
Expand All @@ -307,7 +306,7 @@ function create_cache(mesh, equations::SvaerdKalischEquations1D,
v_x = zero(h)
h_v_x = zero(h)
hv2_x = zero(h)
beta_hat = equations.beta * D .^ 3
beta_hat = equations.beta .* D .^ 3
Pd = BandedMatrix((-1 => fill(one(real(mesh)), N - 2),), (N, N - 2))
if D1 isa DerivativeOperator ||
D1 isa UniformCoupledOperator
Expand Down Expand Up @@ -437,6 +436,8 @@ end
function rhs!(dq, q, t, mesh, equations::SvaerdKalischEquations1D,
initial_condition, ::BoundaryConditionReflecting, source_terms,
solver, cache)
# When constructing the `cache`, we assert that alpha and gamma are zero.
# We use this explicitly in the code below.
(; D, h, hv, b, eta_x, v_x, h_v_x, hv2_x, tmp1, D1_central) = cache

g = gravity_constant(equations)
Expand All @@ -463,10 +464,6 @@ function rhs!(dq, q, t, mesh, equations::SvaerdKalischEquations1D,
g * h * eta_x)
end

# no split form
# dv[:] = -(D1_central * (hv .* v) - v .* (D1_central * hv)+
# g * h .* eta_x)

@trixi_timeit timer() "source terms" calc_sources!(dq, q, t, source_terms, equations,
solver)
@trixi_timeit timer() "assemble system matrix" begin
Expand Down

0 comments on commit 874028b

Please sign in to comment.