-
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.
- Loading branch information
Showing
17 changed files
with
330 additions
and
82 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "Trixi" | ||
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb" | ||
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>", "Jesse Chan <[email protected]>"] | ||
version = "0.7.13-pre" | ||
version = "0.7.14-pre" | ||
|
||
[deps] | ||
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" | ||
|
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
93 changes: 93 additions & 0 deletions
93
examples/dgmulti_1d/elixir_euler_shu_osher_gauss_shock_capturing.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,93 @@ | ||
using Trixi | ||
using OrdinaryDiffEq | ||
|
||
gamma_gas = 1.4 | ||
equations = CompressibleEulerEquations1D(gamma_gas) | ||
|
||
############################################################################### | ||
# setup the GSBP DG discretization that uses the Gauss operators from | ||
# Chan, Del Rey Fernandez, Carpenter (2019). | ||
# [https://doi.org/10.1137/18M1209234](https://doi.org/10.1137/18M1209234) | ||
|
||
# Shu-Osher initial condition for 1D compressible Euler equations | ||
# Example 8 from Shu, Osher (1989). | ||
# [https://doi.org/10.1016/0021-9991(89)90222-2](https://doi.org/10.1016/0021-9991(89)90222-2) | ||
function initial_condition_shu_osher(x, t, equations::CompressibleEulerEquations1D) | ||
x0 = -4 | ||
|
||
rho_left = 27 / 7 | ||
v_left = 4 * sqrt(35) / 9 | ||
p_left = 31 / 3 | ||
|
||
# Replaced v_right = 0 to v_right = 0.1 to avoid positivity issues. | ||
v_right = 0.1 | ||
p_right = 1.0 | ||
|
||
rho = ifelse(x[1] > x0, 1 + 1 / 5 * sin(5 * x[1]), rho_left) | ||
v = ifelse(x[1] > x0, v_right, v_left) | ||
p = ifelse(x[1] > x0, p_right, p_left) | ||
|
||
return prim2cons(SVector(rho, v, p), | ||
equations) | ||
end | ||
|
||
initial_condition = initial_condition_shu_osher | ||
|
||
surface_flux = flux_lax_friedrichs | ||
volume_flux = flux_ranocha | ||
|
||
polydeg = 3 | ||
basis = DGMultiBasis(Line(), polydeg, approximation_type = GaussSBP()) | ||
|
||
indicator_sc = IndicatorHennemannGassner(equations, basis, | ||
alpha_max = 0.5, | ||
alpha_min = 0.001, | ||
alpha_smooth = true, | ||
variable = density_pressure) | ||
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc; | ||
volume_flux_dg = volume_flux, | ||
volume_flux_fv = surface_flux) | ||
|
||
dg = DGMulti(basis, | ||
surface_integral = SurfaceIntegralWeakForm(surface_flux), | ||
volume_integral = volume_integral) | ||
|
||
boundary_condition = BoundaryConditionDirichlet(initial_condition) | ||
boundary_conditions = (; :entire_boundary => boundary_condition) | ||
|
||
############################################################################### | ||
# setup the 1D mesh | ||
|
||
cells_per_dimension = (64,) | ||
mesh = DGMultiMesh(dg, cells_per_dimension, | ||
coordinates_min = (-5.0,), coordinates_max = (5.0,), | ||
periodicity = false) | ||
|
||
############################################################################### | ||
# setup the semidiscretization and ODE problem | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, | ||
dg, boundary_conditions = boundary_conditions) | ||
|
||
tspan = (0.0, 1.0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
############################################################################### | ||
# setup the callbacks | ||
|
||
# prints a summary of the simulation setup and resets the timers | ||
summary_callback = SummaryCallback() | ||
|
||
# analyse the solution in regular intervals and prints the results | ||
analysis_callback = AnalysisCallback(semi, interval = 100, uEltype = real(dg)) | ||
|
||
# handles the re-calculation of the maximum Δt after each time step | ||
stepsize_callback = StepsizeCallback(cfl = 0.1) | ||
|
||
# collect all callbacks such that they can be passed to the ODE solver | ||
callbacks = CallbackSet(summary_callback, analysis_callback, stepsize_callback) | ||
|
||
# ############################################################################### | ||
# # run the simulation | ||
|
||
sol = solve(ode, SSPRK43(), adaptive = true, callback = callbacks, save_everystep = false) |
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
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.