-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reflective boundary conditions for
BBMBBMEquations1D
(#104)
* add reflecting boundary conditions * use manufactured solution test case for reflective bc * add tests * format * fix compat of BandedMatrices * fix reference * fix another reference
- Loading branch information
1 parent
c9f4530
commit 7f0168e
Showing
10 changed files
with
191 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ authors = ["Joshua Lampert <[email protected]>"] | |
version = "0.3.3-pre" | ||
|
||
[deps] | ||
BandedMatrices = "aae01518-5342-5314-be14-df237901396f" | ||
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" | ||
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
|
@@ -21,6 +22,7 @@ TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" | |
TrixiBase = "9a0f1c46-06d5-4909-a5a3-ce25d3fa3284" | ||
|
||
[compat] | ||
BandedMatrices = "0.17, 1" | ||
DiffEqBase = "6.128" | ||
Interpolations = "0.14.2, 0.15" | ||
LinearAlgebra = "1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using OrdinaryDiffEq | ||
using DispersiveShallowWater | ||
using SummationByPartsOperators: MattssonNordström2004, derivative_operator | ||
|
||
############################################################################### | ||
# Semidiscretization of the BBM-BBM equations | ||
|
||
equations = BBMBBMEquations1D(gravity_constant = 9.81, D = 1.0) | ||
|
||
initial_condition = initial_condition_manufactured_reflecting | ||
source_terms = source_terms_manufactured_reflecting | ||
boundary_conditions = boundary_condition_reflecting | ||
|
||
# create homogeneous mesh | ||
coordinates_min = 0.0 | ||
coordinates_max = 1.0 | ||
N = 512 | ||
mesh = Mesh1D(coordinates_min, coordinates_max, N) | ||
|
||
# create solver with SBP operators of accuracy order 4 | ||
accuracy_order = 4 | ||
D1 = derivative_operator(MattssonNordström2004(), | ||
derivative_order = 1, accuracy_order = accuracy_order, | ||
xmin = mesh.xmin, xmax = mesh.xmax, N = mesh.N) | ||
D2 = derivative_operator(MattssonNordström2004(), | ||
derivative_order = 2, accuracy_order = accuracy_order, | ||
xmin = mesh.xmin, xmax = mesh.xmax, N = mesh.N) | ||
solver = Solver(D1, D2) | ||
|
||
# semidiscretization holds all the necessary data structures for the spatial discretization | ||
semi = Semidiscretization(mesh, equations, initial_condition, solver, | ||
boundary_conditions = boundary_conditions, | ||
source_terms = source_terms) | ||
|
||
############################################################################### | ||
# Create `ODEProblem` and run the simulation | ||
tspan = (0.0, 1.0) | ||
ode = semidiscretize(semi, tspan) | ||
summary_callback = SummaryCallback() | ||
analysis_callback = AnalysisCallback(semi; interval = 10, | ||
extra_analysis_errors = (:conservation_error,), | ||
extra_analysis_integrals = (waterheight_total, | ||
velocity, entropy)) | ||
callbacks = CallbackSet(analysis_callback, summary_callback) | ||
|
||
saveat = range(tspan..., length = 100) | ||
sol = solve(ode, Tsit5(), abstol = 1e-7, reltol = 1e-7, | ||
save_everystep = false, callback = callbacks, saveat = saveat) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters