Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
remove implicit multiplication; fix comment

Co-authored-by: Andrew Winters <[email protected]>
  • Loading branch information
patrickersing and andrewwinters5000 authored Apr 25, 2024
1 parent db5f660 commit 6fc27e2
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ function initial_condition_discontinuous_dam_break(x, t, element_id,
IDs = [1, 2, 5, 6, 9, 10, 13, 14]
if element_id in IDs
H = SVector(1.0, 0.8, 0.6)
# Right side of discontinuity
else
else # Right side of discontinuity
H = SVector(0.9, 0.7, 0.5)
b += 0.1
end
Expand Down
158 changes: 79 additions & 79 deletions src/equations/shallow_water_multilayer_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,85 +168,85 @@ in non-periodic domains).
# this manufactured solution velocity is taken to be constant
ω = 2 * pi * sqrt(2.0)

du1 = -0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) -
0.1cos(t + x[1] * ω) - 0.1cos(t + x[2] * ω) * ω +
0.8(-0.1sin(t + x[1] * ω) * ω - 0.1cos(t + x[1] * ω) * ω) -
0.1sin(t + x[2] * ω) * ω

du2 = 0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) + 0.1sin(t + x[2] * ω) +
0.1cos(t + x[1] * ω) + 0.1cos(t + x[2] * ω) * ω +
0.8(0.1sin(t + x[1] * ω) * ω + 0.1cos(t + x[1] * ω) * ω) +
0.1sin(t + x[2] * ω) * ω

du3 = -0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) + 0.1sin(x[2] * ω) * ω +
0.8(0.1sin(x[1] * ω) * ω - 0.1sin(t + x[1] * ω) * ω) -
0.1sin(t + x[2] * ω) * ω

du4 = 0.8(-0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) -
0.1cos(t + x[1] * ω)) +
0.8(-0.1cos(t + x[2] * ω) * ω - 0.1sin(t + x[2] * ω) * ω) +
0.8^2 * (-0.1sin(t + x[1] * ω) * ω - 0.1cos(t + x[1] * ω) * ω) +
10.0(2.0 + 0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) -
0.1sin(t + x[2] * ω) + 0.1cos(t + x[1] * ω)) *
(-0.1sin(t + x[1] * ω) * ω - 0.1cos(t + x[1] * ω) * ω) +
(2.0 + 0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) +
0.1cos(t + x[1] * ω)) * cos(t + x[1] * ω) * ω

du5 = 0.8(0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) + 0.1sin(t + x[2] * ω) +
0.1cos(t + x[1] * ω)) +
0.8(0.1cos(t + x[2] * ω) * ω + 0.1sin(t + x[2] * ω) * ω) +
0.8^2 * (0.1sin(t + x[1] * ω) * ω + 0.1cos(t + x[1] * ω) * ω) +
10.0(0.5 - 0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) +
0.1sin(t + x[2] * ω) - 0.1cos(t + x[1] * ω)) *
(0.1sin(t + x[1] * ω) * ω + 0.1cos(t + x[1] * ω) * ω) +
10.0(0.5 - 0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) +
0.1sin(t + x[2] * ω) - 0.1cos(t + x[1] * ω)) *
(-0.1sin(t + x[1] * ω) * ω +
0.9(-0.1sin(t + x[1] * ω) * ω - 0.1cos(t + x[1] * ω) * ω))

du6 = 0.8(-0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω)) +
0.8(0.1sin(x[2] * ω) * ω - 0.1sin(t + x[2] * ω) * ω) +
0.8^2 * (0.1sin(x[1] * ω) * ω - 0.1sin(t + x[1] * ω) * ω) +
10.0(0.5 - 0.1cos(x[1] * ω) + 0.1cos(t + x[2] * ω) - 0.1cos(x[2] * ω) +
0.1cos(t + x[1] * ω)) *
(0.1sin(x[1] * ω) * ω - 0.1sin(t + x[1] * ω) * ω) +
10.0(0.5 - 0.1cos(x[1] * ω) + 0.1cos(t + x[2] * ω) - 0.1cos(x[2] * ω) +
0.1cos(t + x[1] * ω)) * (-0.1sin(x[1] * ω) * ω +
0.9 / 1.1 * (-0.1sin(t + x[1] * ω) * ω - 0.1cos(t + x[1] * ω) * ω) +
1.0 / 1.1 * (0.1sin(t + x[1] * ω) * ω + 0.1cos(t + x[1] * ω) * ω))

du7 = -0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) -
0.1cos(t + x[1] * ω) - 0.1cos(t + x[2] * ω) * ω +
0.8(-0.1sin(t + x[1] * ω) * ω - 0.1cos(t + x[1] * ω) * ω) -
0.1sin(t + x[2] * ω) * ω +
10.0(2.0 + 0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) -
0.1sin(t + x[2] * ω) + 0.1cos(t + x[1] * ω)) *
(-0.1cos(t + x[2] * ω) * ω - 0.1sin(t + x[2] * ω) * ω) +
(2.0 + 0.1cos(t + x[2] * ω) - 0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) +
0.1cos(t + x[1] * ω)) * cos(t + x[2] * ω) * ω

