Skip to content
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

[WIP] Wet/dry capabilities for 2D shallow water equations #1340

Merged
merged 145 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
9f4cfbf
HR of Chen and Noelle (1D) and edit SWE struct
svengoldberg Jan 20, 2023
529fe9e
Overload limiter (SWE 1D) to cut off waterheight
svengoldberg Jan 20, 2023
e87dbf2
New indicatorHG (SWE 1D) to apply FV on dry cells
svengoldberg Jan 20, 2023
fac5972
Threshold in rhs! before calculation (SWE 1D)
svengoldberg Jan 20, 2023
2443b8d
New lake_at_rest_error for SWE 1D
svengoldberg Jan 20, 2023
0decdaf
New wet/dry elixirs for testing scheme for SWE 1D
svengoldberg Jan 20, 2023
698185b
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-1d
svengoldberg Jan 20, 2023
15ae272
HR of Chen and Noelle (2D) and edit SWE struct
svengoldberg Jan 21, 2023
beca28a
Overload limiter (SWE 2D) to cut off waterheight
svengoldberg Jan 21, 2023
fc88648
New indicatorHG (SWE 2D) to apply FV on dry cells
svengoldberg Jan 21, 2023
43bf89a
Threshold in rhs! before calculation (SWE 2D)
svengoldberg Jan 21, 2023
7fafa29
New lake_at_rest_error for SWE 2D
svengoldberg Jan 21, 2023
0b31095
New wet/dry elixirs for testing scheme for SWE 2D
svengoldberg Jan 21, 2023
df5b1e9
Elixir SWE 2D: 3 mounds, problem with boundaries
svengoldberg Jan 21, 2023
62c7265
Fixed MethodError; apply_thresholds! too strict
svengoldberg Jan 21, 2023
92a51b1
Fixed MethodError; apply_thresholds! too strict
svengoldberg Jan 21, 2023
36517d2
Move threshold on volume integral in stage_limiter
svengoldberg Feb 9, 2023
71501c3
Indentation, spacing and comments adjustment
svengoldberg Feb 9, 2023
bbb3f8c
Renaming numerical HLL type flux (SWE 1D)
svengoldberg Feb 9, 2023
3a08116
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-1d
svengoldberg Feb 9, 2023
8c4dccd
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-2d
svengoldberg Feb 9, 2023
1b7c28d
Move threshold on volume integral in stage_limiter
svengoldberg Feb 9, 2023
99e67a2
Renaming numerical HLL type flux (SWE 2D)
svengoldberg Feb 9, 2023
304428a
Indentation, spacing and comments adjustment
svengoldberg Feb 10, 2023
a231148
Describing docs for Chen and Noelle HR (SWE 1D)
svengoldberg Feb 11, 2023
3bb0447
Edit SWE 1D elixirs, error-based solver and docs
svengoldberg Feb 11, 2023
449af84
Including tests on new SWE 1D elixirs
svengoldberg Feb 11, 2023
d5d9570
Describing docs for Chen and Noelle HR (SWE 2D)
svengoldberg Feb 11, 2023
4c306e8
Edit SWE 2D elixirs, error-based solver and docs
svengoldberg Feb 11, 2023
00621da
Including tests on new SWE 2D elixirs
svengoldberg Feb 11, 2023
2e2d2c2
New/reorganize positivity limiter (SWE 2D)
svengoldberg Feb 23, 2023
15930b1
New/reorganize positivity limiter (SWE 1D)
svengoldberg Feb 23, 2023
b0bb88d
Editing docs SWE 1D
svengoldberg Mar 2, 2023
648f7eb
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-1d
svengoldberg Mar 2, 2023
d9f1af6
Merge branch 'sg/wet-dry-swe-1d' of https://github.com/svengoldberg/T…
svengoldberg Mar 2, 2023
71c0452
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-2d
svengoldberg Mar 2, 2023
d614ec2
Editing docs SWE 2D
svengoldberg Mar 2, 2023
ef0e6e6
Rearrange cut off at interfaces, edit tests SWE 1D
svengoldberg Mar 3, 2023
022e0ee
Edit docs, add Ref
svengoldberg Mar 3, 2023
871567c
Edit docs and indenting (SWE 2D)
svengoldberg Mar 3, 2023
7dcb931
Rearrange cut off at interfaces, edit tests SWE 2D
svengoldberg Mar 3, 2023
7855926
Remove tree/structured mesh elixir from repo SWE2D
svengoldberg Mar 3, 2023
6eb44f4
Create unstructured mesh elixir SWE 2D
svengoldberg Mar 3, 2023
03a7095
Add 1D lake-at-rest-error logic to pass 1D tests
svengoldberg Mar 3, 2023
0bcf93f
Add 2D lake-at-rest-error logic to pass 2D tests
svengoldberg Mar 3, 2023
6906fc6
Fixed typo. Confusing name, but correct math
svengoldberg Apr 19, 2023
5bfd23c
Correction of comments and docstrings
svengoldberg Apr 25, 2023
aa5216e
Correction of comments and docstrings
svengoldberg Apr 25, 2023
9ede947
Rename mesh file in elixir for UnstructuredMesh
svengoldberg Apr 25, 2023
caa7f6f
Merge branch 'main' into sg/wet-dry-swe-2d
andrewwinters5000 Apr 26, 2023
b91bb6d
Update test_unstructured_2d.jl
andrewwinters5000 Apr 26, 2023
20b0cae
Merge branch 'main' into sg/wet-dry-swe-2d
andrewwinters5000 May 1, 2023
3a4db71
Fixing typos
svengoldberg May 1, 2023
3080aca
Merge branch 'sg/wet-dry-swe-2d' of https://github.com/svengoldberg/T…
svengoldberg May 1, 2023
66adf3e
fix dispatching error on new lake-at-rest error calculation. See if t…
andrewwinters5000 May 2, 2023
f089eef
Editing initial condition in parabolic bowl elixir
svengoldberg May 2, 2023
d4854fd
Merge branch 'sg/wet-dry-swe-2d' of https://github.com/svengoldberg/T…
svengoldberg May 2, 2023
30b3229
Delete unnecessary variable in elixir
svengoldberg May 2, 2023
76ca4c7
Merge branch 'main' into sg/wet-dry-swe-2d
andrewwinters5000 May 3, 2023
bc18814
adjust lake-at-rest error computation strategy. move specialized vers…
andrewwinters5000 May 3, 2023
b94c128
Merge branch 'sg/wet-dry-swe-2d' of github.com:svengoldberg/Trixi.jl …
andrewwinters5000 May 3, 2023
4b6d067
update structured mesh version of the wet-dry well-balancedness test
andrewwinters5000 May 3, 2023
d41ca0c
fix typos
andrewwinters5000 May 3, 2023
03a79a8
update values in parabolic bowl test on StructuredMesh
andrewwinters5000 May 4, 2023
e581469
update parabolic bowl test on TreeMesh
andrewwinters5000 May 4, 2023
b9ec599
revert the 1D computation of the lake-at-rest error to the standard w…
andrewwinters5000 May 4, 2023
444d81f
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-1d
svengoldberg May 4, 2023
4a500fb
Reset lake-at-rest error computation strategy.
svengoldberg May 4, 2023
5c1ac38
Fix typo
svengoldberg May 4, 2023
cdc86c1
Shorten test run for parabolic bowl 1D
svengoldberg May 4, 2023
af9f8cb
Choose lower resolution for parabolic bowl
svengoldberg May 4, 2023
d8a5bdb
Further reduce resolution for parabolic bowl
svengoldberg May 5, 2023
a108d59
adjust special initial conditions and well-balancedness error routine…
andrewwinters5000 May 6, 2023
7595ac2
Remove MPI from well-balanced test
svengoldberg May 10, 2023
e156bc2
simplify workaround to set discontinuous initial data
andrewwinters5000 May 10, 2023
4d4c570
Merge branch 'main' into sg/wet-dry-swe-2d
andrewwinters5000 May 10, 2023
a73060f
Merge branch 'main' into sg/wet-dry-swe-2d
andrewwinters5000 May 12, 2023
ae55a5c
Simplify workaround to set discontinuity
svengoldberg May 12, 2023
a423b82
Merge branch 'main' into sg/wet-dry-swe-2d
sloede May 14, 2023
5f92288
Change structure of Chen&Noelle flux
svengoldberg May 16, 2023
6974c39
Merge branch 'sg/wet-dry-swe-2d' of https://github.com/svengoldberg/T…
svengoldberg May 16, 2023
5cf5e94
Fix typos and indenting
svengoldberg May 16, 2023
1402eeb
Adjust call of solve and use ode_default_options
svengoldberg May 16, 2023
3506b29
Edit docstring
svengoldberg May 16, 2023
e9df987
Replace boolean with if, remove set_node_vars
svengoldberg May 18, 2023
ca4ca18
Change structure of Chen&Noelle flux
svengoldberg May 18, 2023
1a734af
Fix typos and indenting
svengoldberg May 18, 2023
b1b9fb1
Adjust call of solve and use ode_default_options
svengoldberg May 18, 2023
f579a72
Edit docstring
svengoldberg May 18, 2023
03daf4f
Replace boolean with if, remove set_node_vars
svengoldberg May 18, 2023
56d5195
Merge branch 'main' into sg/wet-dry-swe-1d
svengoldberg May 18, 2023
b406109
Merge branch 'sg/wet-dry-swe-1d' of https://github.com/svengoldberg/T…
svengoldberg May 18, 2023
4816eac
Update comment regarding H0 for lake-at-rest error
svengoldberg May 19, 2023
a593a71
Add the original source to the parabolic bowl test
svengoldberg May 19, 2023
bdc8c72
Update comment regarding H0 for lake-at-rest error
svengoldberg May 19, 2023
ef094ef
Add the original source to the parabolic bowl test
svengoldberg May 19, 2023
5be46c2
New sc indicator especially for SWE
svengoldberg May 19, 2023
744faa5
Remove threshold parameter from SWE limiter call
svengoldberg May 19, 2023
822bdcb
Merge branch 'main' into sg/wet-dry-swe-2d
andrewwinters5000 May 29, 2023
4aa5ff5
Merge branch 'dev' into sg/wet-dry-swe-2d
andrewwinters5000 Jun 2, 2023
052fce5
update some docstrings
andrewwinters5000 Jun 2, 2023
29ba920
remove type instability in positivty limiter
andrewwinters5000 Jun 2, 2023
aa04c1a
typo fix
andrewwinters5000 Jun 2, 2023
747767a
move safety check for dry state in the new positivity limiter into th…
andrewwinters5000 Jun 2, 2023
d415a5d
more docstring updates
andrewwinters5000 Jun 2, 2023
8590711
remove dummy comment added in the dev initial commit
andrewwinters5000 Jun 2, 2023
7494ff2
adjust default threshold values to be precision agnostic
andrewwinters5000 Jun 2, 2023
f2b94cb
update comment on the default threshold value in the new TreeMesh eli…
andrewwinters5000 Jun 2, 2023
3de76fe
update comments for the three new TreeMesh examples
andrewwinters5000 Jun 2, 2023
1578672
update IC comment for three mound test
andrewwinters5000 Jun 2, 2023
9bbcd6f
update IC comments for new StructuredMesh2D tests
andrewwinters5000 Jun 2, 2023
537a934
update comment on shallow water constructor
andrewwinters5000 Jun 2, 2023
e2a6a69
adjust comments in the shallow_water_2d file
andrewwinters5000 Jun 2, 2023
7260cd1
adjust comment regarding threshold_limiter in the new elixirs
andrewwinters5000 Jun 2, 2023
225220c
fix typos found by SpellCheck
andrewwinters5000 Jun 2, 2023
00c088e
Edit docs
svengoldberg Jun 5, 2023
4861503
Import Printf macros for printing wb error
svengoldberg Jun 5, 2023
1bd8b31
Remove type instability in Chen & Noelle HR
svengoldberg Jun 5, 2023
303e459
Change logic for setting SC indicator to one
svengoldberg Jun 5, 2023
71d563c
Change logic for default values of SWE struct
svengoldberg Jun 5, 2023
199d264
Merge branch 'trixi-framework:main' into sg/wet-dry-swe-1d
svengoldberg Jun 15, 2023
f99b016
Outsource HG shock capturing indicator for SWE
svengoldberg Jun 15, 2023
abade12
Move limiterthreshold into function & edit docs
svengoldberg Jun 15, 2023
3c306b1
Move new limiter safety check in same element loop
svengoldberg Jun 15, 2023
096d58e
Adjust default threshold values
svengoldberg Jun 15, 2023
eeb4dc4
Remove type instability
svengoldberg Jun 15, 2023
ac14ca3
Import Printf package for terminal output
svengoldberg Jun 15, 2023
a10e65d
Edit docs
svengoldberg Jun 15, 2023
10e5012
Add Printf package to the test/Project.toml
svengoldberg Jun 20, 2023
5a6dae4
Add Printf package to the test/Project.toml
svengoldberg Jun 20, 2023
724dc01
Merge branch 'dev' into sg/wet-dry-swe-2d
andrewwinters5000 Jun 20, 2023
a12a815
Typo fix in elixir_shallowwater_well_balanced_wet_dry.jl
andrewwinters5000 Jun 20, 2023
7b58582
Typo fix in elixir_shallowwater_well_balanced_wet_dry.jl
andrewwinters5000 Jun 20, 2023
56cbd05
unify new code with required formatting
andrewwinters5000 Jun 30, 2023
a5b128f
Merge branch 'dev' into sg/wet-dry-swe-2d
andrewwinters5000 Jun 30, 2023
a2c12ad
fix weird formatting and add 'format: noindent' where missing. fix cr…
andrewwinters5000 Jul 5, 2023
94c6494
add unit test for new show routine
andrewwinters5000 Jul 5, 2023
afd89ea
Merge branch 'dev' into sg/wet-dry-swe-2d
andrewwinters5000 Jul 5, 2023
eddb8cc
Merge branch 'sg/wet-dry-swe-2d' into sg/wet-dry-swe-1d
andrewwinters5000 Jul 6, 2023
d8e45c8
apply JuliaFormatter
andrewwinters5000 Jul 6, 2023
0792bd3
simplify elixir as we can set discontinuous ICs in 1D. Also update be…
andrewwinters5000 Jul 6, 2023
a2821f6
dummy commit to check push access
andrewwinters5000 Jul 6, 2023
675c154
remove dummy comment
andrewwinters5000 Jul 6, 2023
0cbf94d
Merge branch 'sg/wet-dry-swe-1d' into sg/wet-dry-swe-2d
andrewwinters5000 Jul 6, 2023
5eb4a00
typo fix
andrewwinters5000 Jul 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions examples/structured_2d_dgsem/elixir_shallowwater_conical_island.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

