-
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 simplessprk_dt
- Loading branch information
Showing
11 changed files
with
644 additions
and
12 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.6.4-pre" | ||
version = "0.6.5-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
|
||
using Downloads: download | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the linear advection equation | ||
|
||
advection_velocity = (0.2, -0.7) | ||
equations = LinearScalarAdvectionEquation2D(advection_velocity) | ||
|
||
############################################################################### | ||
# Get the FDSBP approximation operator | ||
|
||
D_SBP = derivative_operator(SummationByPartsOperators.MattssonAlmquistVanDerWeide2018Accurate(), | ||
derivative_order = 1, accuracy_order = 4, | ||
xmin = -1.0, xmax = 1.0, N = 15) | ||
solver = FDSBP(D_SBP, | ||
surface_integral = SurfaceIntegralStrongForm(flux_lax_friedrichs), | ||
volume_integral = VolumeIntegralStrongForm()) | ||
|
||
############################################################################### | ||
# Get the curved quad mesh from a file (downloads the file if not available locally) | ||
|
||
default_mesh_file = joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh") | ||
isfile(default_mesh_file) || | ||
download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh", | ||
default_mesh_file) | ||
mesh_file = default_mesh_file | ||
|
||
mesh = UnstructuredMesh2D(mesh_file, periodicity = true) | ||
|
||
############################################################################### | ||
# create the semidiscretization object | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition_convergence_test, | ||
solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
# Create ODE problem with time span from 0.0 to 1.0 | ||
ode = semidiscretize(semi, (0.0, 1.0)) | ||
|
||
# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup | ||
# and resets the timers | ||
summary_callback = SummaryCallback() | ||
|
||
# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results | ||
analysis_callback = AnalysisCallback(semi, interval = 100) | ||
|
||
# The SaveSolutionCallback allows to save the solution to a file in regular intervals | ||
save_solution = SaveSolutionCallback(interval = 100, | ||
solution_variables = cons2prim) | ||
|
||
# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step | ||
stepsize_callback = StepsizeCallback(cfl = 1.6) | ||
|
||
# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver | ||
callbacks = CallbackSet(summary_callback, analysis_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 |
77 changes: 77 additions & 0 deletions
77
examples/unstructured_2d_fdsbp/elixir_euler_free_stream.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,77 @@ | ||
|
||
using Downloads: download | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations2D(1.4) | ||
|
||
# Free-stream initial condition | ||
initial_condition = initial_condition_constant | ||
|
||
# Boundary conditions for free-stream testing | ||
boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) | ||
boundary_conditions = Dict(:Body => boundary_condition_free_stream, | ||
:Button1 => boundary_condition_free_stream, | ||
:Button2 => boundary_condition_free_stream, | ||
:Eye1 => boundary_condition_free_stream, | ||
:Eye2 => boundary_condition_free_stream, | ||
:Smile => boundary_condition_free_stream, | ||
:Bowtie => boundary_condition_free_stream) | ||
|
||
############################################################################### | ||
# Get the FDSBP approximation space | ||
|
||
D_SBP = derivative_operator(SummationByPartsOperators.MattssonAlmquistVanDerWeide2018Accurate(), | ||
derivative_order = 1, accuracy_order = 4, | ||
xmin = -1.0, xmax = 1.0, N = 12) | ||
solver = FDSBP(D_SBP, | ||
surface_integral = SurfaceIntegralStrongForm(flux_hll), | ||
volume_integral = VolumeIntegralStrongForm()) | ||
|
||
############################################################################### | ||
# Get the curved quad mesh from a file (downloads the file if not available locally) | ||
|
||
default_mesh_file = joinpath(@__DIR__, "mesh_gingerbread_man.mesh") | ||
isfile(default_mesh_file) || | ||
download("https://gist.githubusercontent.com/andrewwinters5000/2c6440b5f8a57db131061ad7aa78ee2b/raw/1f89fdf2c874ff678c78afb6fe8dc784bdfd421f/mesh_gingerbread_man.mesh", | ||
default_mesh_file) | ||
mesh_file = default_mesh_file | ||
|
||
mesh = UnstructuredMesh2D(mesh_file) | ||
|
||
############################################################################### | ||
# create the semi discretization object | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
boundary_conditions = boundary_conditions) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 5.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) | ||
|
||
callbacks = CallbackSet(summary_callback, analysis_callback, | ||
alive_callback, save_solution) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
# set small tolerances for the free-stream preservation test | ||
sol = solve(ode, SSPRK43(), abstol = 1.0e-12, reltol = 1.0e-12, | ||
save_everystep = false, callback = callbacks) | ||
summary_callback() # print the timer summary |
65 changes: 65 additions & 0 deletions
65
examples/unstructured_2d_fdsbp/elixir_euler_source_terms.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,65 @@ | ||
|
||
using Downloads: download | ||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations2D(1.4) | ||
|
||
initial_condition = initial_condition_convergence_test | ||
|
||
############################################################################### | ||
# Get the FDSBP approximation operator | ||
|
||
D_SBP = derivative_operator(SummationByPartsOperators.MattssonNordström2004(), | ||
derivative_order = 1, accuracy_order = 4, | ||
xmin = -1.0, xmax = 1.0, N = 10) | ||
solver = FDSBP(D_SBP, | ||
surface_integral = SurfaceIntegralStrongForm(flux_lax_friedrichs), | ||
volume_integral = VolumeIntegralStrongForm()) | ||
|
||
############################################################################### | ||
# Get the curved quad mesh from a file (downloads the file if not available locally) | ||
|
||
default_mesh_file = joinpath(@__DIR__, "mesh_periodic_square_with_twist.mesh") | ||
isfile(default_mesh_file) || | ||
download("https://gist.githubusercontent.com/andrewwinters5000/12ce661d7c354c3d94c74b964b0f1c96/raw/8275b9a60c6e7ebbdea5fc4b4f091c47af3d5273/mesh_periodic_square_with_twist.mesh", | ||
default_mesh_file) | ||
mesh_file = default_mesh_file | ||
|
||
mesh = UnstructuredMesh2D(mesh_file, periodicity = true) | ||
|
||
############################################################################### | ||
# create the semi discretization object | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
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) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = 100, | ||
save_initial_solution = true, | ||
save_final_solution = true) | ||
|
||
callbacks = CallbackSet(summary_callback, analysis_callback, | ||
alive_callback, save_solution) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, SSPRK43(), abstol = 1.0e-9, reltol = 1.0e-9, | ||
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
Oops, something went wrong.