Path: blob/main/examples/p4est_3d_dgsem/elixir_navierstokes_crm.jl
5586 views
using OrdinaryDiffEqSSPRK1using Trixi23# CRM = Common Research Model4# https://doi.org/10.2514/6.2008-69195###############################################################################67gamma = 1.48prandtl_number() = 0.72910# Follows problem C3.5 of the 2015 Third International Workshop on High-Order CFD Methods11# https://www1.grc.nasa.gov/research-and-engineering/hiocfd/1213#Re = 5 * 10^6 # C3.5 testcase14Re = 200 * 10^6 # Increase Reynolds number to 200 million (otherwise the simulation crashes immediately due to the very coarse mesh)1516chord = 7.005 # m = 275.80 inches1718c = 343.0 # m/s = 13504 inches/s19rho() = 1.293 # kg/m^3 = 2.1199e-5 kg/inches^32021p() = c^2 * rho() / gamma22M = 0.8523U() = M * c2425mu() = rho() * chord * U() / Re2627equations = CompressibleEulerEquations3D(gamma)28equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),29Prandtl = prandtl_number())3031@inline function initial_condition(x, t, equations)32# set the freestream flow parameters33rho_freestream = 1.2933435v1 = 291.55 # = M * c36v2 = 0.037v3 = 0.03839p_freestream = 108657.255 # = c^2 * rho() / gamma4041prim = SVector(rho_freestream, v1, v2, v3, p_freestream)42return prim2cons(prim, equations)43end4445bc_farfield = BoundaryConditionDirichlet(initial_condition)4647polydeg = 248basis = LobattoLegendreBasis(polydeg)4950shock_indicator = IndicatorHennemannGassner(equations, basis,51alpha_max = 0.5,52alpha_min = 0.001,53alpha_smooth = true,54variable = pressure)5556surface_flux = flux_hll57volume_flux = flux_ranocha5859volume_integral = VolumeIntegralShockCapturingHG(shock_indicator;60volume_flux_dg = volume_flux,61volume_flux_fv = surface_flux)6263solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,64volume_integral = volume_integral)6566# This is an extremely coarse mesh with only ~79k cells, thus way too coarse for real simulations.67# The mesh is further truncated to linear elements from third-order elements.68mesh_file = Trixi.download("https://gist.githubusercontent.com/DanielDoehring/fbc9d785909263ffec76983c4d520fe3/raw/68741ba6c6965b2045af04323bf73df9dab6ed6d/CRM_HIOCFD_2015_meters.inp",69joinpath(@__DIR__, "CRM_HIOCFD_2015_meters.inp"))7071boundary_symbols = [:SYMMETRY,72:FARFIELD, :OUTFLOW,73:WING, :FUSELAGE, :WING_UP, :WING_LO]7475mesh = P4estMesh{3}(mesh_file, polydeg = polydeg, boundary_symbols = boundary_symbols)7677boundary_conditions_hyp = (; SYMMETRY = boundary_condition_slip_wall, # slip wall allows for tangential velocity => Sufficient for symmetry78FARFIELD = bc_farfield,79OUTFLOW = bc_farfield, # We also use farfield for "outflow" boundary80WING = boundary_condition_slip_wall,81FUSELAGE = boundary_condition_slip_wall,82WING_UP = boundary_condition_slip_wall,83WING_LO = boundary_condition_slip_wall)8485velocity_bc_plane = NoSlip((x, t, equations) -> SVector(0.0, 0.0, 0.0))86heat_bc = Adiabatic((x, t, equations) -> 0.0)87bc_body = BoundaryConditionNavierStokesWall(velocity_bc_plane, heat_bc)8889# The "Slip" boundary condition rotates all velocities into tangential direction90# and thus acts as a symmetry plane.91bc_symmetry_plane = BoundaryConditionNavierStokesWall(Slip(), heat_bc)9293boundary_conditions_para = (; SYMMETRY = bc_symmetry_plane,94FARFIELD = bc_farfield,95OUTFLOW = bc_farfield, # We also use farfield for "outflow" boundary96WING = bc_body,97FUSELAGE = bc_body,98WING_UP = bc_body,99WING_LO = bc_body)100101semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),102initial_condition, solver;103boundary_conditions = (boundary_conditions_hyp,104boundary_conditions_para))105106tspan = (0.0, 1.5e-5)107ode = semidiscretize(semi, tspan)108109###############################################################################110111summary_callback = SummaryCallback()112113analysis_interval = 1000114analysis_callback = AnalysisCallback(semi, interval = analysis_interval,115analysis_errors = Symbol[],116analysis_integrals = ())117118alive_callback = AliveCallback(alive_interval = 10)119120save_sol_interval = 5000121save_solution = SaveSolutionCallback(interval = save_sol_interval,122save_initial_solution = false,123save_final_solution = true,124solution_variables = cons2prim,125output_directory = "out")126127save_restart = SaveRestartCallback(interval = save_sol_interval,128save_final_restart = true,129output_directory = "out")130131cfl = 0.4132stepsize_callback = StepsizeCallback(cfl = cfl, interval = 5)133134callbacks = CallbackSet(summary_callback,135alive_callback,136analysis_callback,137save_solution,138save_restart,139stepsize_callback)140141###############################################################################142143sol = solve(ode, SSPRK33(), dt = 42.0,144save_everystep = false, callback = callbacks);145146147