Path: blob/main/examples/p4est_3d_dgsem/elixir_euler_tandem_spheres.jl
5586 views
using Trixi1using OrdinaryDiffEqLowStorageRK23###############################################################################4# semidiscretization of the compressible Euler equations56gamma = 1.47equations = CompressibleEulerEquations3D(gamma)89# Simulation setup roughly based on testcase CS1 (Tandem Spheres) from the10# 5th International Workshop on High-Order CFD Methods.11# For description see:12# https://how5.cenaero.be/content/cs1-tandem-spheres-re390013# This is a simplified inviscid version of the testcase, mainly14# designed to test the import of second-order (curved) elements in 3D.1516D = 1 # Sphere diameter, follows from mesh17U() = 0.118rho_ref() = 1.41920@inline function initial_condition(x, t, equations)21# set the freestream flow parameters22rho_freestream = rho_ref()2324# v_total = 0.1 = Mach (for c = 1)25v1 = U()26v2 = 0.027v3 = 0.02829p_freestream = 1.03031prim = SVector(rho_freestream, v1, v2, v3, p_freestream)32return prim2cons(prim, equations)33end3435bc_farfield = BoundaryConditionDirichlet(initial_condition)3637polydeg = 238surface_flux = flux_hll3940# Flux Differencing required to make this example run41volume_flux = flux_ranocha42volume_integral = VolumeIntegralFluxDifferencing(volume_flux)4344solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,45volume_integral = volume_integral)4647# Mesh taken from https://acdl.mit.edu/HOW5/CS1_TandemSpheres/pointwise/gmsh/48# and converted to Abaqus .inp format using Gmsh after adding49#50# $PhysicalNames51# 452# 2 2 "BackSphere"53# 2 3 "FarField"54# 2 4 "FrontSphere"55# 3 1 "Fluid"56# $EndPhysicalNames57#58# in the .msh file.5960mesh_file = joinpath(@__DIR__, "TandemSpheresHexMesh1P2_fixed.inp")61using Downloads62Downloads.download("https://zenodo.org/records/18921889/files/TandemSpheresHexMesh1P2_fixed.inp?download=1",63mesh_file)6465# Boundary symbols follow from nodesets in the mesh file66boundary_symbols = [:FrontSphere, :BackSphere, :FarField]67mesh = P4estMesh{3}(mesh_file; boundary_symbols = boundary_symbols)6869boundary_conditions = (; FrontSphere = boundary_condition_slip_wall,70BackSphere = boundary_condition_slip_wall,71FarField = bc_farfield)7273semi = SemidiscretizationHyperbolic(mesh, equations,74initial_condition, solver;75boundary_conditions = boundary_conditions)7677t_star_end = 1.0 # 100 recommended in testcase description78t_end = t_star_end * D / U() # convert `t_star` to unit-equipped time79tspan = (0.0, t_end)80ode = semidiscretize(semi, tspan)8182###############################################################################8384summary_callback = SummaryCallback()8586analysis_interval = 50087analysis_callback = AnalysisCallback(semi, interval = analysis_interval)8889alive_callback = AliveCallback(alive_interval = 50)9091save_sol_interval = 50092save_solution = SaveSolutionCallback(interval = save_sol_interval,93save_initial_solution = false)9495callbacks = CallbackSet(summary_callback,96alive_callback,97analysis_callback,98save_solution)99100###############################################################################101102tols = 1e-5103sol = solve(ode, RDPK3SpFSAL35(thread = Trixi.True());104abstol = tols, reltol = tols,105ode_default_options()..., callback = callbacks);106107108