-
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 reflecting boundary conditions for
BBMBBMVariableEquations1D
(#109
) * add reflecting boundary conditions for BBMBBMVariableEquations1D * format * lower tolerance to make CI pass * lower tolerance
- Loading branch information
1 parent
338f8f8
commit 4eaa183
Showing
3 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
examples/bbm_bbm_variable_bathymetry_1d/bbm_bbm_variable_bathymetry_1d_basic_reflecting.jl
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 = BBMBBMVariableEquations1D(gravity_constant = 9.81) | ||
|
||
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