forked from trixi-framework/Trixi.jl
-
Notifications
You must be signed in to change notification settings - Fork 1
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 subcell-limiting
- Loading branch information
Showing
113 changed files
with
2,885 additions
and
1,292 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.8.5-DEV" | ||
version = "0.8.9-DEV" | ||
|
||
[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
2 changes: 1 addition & 1 deletion
2
examples/p4est_2d_dgsem/elixir_euler_NACA0012airfoil_mach085.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using Downloads: download | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
|
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
66 changes: 66 additions & 0 deletions
66
examples/p4est_2d_dgsem/elixir_euler_shockcapturing_ec_float32.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,66 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations2D(1.4f0) | ||
|
||
initial_condition = initial_condition_weak_blast_wave | ||
|
||
surface_flux = flux_ranocha | ||
volume_flux = flux_ranocha | ||
polydeg = 4 | ||
basis = LobattoLegendreBasis(Float32, polydeg) | ||
indicator_sc = IndicatorHennemannGassner(equations, basis, | ||
alpha_max = 1.0f0, | ||
alpha_min = 0.001f0, | ||
alpha_smooth = true, | ||
variable = density_pressure) | ||
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc; | ||
volume_flux_dg = volume_flux, | ||
volume_flux_fv = surface_flux) | ||
|
||
solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, | ||
volume_integral = volume_integral, RealT = Float32) | ||
|
||
############################################################################### | ||
|
||
coordinates_min = (-1.0f0, -1.0f0) | ||
coordinates_max = (+1.0f0, +1.0f0) | ||
|
||
trees_per_dimension = (4, 4) | ||
mesh = P4estMesh(trees_per_dimension, | ||
polydeg = 4, initial_refinement_level = 2, | ||
coordinates_min = coordinates_min, coordinates_max = coordinates_max, | ||
periodicity = true, RealT = Float32) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0f0, 2.0f0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 1.0f0) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, | ||
alive_callback, | ||
stepsize_callback) | ||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), | ||
dt = 1.0f0, # 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using Downloads: download | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
|
117 changes: 117 additions & 0 deletions
117
examples/p4est_2d_dgsem/elixir_euler_weak_blast_wave_amr.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,117 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations2D(1.4) | ||
|
||
function initial_condition_weak_blast_wave(x, t, equations::CompressibleEulerEquations2D) | ||
# 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) | ||
|
||
r0 = 0.2 | ||
E = 1 | ||
p0_inner = 3 | ||
p0_outer = 1 | ||
|
||
# Calculate primitive variables | ||
rho = 1.1 | ||
v1 = 0.0 | ||
v2 = 0.0 | ||
p = r > r0 ? p0_outer : p0_inner | ||
|
||
return prim2cons(SVector(rho, v1, v2, p), equations) | ||
end | ||
|
||
initial_condition = initial_condition_weak_blast_wave | ||
|
||
# Get the DG approximation space | ||
|
||
# Activate the shock capturing + flux differencing | ||
surface_flux = flux_lax_friedrichs | ||
volume_flux = flux_ranocha | ||
polydeg = 4 | ||
basis = LobattoLegendreBasis(polydeg) | ||
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) | ||
|
||
solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux, | ||
volume_integral = volume_integral) | ||
|
||
############################################################################### | ||
|
||
# Affine type mapping to take the [-1,1]^2 domain | ||
# and warp it as described in https://arxiv.org/abs/2012.12040 | ||
# Warping with the coefficient 0.2 is even more extreme. | ||
function mapping_twist(xi, eta) | ||
y = eta + 0.125 * cos(1.5 * pi * xi) * cos(0.5 * pi * eta) | ||
x = xi + 0.125 * cos(0.5 * pi * xi) * cos(2.0 * pi * y) | ||
return SVector(x, y) | ||
end | ||
|
||
# The mesh below can be made periodic | ||
# Create P4estMesh with 8 x 8 trees | ||
trees_per_dimension = (8, 8) | ||
mesh = P4estMesh(trees_per_dimension, polydeg = 4, | ||
mapping = mapping_twist, | ||
initial_refinement_level = 0, | ||
periodicity = true) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 1.2) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 400 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, | ||
save_analysis = true, | ||
extra_analysis_errors = (:conservation_error,)) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(dt = 0.2, | ||
save_initial_solution = true, | ||
save_final_solution = true) | ||
|
||
amr_indicator = IndicatorLöhner(semi, variable = Trixi.density) | ||
amr_controller = ControllerThreeLevel(semi, amr_indicator, | ||
base_level = 0, | ||
med_level = 1, med_threshold = 0.05, | ||
max_level = 2, max_threshold = 0.1) | ||
amr_callback = AMRCallback(semi, amr_controller, | ||
interval = 5, | ||
adapt_initial_condition = true, | ||
adapt_initial_condition_only_refine = true) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 0.5) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, | ||
alive_callback, | ||
save_solution, | ||
amr_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);#, maxiters=4); | ||
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
62 changes: 62 additions & 0 deletions
62
examples/p4est_3d_dgsem/elixir_euler_free_stream_boundaries_float32.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,62 @@ | ||
# Similar to p4est_3d_dgsem/elixir_euler_free_stream_boundaries.jl | ||
# but using Float32 instead of the default Float64 | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations3D(1.4f0) | ||
|
||
initial_condition = initial_condition_constant | ||
|
||
polydeg = 3 | ||
solver = DGSEM(polydeg = polydeg, surface_flux = flux_lax_friedrichs, RealT = Float32) | ||
|
||
############################################################################### | ||
# Get the uncurved mesh from a file (downloads the file if not available locally) | ||
|
||
default_mesh_file = joinpath(@__DIR__, "mesh_cube_with_boundaries.inp") | ||
isfile(default_mesh_file) || | ||
Trixi.download("https://gist.githubusercontent.com/DanielDoehring/710eab379fe3042dc08af6f2d1076e49/raw/38e9803bc0dab9b32a61d9542feac5343c3e6f4b/mesh_cube_with_boundaries.inp", | ||
default_mesh_file) | ||
mesh_file = default_mesh_file | ||
|
||
boundary_symbols = [:PhysicalSurface1, :PhysicalSurface2] | ||
|
||
mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols, | ||
RealT = Float32) | ||
|
||
boundary_conditions = Dict(:PhysicalSurface1 => BoundaryConditionDirichlet(initial_condition), | ||
:PhysicalSurface2 => BoundaryConditionDirichlet(initial_condition)) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
boundary_conditions = boundary_conditions) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0f0, 1.0f0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 1.5f0) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, alive_callback, | ||
stepsize_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false), | ||
dt = 1.0f0, # 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 |
Oops, something went wrong.