Skip to content

Commit 315c972

Browse files
committed
Merge branch 'main' of github.com:cwittens/DispersiveShallowWater.jl
2 parents 8de7e1c + 67a6ebd commit 315c972

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

examples/serre_green_naghdi_1d/serre_green_naghdi_manufactured.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ coordinates_max = 1.0
1919
N = 256
2020
mesh = Mesh1D(coordinates_min, coordinates_max, N)
2121

22-
#= for testing rhs_sgn_upwind! use:
22+
#= for testing upwind operators use:
2323
D1 = upwind_operators(periodic_derivative_operator;
2424
derivative_order = 1, accuracy_order = 4,
2525
xmin = xmin(mesh), xmax = xmax(mesh),
2626
N = nnodes(mesh))
2727
solver = Solver(D1, nothing)
2828
=#
2929

30-
# for testing rhs_sgn_central! use:
30+
# for testing central operators use:
3131
acc_order = 4
3232
solver = Solver(mesh, acc_order)
3333

src/equations/serre_green_naghdi_1d.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ A smooth manufactured solution in combination with [`source_terms_manufactured`]
110110
function 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))
117117
end
@@ -373,7 +373,6 @@ end
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-
377376
function 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,
395393
end
396394

397395
function 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

Comments
 (0)