using OrdinaryDiffEq
using Trixi
using Plots

###############################################################################
# Semidiscretization of the shallow water equations
equations = ShallowWaterEquations2D(gravity_constant=9.81, H0=1.4)
cfl = 0.5
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

function initial_condition_conical_island(x, t, equations::ShallowWaterEquations2D)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
# Set the background values

v1 = 0.0
v2 = 0.0

x1, x2 = x
b = max(0.1, - sqrt(16*x1^2+16*x2^2) + 1)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

# use a logistic function to tranfer water height value smoothly
L = equations.H0 # maximum of function
x0 = 0.3 # center point of function
k = -25.0 # sharpness of transfer

H = max(b, L/(1.0 + exp(-k*(sqrt(x1^2+x2^2) - x0))))

H = max(H, b + equations.threshold_limiter)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
return prim2cons(SVector(H, v1, v2, b), equations)
end

initial_condition = initial_condition_conical_island
###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (FluxHydrostaticReconstruction(flux_hll_cn, hydrostatic_reconstruction_chen_noelle),
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
flux_nonconservative_chen_noelle)

basis = LobattoLegendreBasis(4)

indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max=0.5,
alpha_min=0.001,
alpha_smooth=true,
variable=waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
volume_flux_dg=volume_flux,
volume_flux_fv=surface_flux)

