Skip to content

Commit

Permalink
Use velocity in Navier-Stokes convergence tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Nov 19, 2024
1 parent c9f0707 commit 92fab1e
Show file tree
Hide file tree
Showing 15 changed files with 245 additions and 227 deletions.
8 changes: 5 additions & 3 deletions examples/dgmulti_2d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2:3])
velocity_bc_top_bottom = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down
8 changes: 5 additions & 3 deletions examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,11 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2:3])
velocity_bc_top_bottom = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down
8 changes: 5 additions & 3 deletions examples/dgmulti_3d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2:4])
velocity_bc_top_bottom = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1], u_cons[4] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down
8 changes: 5 additions & 3 deletions examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,11 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2:4])
velocity_bc_top_bottom = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1], u_cons[4] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ heat_airfoil = Adiabatic((x, t, equations) -> 0.0)
boundary_conditions_airfoil = BoundaryConditionNavierStokesWall(velocity_airfoil,
heat_airfoil)

function momenta_initial_condition_mach08_flow(x, t, equations)
u = initial_condition_mach08_flow(x, t, equations)
momenta = SVector(u[2], u[3])
function velocities_initial_condition_mach08_flow(x, t, equations)
u_cons = initial_condition_mach08_flow(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end
velocity_bc_square = NoSlip((x, t, equations) -> momenta_initial_condition_mach08_flow(x, t,
equations))

velocity_bc_square = NoSlip((x, t, equations) -> velocities_initial_condition_mach08_flow(x,
t,
equations))

heat_bc_square = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_square = BoundaryConditionNavierStokesWall(velocity_bc_square,
Expand Down
5 changes: 3 additions & 2 deletions examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
u = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u[2], u[3])
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2:3])
velocity_bc_top_bottom = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down
7 changes: 5 additions & 2 deletions examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
u = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u[2], u[3], u[4])
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1], u_cons[4] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)
Expand Down Expand Up @@ -264,3 +265,5 @@ time_int_tol = 1e-8
sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol, dt = 1e-5,
ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary

display(analysis_callback(sol))
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_left_right = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2])
velocity_bc_left_right = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return u_cons[2] / u_cons[1]
end

heat_bc_left = Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ end
initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_left_right = NoSlip((x, t, equations) -> initial_condition_navier_stokes_convergence_test(x,
t,
equations)[2])
velocity_bc_left_right = NoSlip() do x, t, equations
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return u_cons[2] / u_cons[1]
end

heat_bc_left = Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
t,
Expand Down
4 changes: 2 additions & 2 deletions examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
u = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u[2], u[3])
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
Expand Down
4 changes: 2 additions & 2 deletions examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ initial_condition = initial_condition_navier_stokes_convergence_test

# BC types
velocity_bc_top_bottom = NoSlip() do x, t, equations
u = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u[2], u[3], u[4])
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1], u_cons[4] / u_cons[1])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
Expand Down
48 changes: 24 additions & 24 deletions test/test_parabolic_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ end
@test_trixi_include(joinpath(examples_dir(), "tree_1d_dgsem",
"elixir_navierstokes_convergence_walls.jl"),
l2=[
0.00047023310868269237,
0.00032181736027057234,
0.0014966266486095025
0.0004702331100298379,
0.0003218173539588441,
0.001496626616191212
],
linf=[
0.002996375101363302,
0.0028639041695096433,
0.012691132694550689
0.0029963751636357117,
0.002863904080244726,
0.012691132434907715
])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
Expand All @@ -157,14 +157,14 @@ end
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesEntropy()),
l2=[
0.0004608500483647771,
0.00032431091222851285,
0.0015159733360626845
0.00046085004909354776,
0.0003243109084492897,
0.0015159733164383632
],
linf=[
0.002754803146635787,
0.0028567713744625124,
0.012941793784197131
0.0027548031865172184,
0.0028567713569609024,
0.012941793735691931
])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
Expand All @@ -183,14 +183,14 @@ end
mu = mu(),
Prandtl = prandtl_number()),
l2=[
2.5278845598681636e-5,
2.5540145802666872e-5,
0.0001211867535580826
2.5279985418616284e-5,
2.5543804380243317e-5,
0.000121197807780003
],
linf=[
0.0001466387202588848,
0.00019422419092429135,
0.0009556449835592673
0.00014663941942760772,
0.00019421961959378687,
0.0009556612427097377
])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
Expand All @@ -210,14 +210,14 @@ end
Prandtl = prandtl_number(),
gradient_variables = GradientVariablesEntropy()),
l2=[
2.4593521887223632e-5,
2.3928212900127102e-5,
0.00011252332663824173
2.459436737779634e-5,
2.393023570132773e-5,
0.00011253258031437205
],
linf=[
0.00011850494672183132,
0.00018987676556476442,
0.0009597461727750556
0.00011850784723010932,
0.00018988145760703384,
0.0009597937547916047
])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
Expand Down
Loading

0 comments on commit 92fab1e

Please sign in to comment.