Path: blob/main/examples/p4est_3d_dgsem/elixir_linearizedeuler_convergence.jl
5586 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the linearized Euler equations56equations = LinearizedEulerEquations3D(v_mean_global = (0.0, 0.0, 0.0), c_mean_global = 1.0,7rho_mean_global = 1.0)89initial_condition = initial_condition_convergence_test1011solver = DGSEM(polydeg = 3, surface_flux = flux_hll)1213coordinates_min = (-1.0, -1.0, -1.0) # minimum coordinates (min(x), min(y), min(z))14coordinates_max = (1.0, 1.0, 1.0) # maximum coordinates (max(x), max(y), max(z))1516# `initial_refinement_level` is provided here to allow for a17# convenient convergence test, see18# https://trixi-framework.github.io/TrixiDocumentation/stable/#Performing-a-convergence-analysis19trees_per_dimension = (4, 4, 4)20mesh = P4estMesh(trees_per_dimension, polydeg = 3,21coordinates_min = coordinates_min,22coordinates_max = coordinates_max,23initial_refinement_level = 0,24periodicity = true)2526# A semidiscretization collects data structures and functions for the spatial discretization27semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;28boundary_conditions = boundary_condition_periodic)2930###############################################################################31# ODE solvers, callbacks etc.3233# Create ODE problem with time span from 0.0 to 0.234tspan = (0.0, 0.2)35ode = semidiscretize(semi, tspan)3637# At the beginning of the main loop, the SummaryCallback prints a summary of the simulation setup38# and resets the timers39summary_callback = SummaryCallback()4041analysis_interval = 1004243# The AnalysisCallback allows to analyse the solution in regular intervals and prints the results44analysis_callback = AnalysisCallback(semi, interval = analysis_interval)4546# The AliveCallback prints short status information in regular intervals47alive_callback = AliveCallback(analysis_interval = analysis_interval)4849# The StepsizeCallback handles the re-calculation of the maximum Δt after each time step50stepsize_callback = StepsizeCallback(cfl = 0.8)5152# Create a CallbackSet to collect all callbacks such that they can be passed to the ODE solver53callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback,54stepsize_callback)5556###############################################################################57# run the simulation5859# OrdinaryDiffEq's `solve` method evolves the solution in time and executes the passed callbacks60sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);61dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback62ode_default_options()..., callback = callbacks);636465