@@ -110,8 +110,8 @@ A smooth manufactured solution in combination with [`source_terms_manufactured`]
110110function initial_condition_manufactured (x, t,
111111 equations:: SerreGreenNaghdiEquations1D ,
112112 mesh)
113- h = 3 + cos ( pi * ( 2 * (x - 2 * t) ))
114- v = (1 + sin ( pi * ( 2 * (x - t / 2 ) )))
113+ h = 3 + cospi ( 2 * (x - 2 * t))
114+ v = (1 + sinpi ( 2 * (x - t / 2 )))
115115
116116 return SVector (h, v, zero (h))
117117end
373373# Structure-preserving approximations of the Serre-Green-Naghdi
374374# equations in standard and hyperbolic form
375375# [arXiv: 2408.02665](https://arxiv.org/abs/2408.02665)
376-
377376function rhs! (dq, q, t, mesh,
378377 equations:: SerreGreenNaghdiEquations1D ,
379378 initial_condition,
@@ -384,7 +383,6 @@ function rhs!(dq, q, t, mesh,
384383 rhs_sgn_upwind! (dq, q, t, equations, source_terms, solver, cache,
385384 equations. bathymetry_type,
386385 boundary_conditions)
387-
388386 else
389387 rhs_sgn_central! (dq, q, t, equations, source_terms, solver, cache,
390388 equations. bathymetry_type,
@@ -395,8 +393,7 @@ function rhs!(dq, q, t, mesh,
395393end
396394
397395function rhs_sgn_central! (dq, q, t, equations, source_terms, solver, cache,
398- :: BathymetryFlat ,
399- boundary_conditions:: BoundaryConditionPeriodic )
396+ :: BathymetryFlat , boundary_conditions:: BoundaryConditionPeriodic )
400397 # Unpack physical parameters and SBP operator `D1` as well as the
401398 # SBP operator in sparse matrix form `D1mat`
402399 g = gravity (equations)
@@ -497,7 +494,6 @@ function rhs_sgn_upwind!(dq, q, t, equations, source_terms, solver, cache, ::Bat
497494 # arrays for the water height `h` and the velocity `v`.
498495 eta, v, D = q. x
499496 dh, dv, dD = dq. x # dh = deta since b is constant in time
500-
501497 fill! (dD, zero (eltype (dD)))
502498
503499 @trixi_timeit timer () " hyperbolic terms" begin
@@ -562,9 +558,9 @@ function rhs_sgn_upwind!(dq, q, t, equations, source_terms, solver, cache, ::Bat
562558 # add source terms to the right-hand side to be solved for
563559 @. . tmp += dv
564560
561+ # The code below is equivalent to
565562 # dv .= (Diagonal(h) - D1mat_plus * Diagonal(1/3 .* h.^3) * D1mat_minus) \ tmp
566563 # but faster since the symbolic factorization is reused.
567-
568564 @trixi_timeit timer () " assembling elliptic operator" begin
569565 system_matrix = assemble_system_matrix! (cache, h,
570566 D1, D1mat_minus,
0 commit comments