-
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 support for source terms * fix calculation of source terms * add test for manufactured solution of variable BBM-BBM * fix test of convergence order * adjust tolerance * source terms for BBMBBMEquations * format * WIP: add source terms for Svärd-Kalisch equations * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <[email protected]> * add references * add support of source terms for Svärd-Kalisch equations with constant bathymetry * lower tolerances * fix tolerances * fix tolerances --------- Co-authored-by: Hendrik Ranocha <[email protected]>
- Loading branch information
1 parent
68e64f4
commit a7dcc23
Showing
13 changed files
with
395 additions
and
65 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using OrdinaryDiffEq | ||
using DispersiveShallowWater | ||
|
||
############################################################################### | ||
# Semidiscretization of the BBM-BBM equations | ||
|
||
equations = BBMBBMEquations1D(gravity_constant = 9.81, D = 4.0) | ||
|
||
initial_condition = initial_condition_manufactured | ||
source_terms = source_terms_manufactured | ||
boundary_conditions = boundary_condition_periodic | ||
|
||
# create homogeneous mesh | ||
coordinates_min = 0.0 | ||
coordinates_max = 1.0 | ||
N = 512 | ||
mesh = Mesh1D(coordinates_min, coordinates_max, N) | ||
|
||
# create solver with periodic SBP operators of accuracy order 4 | ||
accuracy_order = 4 | ||
solver = Solver(mesh, accuracy_order) | ||
|
||
# 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) | ||
analysis_callback = AnalysisCallback(semi; interval = 10, | ||
extra_analysis_errors = (:conservation_error,), | ||
extra_analysis_integrals = (waterheight_total, | ||
velocity, entropy)) | ||
callbacks = CallbackSet(analysis_callback) | ||
|
||
saveat = range(tspan..., length = 100) | ||
sol = solve(ode, Tsit5(), abstol = 1e-7, reltol = 1e-7, | ||
save_everystep = false, callback = callbacks, saveat = saveat) |
40 changes: 40 additions & 0 deletions
40
examples/bbm_bbm_variable_bathymetry_1d/bbm_bbm_variable_bathymetry_1d_manufactured.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,40 @@ | ||
using OrdinaryDiffEq | ||
using DispersiveShallowWater | ||
|
||
############################################################################### | ||
# Semidiscretization of the BBM-BBM equations | ||
|
||
equations = BBMBBMVariableEquations1D(gravity_constant = 9.81) | ||
|
||
initial_condition = initial_condition_manufactured | ||
source_terms = source_terms_manufactured | ||
boundary_conditions = boundary_condition_periodic | ||
|
||
# create homogeneous mesh | ||
coordinates_min = 0.0 | ||
coordinates_max = 1.0 | ||
N = 512 | ||
mesh = Mesh1D(coordinates_min, coordinates_max, N) | ||
|
||
# create solver with periodic SBP operators of accuracy order 4 | ||
accuracy_order = 4 | ||
solver = Solver(mesh, accuracy_order) | ||
|
||
# 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) | ||
analysis_callback = AnalysisCallback(semi; interval = 10, | ||
extra_analysis_errors = (:conservation_error,), | ||
extra_analysis_integrals = (waterheight_total, | ||
velocity, entropy)) | ||
callbacks = CallbackSet(analysis_callback) | ||
|
||
saveat = range(tspan..., length = 100) | ||
sol = solve(ode, Tsit5(), abstol = 1e-7, reltol = 1e-7, | ||
save_everystep = false, callback = callbacks, saveat = saveat) |
43 changes: 43 additions & 0 deletions
43
examples/svaerd_kalisch_1d/svaerd_kalisch_1d_manufactured.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,43 @@ | ||
using OrdinaryDiffEq | ||
using DispersiveShallowWater | ||
|
||
############################################################################### | ||
# Semidiscretization of the Svärd-Kalisch equations | ||
|
||
equations = SvaerdKalischEquations1D(gravity_constant = 1.0, eta0 = 0.0, | ||
alpha = 0.0004040404040404049, | ||
beta = 0.49292929292929294, | ||
gamma = 0.15707070707070708) | ||
|
||
initial_condition = initial_condition_manufactured | ||
source_terms = source_terms_manufactured | ||
boundary_conditions = boundary_condition_periodic | ||
|
||
# create homogeneous mesh | ||
coordinates_min = 0.0 | ||
coordinates_max = 1.0 | ||
N = 128 | ||
mesh = Mesh1D(coordinates_min, coordinates_max, N) | ||
|
||
# create solver with periodic SBP operators of accuracy order 4 | ||
accuracy_order = 4 | ||
solver = Solver(mesh, accuracy_order) | ||
|
||
# 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) | ||
analysis_callback = AnalysisCallback(semi; interval = 10, | ||
extra_analysis_errors = (:conservation_error,), | ||
extra_analysis_integrals = (waterheight_total, | ||
velocity, entropy)) | ||
callbacks = CallbackSet(analysis_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
Oops, something went wrong.