solver = DGSEM(basis, surface_flux, volume_integral)

###############################################################################
# Get the StructuredMesh and setup a periodic mesh

coordinates_min = (-1., -1.)
coordinates_max = (1., 1.)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

cells_per_dimension = (20, 20)

mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)

# Create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

###############################################################################
# ODE solver

tspan = (0.0, 10.)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
ode = semidiscretize(semi, tspan)

###############################################################################
# Callbacks

summary_callback = SummaryCallback()

analysis_interval = 1000
analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
extra_analysis_integrals=(lake_at_rest_error,))

alive_callback = AliveCallback(analysis_interval=analysis_interval)

save_solution = SaveSolutionCallback(interval=100,
save_initial_solution=true,
save_final_solution=true)

stepsize_callback = StepsizeCallback(cfl=cfl)

callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,
stepsize_callback)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# run the simulation

stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(equations.threshold_limiter,),
variables=(Trixi.waterheight,))
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

sol = solve(ode, SSPRK43(stage_limiter!),
dt=1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
save_everystep=false, callback=callbacks, adaptive=false);
summary_callback() # print the timer summary
109 changes: 109 additions & 0 deletions examples/structured_2d_dgsem/elixir_shallowwater_parabolic_bowl.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

using OrdinaryDiffEq
using Trixi

