-
Notifications
You must be signed in to change notification settings - Fork 6
Implement hyperbolized Sainte-Marie equations developed by Escalante et al. #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 27 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
b45d1e0
WIP: energy-conserving discretization for HyperbolicSainteMarieEquati…
ranocha 526b575
TODO notes for development
ranocha 5d7c118
bathymetry_mild_slope works as well
ranocha 2d7543d
Merge branch 'main' into hr/escalante_et_al_2019
ranocha d7d4f0b
docstrings
ranocha 7de5506
add first test
ranocha c75aed6
Dingemans
ranocha b479839
WIP: initial_condition_manufactured
ranocha 3257b46
WIP: initial_condition_manufactured
ranocha b18ecf6
initial_condition_manufactured
ranocha 22f7c78
format
ranocha 296792c
test flat bathymetry
ranocha e2ca9df
introduce h0 and NEWS.md
ranocha 1fb0445
note on method derived by Marco
ranocha 6e82efc
fix docs
ranocha ece5d65
fix docs
ranocha bdb87ae
add new equations to docs
ranocha 0faf88d
add unit tests
ranocha 067527d
tests for SainteMarieEquations1D
ranocha ad07f1a
format
ranocha a268f0e
fix duplicated docs
ranocha b43187a
export SainteMarieEquations1D
ranocha 53f681c
add dispersion relation of SainteMarieEquations1D
ranocha 7a841bf
add dispersion relation of HyperbolicSainteMarieEquations1D
ranocha 0ca7177
show dispersion relation in docs
ranocha cc806fc
format
ranocha 07d0307
fix reference values
ranocha 0c33dc2
Update docs/src/overview.md
JoshuaLampert 5d50490
Apply suggestions from code review
ranocha 3ab62ac
WIP
ranocha 1f06885
Apply suggestion from @JoshuaLampert
JoshuaLampert 4598afe
manufactured solution for flat bathymetry
ranocha c04dd9a
Merge branch 'hr/escalante_et_al_2019' of github.com:NumericalMathema…
ranocha 210245e
format
ranocha 3465a5c
Update docs/src/dispersion.md
ranocha f36f7e3
Update src/dispersion_relation.jl
ranocha 01f0e5a
comment on alpha
ranocha 8074fb7
Apply suggestion from @JoshuaLampert
JoshuaLampert 0d29bd7
note on alpha = 0
ranocha bfee7c9
Merge branch 'hr/escalante_et_al_2019' of github.com:NumericalMathema…
ranocha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
92 changes: 92 additions & 0 deletions
92
examples/hyperbolic_sainte_marie_1d/hyperbolic_sainte_marie_conservation.jl
This file contains hidden or 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,92 @@ | ||
| # This elixir contains an artificial setup that can be used to check the | ||
| # conservation properties of the equations and numerical methods as well as | ||
| # a possible directional bias (if the velocity is set to zero). See | ||
| # - Hendrik Ranocha and Mario Ricchiuto (2024) | ||
| # Structure-preserving approximations of the Serre-Green-Naghdi | ||
| # equations in standard and hyperbolic form | ||
| # [arXiv: 2408.02665](https://arxiv.org/abs/2408.02665) | ||
|
|
||
| using OrdinaryDiffEqLowStorageRK | ||
| using DispersiveShallowWater | ||
|
|
||
| #= | ||
| You can run this example manually and check the conservation properties as follows: | ||
|
|
||
| julia> using Revise; using DispersiveShallowWater, OrdinaryDiffEqVerner | ||
|
|
||
| julia> trixi_include("examples/hyperbolic_sainte_marie_1d/hyperbolic_sainte_marie_conservation.jl", tol = 1.0e-12, alg = Vern9()); | ||
|
JoshuaLampert marked this conversation as resolved.
|
||
|
|
||
| julia> integrals(analysis_callback).waterheight_total |> x -> (x[end] - x[1]) / x[1] | ||
| 0.0 | ||
|
|
||
| julia> integrals(analysis_callback).momentum |> x -> (x[end] - x[1]) / x[1] | ||
| 2.9432057444810533e-15 # for flat bathymetry | ||
|
|
||
| julia> integrals(analysis_callback).entropy_modified |> x -> (x[end] - x[1]) / x[1] | ||
| -1.064590038909088e-15 | ||
| =# | ||
|
|
||
| ############################################################################### | ||
| # Semidiscretization of the hyperbolic Sainte-Marie equations | ||
|
|
||
| equations = HyperbolicSainteMarieEquations1D(bathymetry_type = bathymetry_mild_slope, | ||
| gravity = 9.81, | ||
| h0 = 1.0) | ||
|
|
||
| function initial_condition_conservation_test(x, t, | ||
| equations::HyperbolicSainteMarieEquations1D, | ||
| mesh) | ||
| eta = 1 + exp(-x^2) | ||
| v = 1.0e-2 # set this to zero to test a directional bias | ||
| b = 0.25 * cospi(x / 75) | ||
|
|
||
| # We use the feature that we can only return the physical variables | ||
| # used by the `hyperbolic_approximation_limit`, i.e., the | ||
| # `SainteMarieEquations1D.` | ||
| D = equations.eta0 - b | ||
| return SVector(eta, v, D) | ||
| end | ||
|
|
||
| # create homogeneous mesh | ||
| coordinates_min = -150.0 | ||
| coordinates_max = +150.0 | ||
| N = 1_000 | ||
| mesh = Mesh1D(coordinates_min, coordinates_max, N) | ||
|
|
||
| # create solver with periodic SBP operators of accuracy order 2 | ||
| accuracy_order = 2 | ||
| solver = Solver(mesh, accuracy_order) | ||
|
|
||
| # semidiscretization holds all the necessary data structures for the spatial discretization | ||
| semi = Semidiscretization(mesh, equations, | ||
| initial_condition_conservation_test, solver; | ||
| boundary_conditions = boundary_condition_periodic) | ||
|
|
||
| ############################################################################### | ||
| # Create `ODEProblem` and run the simulation | ||
| tspan = (0.0, 35.0) | ||
| ode = semidiscretize(semi, tspan) | ||
|
|
||
| # The callbacks support an additional `io` argument to write output to a file | ||
| # or any other IO stream. The default is stdout. We use this here to enable | ||
| # setting it to `devnull` to benchmark the full simulation including the time | ||
| # to compute the errors etc. but without the time to write the output to the | ||
| # terminal. | ||
| io = stdout | ||
| summary_callback = SummaryCallback(io) | ||
| analysis_callback = AnalysisCallback(semi; interval = 50, io, | ||
| extra_analysis_errors = (:conservation_error,), | ||
| extra_analysis_integrals = (waterheight_total, | ||
| momentum, | ||
| entropy, | ||
| entropy_modified)) | ||
|
|
||
| callbacks = CallbackSet(analysis_callback, summary_callback) | ||
|
|
||
| # optimized time integration methods like this one are much more efficient | ||
| # for stiff problems (α big) than standard methods like Tsit5() | ||
| alg = RDPK3SpFSAL35() | ||
| tol = 1.0e-4 | ||
| sol = solve(ode, alg; | ||
| reltol = tol, abstol = tol, | ||
| save_everystep = false, callback = callbacks) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.