Path: blob/main/examples/unstructured_2d_dgsem/elixir_euler_wall_bc.jl
2055 views
using OrdinaryDiffEqLowStorageRK1using Trixi23###############################################################################4# semidiscretization of the compressible Euler equations56equations = CompressibleEulerEquations2D(1.4)78@inline function uniform_flow_state(x, t, equations::CompressibleEulerEquations2D)910# set the freestream flow parameters11rho_freestream = 1.012u_freestream = 0.313p_freestream = inv(equations.gamma)1415theta = pi / 90.0 # analogous with a two degree angle of attack16si, co = sincos(theta)17v1 = u_freestream * co18v2 = u_freestream * si1920prim = SVector(rho_freestream, v1, v2, p_freestream)21return prim2cons(prim, equations)22end2324initial_condition = uniform_flow_state2526boundary_condition_uniform_flow = BoundaryConditionDirichlet(uniform_flow_state)27boundary_conditions = Dict(:Bottom => boundary_condition_uniform_flow,28:Top => boundary_condition_uniform_flow,29:Right => boundary_condition_uniform_flow,30:Left => boundary_condition_uniform_flow,31:Circle => boundary_condition_slip_wall)3233###############################################################################34# Get the DG approximation space3536solver = DGSEM(polydeg = 4, surface_flux = flux_hll)3738###############################################################################39# Get the curved quad mesh from a file40mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/8b9b11a1eedfa54b215c122c3d17b271/raw/0d2b5d98c87e67a6f384693a8b8e54b4c9fcbf3d/mesh_box_around_circle.mesh",41joinpath(@__DIR__, "mesh_box_around_circle.mesh"))4243mesh = UnstructuredMesh2D(mesh_file)4445###############################################################################46# create the semi discretization object4748semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver,49boundary_conditions = boundary_conditions)5051###############################################################################52# ODE solvers, callbacks etc.5354tspan = (0.0, 0.5)55ode = semidiscretize(semi, tspan)5657summary_callback = SummaryCallback()5859analysis_interval = 10060analysis_callback = AnalysisCallback(semi, interval = analysis_interval)6162alive_callback = AliveCallback(analysis_interval = analysis_interval)6364save_solution = SaveSolutionCallback(interval = 10,65save_initial_solution = true,66save_final_solution = true)6768stepsize_callback = StepsizeCallback(cfl = 1.0)6970callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, save_solution,71stepsize_callback)7273###############################################################################74# run the simulation7576sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false);77dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback78ode_default_options()..., callback = callbacks);798081