###############################################################################
# Semidiscretization of the shallow water equations

equations = ShallowWaterEquations2D(gravity_constant=9.81)
cfl = 0.6

# Implemented based on Wintermeyer (scaled on half of domain)
function parabolic_bowl_analytic_2D_H(gravity, x,t)
a = 1
h_0 = 0.1
σ = 0.5
ω = sqrt(2*gravity*h_0)/a

H = 0.5 * (σ * h_0/a^2 * (2*2*x[1]*cos(ω*t) + 2*2*x[2]*sin(ω*t)- σ) + h_0)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
return H
end
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

# Implemented based on Wintermeyer (scaled on half of domain)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
function initial_condition_parabolic_bowl(x, t, equations:: ShallowWaterEquations2D)
a = 1
h_0 = 0.1
σ = 0.5
ω = sqrt(2*equations.gravity*h_0)/a

v1 = -σ*ω*sin(ω*t)
v2 = -σ*ω*cos(ω*t)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

b = 0.5 * (h_0 * ((2*x[1])^2 + (2*x[2])^2)/a^2)

H = max(b, parabolic_bowl_analytic_2D_H(equations.gravity, x, 0))
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

H = max(H, b + equations.threshold_limiter)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
return prim2cons(SVector(H, v1, v2, b), equations)
end

