|
| 1 | +using Trixi |
| 2 | + |
| 3 | +############################################################################### |
| 4 | +# This example shows that one can restart a hyperbolic-parabolic simulation from |
| 5 | +# a purely hyperbolic simulation/restart file. |
| 6 | + |
| 7 | +base_elixir = "elixir_euler_NACA0012airfoil_mach085.jl" |
| 8 | +trixi_include(@__MODULE__, joinpath(@__DIR__, base_elixir), |
| 9 | + tspan = (0.0, 0.005)) |
| 10 | + |
| 11 | +############################################################################### |
| 12 | +# semidiscretization of the compressible Navier-Stokes equations |
| 13 | + |
| 14 | +Re() = 50000.0 |
| 15 | +airfoil_cord_length() = 1.0 |
| 16 | +mu() = rho_inf() * u_inf(equations) * airfoil_cord_length() / Re() |
| 17 | + |
| 18 | +prandtl_number() = 0.72 |
| 19 | + |
| 20 | +equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu = mu(), |
| 21 | + Prandtl = prandtl_number(), |
| 22 | + gradient_variables = GradientVariablesPrimitive()) |
| 23 | + |
| 24 | +############################################################################### |
| 25 | + |
| 26 | +velocity_bc_airfoil = NoSlip((x, t, equations) -> SVector(0.0, 0.0)) |
| 27 | +heat_bc = Adiabatic((x, t, equations) -> 0.0) |
| 28 | +boundary_condition_airfoil = BoundaryConditionNavierStokesWall(velocity_bc_airfoil, heat_bc) |
| 29 | + |
| 30 | +boundary_condition_free_stream = BoundaryConditionDirichlet(initial_condition) |
| 31 | + |
| 32 | +boundary_conditions_hyp = Dict(:Left => boundary_condition_free_stream, |
| 33 | + :Right => boundary_condition_free_stream, |
| 34 | + :Top => boundary_condition_free_stream, |
| 35 | + :Bottom => boundary_condition_free_stream, |
| 36 | + :AirfoilBottom => boundary_condition_slip_wall, |
| 37 | + :AirfoilTop => boundary_condition_slip_wall) |
| 38 | + |
| 39 | +boundary_conditions_para = Dict(:Left => boundary_condition_free_stream, |
| 40 | + :Right => boundary_condition_free_stream, |
| 41 | + :Top => boundary_condition_free_stream, |
| 42 | + :Bottom => boundary_condition_free_stream, |
| 43 | + :AirfoilBottom => boundary_condition_airfoil, |
| 44 | + :AirfoilTop => boundary_condition_airfoil) |
| 45 | + |
| 46 | +restart_file = "restart_000000584.h5" |
| 47 | +restart_filename = joinpath("out", restart_file) |
| 48 | +mesh = load_mesh(restart_filename) |
| 49 | + |
| 50 | +semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), |
| 51 | + initial_condition, solver; |
| 52 | + boundary_conditions = (boundary_conditions_hyp, |
| 53 | + boundary_conditions_para)) |
| 54 | + |
| 55 | +############################################################################### |
| 56 | + |
| 57 | +tspan = (0.0, 10.0) |
| 58 | +dt_restart = load_dt(restart_filename) |
| 59 | +ode = semidiscretize(semi, tspan, restart_filename) |
| 60 | + |
| 61 | +analysis_callback = AnalysisCallback(semi, interval = analysis_interval, |
| 62 | + output_directory = "out", |
| 63 | + save_analysis = true, |
| 64 | + analysis_integrals = (drag_coefficient, |
| 65 | + lift_coefficient)) |
| 66 | + |
| 67 | +amr_indicator = IndicatorLöhner(semi, variable = Trixi.density) |
| 68 | + |
| 69 | +amr_controller = ControllerThreeLevel(semi, amr_indicator, |
| 70 | + base_level = 1, |
| 71 | + med_level = 3, med_threshold = 0.05, |
| 72 | + max_level = 4, max_threshold = 0.1) |
| 73 | + |
| 74 | +amr_interval = 100 |
| 75 | +amr_callback = AMRCallback(semi, amr_controller, |
| 76 | + interval = amr_interval, |
| 77 | + adapt_initial_condition = true, |
| 78 | + adapt_initial_condition_only_refine = true) |
| 79 | + |
| 80 | +callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback, |
| 81 | + save_solution, save_restart, |
| 82 | + stepsize_callback, amr_callback) |
| 83 | + |
| 84 | +############################################################################### |
| 85 | + |
| 86 | +sol = solve(ode, SSPRK54(thread = Trixi.True()); |
| 87 | + dt = dt_restart, |
| 88 | + ode_default_options()..., callback = callbacks); |
0 commit comments