du8 = 0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) + 0.1sin(t + x[2] * ω) +
0.1cos(t + x[1] * ω) + 0.1cos(t + x[2] * ω) * ω +
0.8(0.1sin(t + x[1] * ω) * ω + 0.1cos(t + x[1] * ω) * ω) +
0.1sin(t + x[2] * ω) * ω +
10.0(0.5 - 0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) +
0.1sin(t + x[2] * ω) - 0.1cos(t + x[1] * ω)) *
(0.9(-0.1cos(t + x[2] * ω) * ω - 0.1sin(t + x[2] * ω) * ω) -
0.1sin(t + x[2] * ω) * ω) +
10.0(0.5 - 0.1cos(t + x[2] * ω) + 0.1sin(t + x[1] * ω) +
0.1sin(t + x[2] * ω) - 0.1cos(t + x[1] * ω)) *
(0.1cos(t + x[2] * ω) * ω + 0.1sin(t + x[2] * ω) * ω)

du9 = -0.1sin(t + x[1] * ω) - 0.1sin(t + x[2] * ω) + 0.1sin(x[2] * ω) * ω +
0.8(0.1sin(x[1] * ω) * ω - 0.1sin(t + x[1] * ω) * ω) -
0.1sin(t + x[2] * ω) * ω +
10.0(0.5 - 0.1cos(x[1] * ω) + 0.1cos(t + x[2] * ω) - 0.1cos(x[2] * ω) +
0.1cos(t + x[1] * ω)) *
(0.9 / 1.1 * (-0.1cos(t + x[2] * ω) * ω - 0.1sin(t + x[2] * ω) * ω) +
1.0 / 1.1 * (0.1cos(t + x[2] * ω) * ω + 0.1sin(t + x[2] * ω) * ω) -
0.1sin(x[2] * ω) * ω) +
10.0(0.5 - 0.1cos(x[1] * ω) + 0.1cos(t + x[2] * ω) - 0.1cos(x[2] * ω) +
0.1cos(t + x[1] * ω)) * (0.1sin(x[2] * ω) * ω - 0.1sin(t + x[2] * ω) * ω)
du1 = (-0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) -
0.1 * cos(t + x[1] * ω) - 0.1 * cos(t + x[2] * ω) * ω +
0.8 * (-0.1 * sin(t + x[1] * ω) * ω - 0.1 * cos(t + x[1] * ω) * ω) -
0.1 * sin(t + x[2] * ω) * ω)

du2 = (0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) + 0.1 * sin(t + x[2] * ω) +
0.1 * cos(t + x[1] * ω) + 0.1 * cos(t + x[2] * ω) * ω +
0.8 * (0.1 * sin(t + x[1] * ω) * ω + 0.1 * cos(t + x[1] * ω) * ω) +
0.1 * sin(t + x[2] * ω) * ω)

du3 = (-0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) + 0.1 * sin(x[2] * ω) * ω +
0.8 * (0.1 * sin(x[1] * ω) * ω - 0.1 * sin(t + x[1] * ω) * ω) -
0.1 * sin(t + x[2] * ω) * ω)

du4 = (0.8 * (-0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) -
0.1 * cos(t + x[1] * ω)) +
0.8 * (-0.1 * cos(t + x[2] * ω) * ω - 0.1 * sin(t + x[2] * ω) * ω) +
0.8^2 * (-0.1 * sin(t + x[1] * ω) * ω - 0.1 * cos(t + x[1] * ω) * ω) +
10.0 * (2.0 + 0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) -
0.1 * sin(t + x[2] * ω) + 0.1 * cos(t + x[1] * ω)) *
(-0.1 * sin(t + x[1] * ω) * ω - 0.1 * cos(t + x[1] * ω) * ω) +
(2.0 + 0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) +
0.1 * cos(t + x[1] * ω)) * cos(t + x[1] * ω) * ω)

du5 = (0.8 * (0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) + 0.1 * sin(t + x[2] * ω) +
0.1 * cos(t + x[1] * ω)) +
0.8 * (0.1 * cos(t + x[2] * ω) * ω + 0.1 * sin(t + x[2] * ω) * ω) +
0.8^2 * (0.1 * sin(t + x[1] * ω) * ω + 0.1 * cos(t + x[1] * ω) * ω) +
10.0 * (0.5 - 0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) +
0.1 * sin(t + x[2] * ω) - 0.1 * cos(t + x[1] * ω)) *
(0.1 * sin(t + x[1] * ω) * ω + 0.1 * cos(t + x[1] * ω) * ω) +
10.0 * (0.5 - 0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) +
0.1 * sin(t + x[2] * ω) - 0.1 * cos(t + x[1] * ω)) *
(-0.1 * sin(t + x[1] * ω) * ω +
0.9 * (-0.1 * sin(t + x[1] * ω) * ω - 0.1 * cos(t + x[1] * ω) * ω)))