initial_condition = initial_condition_parabolic_bowl


###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)
surface_flux = (FluxHydrostaticReconstruction(flux_hll_cn, hydrostatic_reconstruction_chen_noelle),
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
flux_nonconservative_chen_noelle)

basis = LobattoLegendreBasis(6)

indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max=0.6,
alpha_min=0.001,
alpha_smooth=true,
variable=waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
volume_flux_dg=volume_flux,
volume_flux_fv=surface_flux)

solver = DGSEM(basis, surface_flux, volume_integral)


###############################################################################

coordinates_min = (-1.0, -1.0)
coordinates_max = (1.0, 1.0)

cells_per_dimension = (60,60)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)

# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 1.)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 1000
analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
extra_analysis_integrals=(energy_kinetic,
energy_internal,
lake_at_rest_error))
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

alive_callback = AliveCallback(analysis_interval=analysis_interval)

save_solution = SaveSolutionCallback(interval=1000,
save_initial_solution=true,
save_final_solution=true)

stepsize_callback = StepsizeCallback(cfl=cfl)

callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution, stepsize_callback)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(equations.threshold_limiter,),
variables=(Trixi.waterheight,))
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# run the simulation

sol = solve(ode, SSPRK43(stage_limiter!), dt=1.0,
save_everystep=false, callback=callbacks, adaptive=false);

summary_callback() # print the timer summary
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@

using OrdinaryDiffEq
using Trixi

svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
###############################################################################
# Semidiscretization of the shallow water equations


equations = ShallowWaterEquations2D(gravity_constant=9.812)
cfl = 1
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

function initial_condition_complex_bottom_wb_CN(x, t, equations:: ShallowWaterEquations2D)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
v1 = 0
v2 = 0
b = sin(4*pi*x[1]) + 3
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

if x[1] >= 0.5
b = sin(4*pi*x[1]) + 1
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
end

H = max(b, 2.5)

if x[1] >= 0.5
H = max(b, 1.5)
end

H = max(H, b + equations.threshold_limiter)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
return prim2cons(SVector(H, v1, v2, b), equations)
end

initial_condition = initial_condition_complex_bottom_wb_CN
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# Get the DG approximation space

volume_flux = (flux_wintermeyer_etal, flux_nonconservative_wintermeyer_etal)

surface_flux = (FluxHydrostaticReconstruction(flux_hll_cn, hydrostatic_reconstruction_chen_noelle),
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved
flux_nonconservative_chen_noelle)

basis = LobattoLegendreBasis(3)

indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max=0.5,
alpha_min=0.001,
alpha_smooth=true,
variable=waterheight_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
volume_flux_dg=volume_flux,
volume_flux_fv=surface_flux)

solver = DGSEM(basis, surface_flux, volume_integral)


###############################################################################
# Create the StructuredMesh for the domain [0, 1]^2

coordinates_min = (0., 0.)
coordinates_max = (1., 1.)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

cells_per_dimension = (16, 16)

mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max)


# create the semi discretization object
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 10.0)
ode = semidiscretize(semi, tspan)


summary_callback = SummaryCallback()

analysis_interval = 1000
analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=false,
extra_analysis_integrals=(energy_kinetic,
energy_internal,
lake_at_rest_error))

alive_callback = AliveCallback(analysis_interval=analysis_interval)

save_solution = SaveSolutionCallback(interval=1000,
save_initial_solution=true,
save_final_solution=true)

stepsize_callback = StepsizeCallback(cfl=cfl)

callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution, stepsize_callback)
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds=(equations.threshold_limiter,),
variables=(Trixi.waterheight,))
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

###############################################################################
# run the simulation

sol = solve(ode, SSPRK43(stage_limiter!), dt=1.0,
save_everystep=false, callback=callbacks, adaptive=false);
svengoldberg marked this conversation as resolved.
Show resolved Hide resolved

summary_callback() # print the timer summary
Loading