-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/github_actions/actions/upload-art…
…ifact-4
- Loading branch information
Showing
9 changed files
with
340 additions
and
4 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,49 @@ | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# Semidiscretization of the quasi 1d compressible Euler equations | ||
# See Chan et al. https://doi.org/10.48550/arXiv.2307.12089 for details | ||
|
||
equations = CompressibleEulerEquationsQuasi1D(1.4) | ||
|
||
initial_condition = initial_condition_convergence_test | ||
|
||
surface_flux = (flux_chan_etal, flux_nonconservative_chan_etal) | ||
volume_flux = surface_flux | ||
dg = DGMulti(polydeg = 4, element_type = Line(), approximation_type = SBP(), | ||
surface_integral = SurfaceIntegralWeakForm(surface_flux), | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
cells_per_dimension = (8,) | ||
mesh = DGMultiMesh(dg, cells_per_dimension, | ||
coordinates_min = (-1.0,), coordinates_max = (1.0,), periodicity = true) | ||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; | ||
source_terms = source_terms_convergence_test) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 2.0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg)) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
stepsize_callback = StepsizeCallback(cfl = 0.8) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, | ||
alive_callback, | ||
stepsize_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), | ||
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback | ||
save_everystep = false, callback = callbacks); | ||
summary_callback() # print the timer summary |
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,49 @@ | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# Semidiscretization of the quasi 1d shallow water equations | ||
# See Chan et al. https://doi.org/10.48550/arXiv.2307.12089 for details | ||
|
||
equations = ShallowWaterEquationsQuasi1D(gravity_constant = 9.81) | ||
|
||
initial_condition = initial_condition_convergence_test | ||
|
||
volume_flux = (flux_chan_etal, flux_nonconservative_chan_etal) | ||
surface_flux = (FluxPlusDissipation(flux_chan_etal, DissipationLocalLaxFriedrichs()), | ||
flux_nonconservative_chan_etal) | ||
|
||
dg = DGMulti(polydeg = 4, element_type = Line(), approximation_type = SBP(), | ||
surface_integral = SurfaceIntegralWeakForm(surface_flux), | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
cells_per_dimension = (8,) | ||
mesh = DGMultiMesh(dg, cells_per_dimension, | ||
coordinates_min = (0.0,), coordinates_max = (sqrt(2),), | ||
periodicity = true) | ||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg; | ||
source_terms = source_terms_convergence_test) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 1.0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, uEltype = real(dg)) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, | ||
alive_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, RDPK3SpFSAL49(); abstol = 1.0e-8, reltol = 1.0e-8, | ||
ode_default_options()..., callback = callbacks) | ||
summary_callback() # print the timer summary |
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,82 @@ | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# Semidiscretization of the shallow water equations | ||
|
||
equations = ShallowWaterEquations2D(gravity_constant = 9.81, H0 = 3.25) | ||
|
||
# An initial condition with a bottom topography and a perturbation in the waterheight to test | ||
# boundary_condition_slip_wall | ||
function initial_condition_perturbation(x, t, equations::ShallowWaterEquations2D) | ||
# Set the background values | ||
H = equations.H0 | ||
v1 = 0.0 | ||
v2 = 0.0 | ||
|
||
# Bottom topography | ||
b = 1.5 * exp(-0.5 * ((x[1])^2 + (x[2])^2)) | ||
# Waterheight perturbation | ||
H = H + 0.5 * exp(-10.0 * ((x[1])^2 + (x[2])^2)) | ||
|
||
return prim2cons(SVector(H, v1, v2, b), equations) | ||
end | ||
|
||
initial_condition = initial_condition_perturbation | ||
|
||
boundary_condition = boundary_condition_slip_wall | ||
|
||
############################################################################### | ||
# Get the DG approximation space | ||
|
||
volume_flux = (flux_wintermeyer_etal, flux_nonconservative_ersing_etal) | ||
surface_flux = (flux_lax_friedrichs, flux_nonconservative_ersing_etal) | ||
solver = DGSEM(polydeg = 3, surface_flux = surface_flux, | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
############################################################################### | ||
# Get the TreeMesh and setup a non-periodic mesh | ||
|
||
coordinates_min = (-1.0, -1.0) | ||
coordinates_max = (1.0, 1.0) | ||
mesh = TreeMesh(coordinates_min, coordinates_max, | ||
initial_refinement_level = 4, | ||
n_cells_max = 10_000, | ||
periodicity = false) | ||
|
||
# create the semi discretization object | ||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
boundary_conditions = boundary_condition) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 0.25) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
############################################################################### | ||
# Callbacks | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 1000 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = 1000, | ||
save_initial_solution = true, | ||
save_final_solution = true) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 1.0) | ||
|
||
callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution, | ||
stepsize_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), | ||
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback | ||
save_everystep = false, callback = callbacks); | ||
summary_callback() # print the timer summary |
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
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.