-
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 Svärd-Kalisch equations (#166)
* add reflecting boundary conditions for Svärd-Kalisch equations * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * add back accidently removed FourierDerivativeOperator * also implement upwind operators * reformat * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <[email protected]> * Update src/equations/svaerd_kalisch_1d.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * set stricter time integration tolerances * lower tolerance * use Cholesky decomposition * Update src/equations/svaerd_kalisch_1d.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * temporarily add lu decomposition again * fix scale_by_mass_matrix! * remove LU decomposition again * scale_by_mass_matrix! outside of solve_system_matrix! * try CI without tolerances * reorder imports * fix variable name * refactor to reduce code redundancy * fix * pass boundary_conditions * format * adjust tolerances * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <[email protected]> * Update src/equations/equations.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * begin + 1instead of 2 * set tolerances in tests * add test for ArgumentError --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Hendrik Ranocha <[email protected]>
- Loading branch information
1 parent
4d1cc6c
commit 1a509a9
Showing
7 changed files
with
335 additions
and
52 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
examples/svaerd_kalisch_1d/svaerd_kalisch_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,46 @@ | ||
using OrdinaryDiffEqTsit5 | ||
using DispersiveShallowWater | ||
using SummationByPartsOperators: MattssonNordström2004, derivative_operator | ||
|
||
############################################################################### | ||
# Semidiscretization of the Svärd-Kalisch equations | ||
# For reflecting boundary conditions, alpha and gamma need to be 0 | ||
equations = SvaerdKalischEquations1D(gravity_constant = 1.0, eta0 = 0.0, | ||
alpha = 0.0, beta = 1 / 3, gamma = 0.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) | ||
solver = Solver(D1, nothing) | ||
|
||
# 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 = 100, | ||
extra_analysis_errors = (:conservation_error,), | ||
extra_analysis_integrals = (waterheight_total, | ||
entropy_modified)) | ||
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
Oops, something went wrong.