forked from trixi-framework/Trixi.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'semidiscretization-doc' of https://github.com/ArseniyKh…
…olod/Trixi.jl into semidiscretization-doc
- Loading branch information
Showing
137 changed files
with
16,313 additions
and
6,599 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
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
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.5.45-pre" | ||
version = "0.5.48-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
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
63 changes: 63 additions & 0 deletions
63
examples/structured_2d_dgsem/elixir_eulerpolytropic_convergence.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,63 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the polytropic Euler equations | ||
|
||
gamma = 1.4 | ||
kappa = 0.5 # Scaling factor for the pressure. | ||
equations = PolytropicEulerEquations2D(gamma, kappa) | ||
|
||
initial_condition = initial_condition_convergence_test | ||
|
||
volume_flux = flux_winters_etal | ||
solver = DGSEM(polydeg = 3, surface_flux = flux_hll, | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
coordinates_min = (0.0, 0.0) | ||
coordinates_max = (1.0, 1.0) | ||
|
||
cells_per_dimension = (4, 4) | ||
|
||
mesh = StructuredMesh(cells_per_dimension, | ||
coordinates_min, | ||
coordinates_max) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
source_terms = source_terms_convergence_test) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 0.1) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, | ||
extra_analysis_errors = (:l2_error_primitive, | ||
:linf_error_primitive)) | ||
|
||
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.1) | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the polytropic Euler equations | ||
|
||
gamma = 1.4 | ||
kappa = 0.5 # Scaling factor for the pressure. | ||
equations = PolytropicEulerEquations2D(gamma, kappa) | ||
|
||
initial_condition = initial_condition_weak_blast_wave | ||
|
||
############################################################################### | ||
# Get the DG approximation space | ||
|
||
volume_flux = flux_winters_etal | ||
solver = DGSEM(polydeg=4, surface_flux=flux_winters_etal, | ||
volume_integral=VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
############################################################################### | ||
# Get the curved quad mesh from a mapping function | ||
|
||
# Mapping as described in https://arxiv.org/abs/2012.12040, but reduced to 2D | ||
function mapping(xi_, eta_) | ||
# Transform input variables between -1 and 1 onto [0,3] | ||
xi = 1.5 * xi_ + 1.5 | ||
eta = 1.5 * eta_ + 1.5 | ||
|
||
y = eta + 3/8 * (cos(1.5 * pi * (2 * xi - 3)/3) * | ||
cos(0.5 * pi * (2 * eta - 3)/3)) | ||
|
||
x = xi + 3/8 * (cos(0.5 * pi * (2 * xi - 3)/3) * | ||
cos(2 * pi * (2 * y - 3)/3)) | ||
|
||
return SVector(x, y) | ||
end | ||
|
||
cells_per_dimension = (16, 16) | ||
|
||
# Create curved mesh with 16 x 16 elements | ||
mesh = StructuredMesh(cells_per_dimension, mapping) | ||
|
||
############################################################################### | ||
# create the semi discretization object | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) | ||
|
||
############################################################################### | ||
# 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) | ||
|
||
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 |
83 changes: 83 additions & 0 deletions
83
examples/structured_2d_dgsem/elixir_eulerpolytropic_isothermal_wave.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,83 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the polytropic Euler equations | ||
|
||
gamma = 1.0 # With gamma = 1 the system is isothermal. | ||
kappa = 1.0 # Scaling factor for the pressure. | ||
equations = PolytropicEulerEquations2D(gamma, kappa) | ||
|
||
# Linear pressure wave in the negative x-direction. | ||
function initial_condition_wave(x, t, equations::PolytropicEulerEquations2D) | ||
rho = 1.0 | ||
v1 = 0.0 | ||
if x[1] > 0.0 | ||
rho = ((1.0 + 0.01 * sin(x[1] * 2 * pi)) / equations.kappa)^(1 / equations.gamma) | ||
v1 = ((0.01 * sin((x[1] - 1 / 2) * 2 * pi)) / equations.kappa) | ||
end | ||
v2 = 0.0 | ||
|
||
return prim2cons(SVector(rho, v1, v2), equations) | ||
end | ||
initial_condition = initial_condition_wave | ||
|
||
volume_flux = flux_winters_etal | ||
solver = DGSEM(polydeg = 2, surface_flux = flux_hll, | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
coordinates_min = (-2.0, -1.0) | ||
coordinates_max = (2.0, 1.0) | ||
|
||
cells_per_dimension = (64, 32) | ||
|
||
boundary_conditions = (x_neg = boundary_condition_periodic, | ||
x_pos = boundary_condition_periodic, | ||
y_neg = boundary_condition_periodic, | ||
y_pos = boundary_condition_periodic) | ||
|
||
mesh = StructuredMesh(cells_per_dimension, | ||
coordinates_min, | ||
coordinates_max) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
boundary_conditions = boundary_conditions) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 1.0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 200 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = 50, | ||
save_initial_solution = true, | ||
save_final_solution = true, | ||
solution_variables = cons2prim) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 1.7) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, alive_callback, | ||
save_solution, | ||
stepsize_callback) | ||
|
||
stage_limiter! = PositivityPreservingLimiterZhangShu(thresholds = (1.0e-4, 1.0e-4), | ||
variables = (Trixi.density, pressure)) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(stage_limiter!, 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); | ||
|
||
# Print the timer summary | ||
summary_callback() |
Oops, something went wrong.