du6 = (0.8 * (-0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω)) +
0.8 * (0.1 * sin(x[2] * ω) * ω - 0.1 * sin(t + x[2] * ω) * ω) +
0.8^2 * (0.1 * sin(x[1] * ω) * ω - 0.1 * sin(t + x[1] * ω) * ω) +
10.0 * (0.5 - 0.1 * cos(x[1] * ω) + 0.1 * cos(t + x[2] * ω) - 0.1 * cos(x[2] * ω) +
0.1 * cos(t + x[1] * ω)) *
(0.1 * sin(x[1] * ω) * ω - 0.1 * sin(t + x[1] * ω) * ω) +
10.0 * (0.5 - 0.1 * cos(x[1] * ω) + 0.1 * cos(t + x[2] * ω) - 0.1 * cos(x[2] * ω) +
0.1 * cos(t + x[1] * ω)) * (-0.1 * sin(x[1] * ω) * ω +
0.9 / 1.1 * (-0.1 * sin(t + x[1] * ω) * ω - 0.1 * cos(t + x[1] * ω) * ω) +
1.0 / 1.1 * (0.1 * sin(t + x[1] * ω) * ω + 0.1 * cos(t + x[1] * ω) * ω)))

du7 = (-0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) -
0.1 * cos(t + x[1] * ω) - 0.1 * cos(t + x[2] * ω) * ω +
0.8 * (-0.1 * sin(t + x[1] * ω) * ω - 0.1 * cos(t + x[1] * ω) * ω) -
0.1 * sin(t + x[2] * ω) * ω +
10.0 * (2.0 + 0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) -
0.1 * sin(t + x[2] * ω) + 0.1 * cos(t + x[1] * ω)) *
(-0.1 * cos(t + x[2] * ω) * ω - 0.1 * sin(t + x[2] * ω) * ω) +
(2.0 + 0.1 * cos(t + x[2] * ω) - 0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) +
0.1 * cos(t + x[1] * ω)) * cos(t + x[2] * ω) * ω)

du8 = (0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) + 0.1 * sin(t + x[2] * ω) +
0.1 * cos(t + x[1] * ω) + 0.1 * cos(t + x[2] * ω) * ω +
0.8 * (0.1 * sin(t + x[1] * ω) * ω + 0.1 * cos(t + x[1] * ω) * ω) +
0.1 * sin(t + x[2] * ω) * ω +
10.0 * (0.5 - 0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) +
0.1 * sin(t + x[2] * ω) - 0.1 * cos(t + x[1] * ω)) *
(0.9 * (-0.1 * cos(t + x[2] * ω) * ω - 0.1 * sin(t + x[2] * ω) * ω) -
0.1 * sin(t + x[2] * ω) * ω) +
10.0 * (0.5 - 0.1 * cos(t + x[2] * ω) + 0.1 * sin(t + x[1] * ω) +
0.1 * sin(t + x[2] * ω) - 0.1 * cos(t + x[1] * ω)) *
(0.1 * cos(t + x[2] * ω) * ω + 0.1 * sin(t + x[2] * ω) * ω))

du9 = (-0.1 * sin(t + x[1] * ω) - 0.1 * sin(t + x[2] * ω) + 0.1 * sin(x[2] * ω) * ω +
0.8 * (0.1 * sin(x[1] * ω) * ω - 0.1 * sin(t + x[1] * ω) * ω) -
0.1 * sin(t + x[2] * ω) * ω +
10.0 * (0.5 - 0.1 * cos(x[1] * ω) + 0.1 * cos(t + x[2] * ω) - 0.1 * cos(x[2] * ω) +
0.1 * cos(t + x[1] * ω)) *
(0.9 / 1.1 * (-0.1 * cos(t + x[2] * ω) * ω - 0.1 * sin(t + x[2] * ω) * ω) +
1.0 / 1.1 * (0.1 * cos(t + x[2] * ω) * ω + 0.1 * sin(t + x[2] * ω) * ω) -
0.1 * sin(x[2] * ω) * ω) +
10.0 * (0.5 - 0.1 * cos(x[1] * ω) + 0.1 * cos(t + x[2] * ω) - 0.1 * cos(x[2] * ω) +
0.1 * cos(t + x[1] * ω)) * (0.1 * sin(x[2] * ω) * ω - 0.1 * sin(t + x[2] * ω) * ω))

return SVector(du1, du2, du3, du4, du5, du6, du7, du8, du9, zero(eltype(u)))
end
Expand Down

0 comments on commit 6fc27e2

Please sign in to comment.