-
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.
Add bounds calculation for BoundaryConditionDirichlet
- Loading branch information
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
examples/tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell.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,96 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations2D(1.4) | ||
|
||
""" | ||
initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D) | ||
A medium blast wave taken from | ||
- Sebastian Hennemann, Gregor J. Gassner (2020) | ||
A provably entropy stable subcell shock capturing approach for high order split form DG | ||
[arXiv: 2008.12044](https://arxiv.org/abs/2008.12044) | ||
""" | ||
function initial_condition_blast_wave(x, t, equations::CompressibleEulerEquations2D) | ||
# Modified From Hennemann & Gassner JCP paper 2020 (Sec. 6.3) -> "medium blast wave" | ||
# Set up polar coordinates | ||
inicenter = SVector(0.0, 0.0) | ||
x_norm = x[1] - inicenter[1] | ||
y_norm = x[2] - inicenter[2] | ||
r = sqrt(x_norm^2 + y_norm^2) | ||
phi = atan(y_norm, x_norm) | ||
sin_phi, cos_phi = sincos(phi) | ||
|
||
# Calculate primitive variables | ||
rho = r > 0.5 ? 1.0 : 1.1691 | ||
v1 = r > 0.5 ? 0.0 : 0.1882 * cos_phi | ||
v2 = r > 0.5 ? 0.0 : 0.1882 * sin_phi | ||
p = r > 0.5 ? 1.0E-3 : 1.245 | ||
|
||
return prim2cons(SVector(rho, v1, v2, p), equations) | ||
end | ||
initial_condition = initial_condition_blast_wave | ||
|
||
boundary_condition = BoundaryConditionDirichlet(initial_condition) | ||
|
||
surface_flux = flux_lax_friedrichs | ||
volume_flux = flux_ranocha | ||
basis = LobattoLegendreBasis(3) | ||
limiter_idp = SubcellLimiterIDP(equations, basis; | ||
local_minmax_variables_cons=[1]) | ||
volume_integral = VolumeIntegralSubcellLimiting(limiter_idp; | ||
volume_flux_dg=volume_flux, | ||
volume_flux_fv=surface_flux) | ||
solver = DGSEM(basis, surface_flux, volume_integral) | ||
|
||
coordinates_min = (-2.0, -2.0) | ||
coordinates_max = ( 2.0, 2.0) | ||
mesh = TreeMesh(coordinates_min, coordinates_max, | ||
initial_refinement_level=6, | ||
n_cells_max=10_000, | ||
periodicity=false) | ||
|
||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
boundary_conditions=boundary_condition) | ||
|
||
|
||
############################################################################### | ||
# 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) | ||
|
||
alive_callback = AliveCallback(analysis_interval=analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval=100, | ||
save_initial_solution=true, | ||
save_final_solution=true, | ||
solution_variables=cons2prim) | ||
|
||
stepsize_callback = StepsizeCallback(cfl=0.3) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, alive_callback, | ||
save_solution, | ||
stepsize_callback) | ||
|
||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
stage_callbacks = (SubcellLimiterIDPCorrection(),) | ||
|
||
sol = Trixi.solve(ode, Trixi.SimpleSSPRK33(stage_callbacks=stage_callbacks); | ||
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