Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use velocity in Navier-Stokes convergence tests #2170

Merged
merged 10 commits into from
Nov 21, 2024
10 changes: 5 additions & 5 deletions examples/dgmulti_2d/elixir_advection_diffusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ cells_per_dimension = (16, 16)
mesh = DGMultiMesh(dg, cells_per_dimension; is_on_boundary)

# BC types
boundary_condition_left = BoundaryConditionDirichlet((x, t, equations) -> SVector(1 +
0.1 *
x[2]))
boundary_condition_zero = BoundaryConditionDirichlet((x, t, equations) -> SVector(0.0))
boundary_condition_neumann_zero = BoundaryConditionNeumann((x, t, equations) -> SVector(0.0))
boundary_condition_left = BoundaryConditionDirichlet((x, t, equations_parabolic) -> SVector(1 +
0.1 *
x[2]))
boundary_condition_zero = BoundaryConditionDirichlet((x, t, equations_parabolic) -> SVector(0.0))
boundary_condition_neumann_zero = BoundaryConditionNeumann((x, t, equations_parabolic) -> SVector(0.0))

# define inviscid boundary conditions
boundary_conditions = (; :left => boundary_condition_left,
Expand Down
10 changes: 6 additions & 4 deletions examples/dgmulti_2d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,12 @@ 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])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)

Expand Down
10 changes: 6 additions & 4 deletions examples/dgmulti_2d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ 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])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)

Expand Down
6 changes: 3 additions & 3 deletions examples/dgmulti_2d/elixir_navierstokes_lid_driven_cavity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ end
initial_condition = initial_condition_cavity

# BC types
velocity_bc_lid = NoSlip((x, t, equations) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_lid = NoSlip((x, t, equations_parabolic) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations_parabolic) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat_bc)
boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc)

Expand Down
10 changes: 6 additions & 4 deletions examples/dgmulti_3d/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,12 @@ 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])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
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_parabolic) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)

Expand Down
10 changes: 6 additions & 4 deletions examples/dgmulti_3d/elixir_navierstokes_convergence_curved.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@ 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])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
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_parabolic) -> 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 @@ -76,21 +76,23 @@ boundary_conditions = Dict(:Left => boundary_condition_subsonic_constant,
:AirfoilBottom => boundary_condition_slip_wall,
:AirfoilTop => boundary_condition_slip_wall)

velocity_airfoil = NoSlip((x, t, equations) -> SVector(0.0, 0.0))
velocity_airfoil = NoSlip((x, t, equations_parabolic) -> SVector(0.0, 0.0))

heat_airfoil = Adiabatic((x, t, equations) -> 0.0)
heat_airfoil = Adiabatic((x, t, equations_parabolic) -> 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))

heat_bc_square = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_square = NoSlip((x, t, equations_parabolic) -> velocities_initial_condition_mach08_flow(x,
t,
equations))

heat_bc_square = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_square = BoundaryConditionNavierStokesWall(velocity_bc_square,
heat_bc_square)

Expand Down
9 changes: 5 additions & 4 deletions examples/p4est_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ end
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])
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
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)

heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 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,10 +178,12 @@ 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])
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
return SVector(u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end

heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 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 @@ -34,9 +34,9 @@ end
initial_condition = initial_condition_cavity

# BC types
velocity_bc_lid = NoSlip((x, t, equations) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_lid = NoSlip((x, t, equations_parabolic) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations_parabolic) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat_bc)
boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ end
initial_condition = initial_condition_cavity

# BC types
velocity_bc_lid = NoSlip((x, t, equations) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_lid = NoSlip((x, t, equations_parabolic) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations_parabolic) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat_bc)
boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc)

Expand Down
9 changes: 5 additions & 4 deletions examples/p4est_3d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,12 @@ end
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])
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
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)

heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)

Expand Down
22 changes: 13 additions & 9 deletions examples/tree_1d_dgsem/elixir_navierstokes_convergence_walls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,19 @@ 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])

heat_bc_left = Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
t,
equations),
equations_parabolic))
heat_bc_right = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_left_right = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
return u_cons[2] / u_cons[1]
andrewwinters5000 marked this conversation as resolved.
Show resolved Hide resolved
end

heat_bc_left = Isothermal() do x, t, equations_parabolic
Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
t,
equations_parabolic),
equations_parabolic)
end

heat_bc_right = Adiabatic((x, t, equations_parabolic) -> 0.0)

boundary_condition_left = BoundaryConditionNavierStokesWall(velocity_bc_left_right,
heat_bc_left)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,19 @@ 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])

heat_bc_left = Isothermal((x, t, equations) -> Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
t,
equations),
equations_parabolic))
heat_bc_right = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_left_right = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
return u_cons[2] / u_cons[1]
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
end

heat_bc_left = Isothermal() do x, t, equations_parabolic
Trixi.temperature(initial_condition_navier_stokes_convergence_test(x,
t,
equations_parabolic),
equations_parabolic)
end

heat_bc_right = Adiabatic((x, t, equations_parabolic) -> 0.0)

boundary_condition_left = BoundaryConditionNavierStokesWall(velocity_bc_left_right,
heat_bc_left)
Expand Down
9 changes: 5 additions & 4 deletions examples/tree_2d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,12 @@ end
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])
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
# This may be an `SVector` or simply a `Tuple`
return (u_cons[2] / u_cons[1], u_cons[3] / u_cons[1])
end
heat_bc_top_bottom = Adiabatic((x, t, equations) -> 0.0)
heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 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 @@ -33,9 +33,9 @@ end
initial_condition = initial_condition_cavity

# BC types
velocity_bc_lid = NoSlip((x, t, equations) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations) -> 0.0)
velocity_bc_lid = NoSlip((x, t, equations_parabolic) -> SVector(1.0, 0.0))
velocity_bc_cavity = NoSlip((x, t, equations_parabolic) -> SVector(0.0, 0.0))
heat_bc = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_lid = BoundaryConditionNavierStokesWall(velocity_bc_lid, heat_bc)
boundary_condition_cavity = BoundaryConditionNavierStokesWall(velocity_bc_cavity, heat_bc)

Expand Down
8 changes: 4 additions & 4 deletions examples/tree_3d_dgsem/elixir_navierstokes_convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ end
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])
velocity_bc_top_bottom = NoSlip() do x, t, equations_parabolic
u_cons = initial_condition_navier_stokes_convergence_test(x, t, equations_parabolic)
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)
heat_bc_top_bottom = Adiabatic((x, t, equations_parabolic) -> 0.0)
boundary_condition_top_bottom = BoundaryConditionNavierStokesWall(velocity_bc_top_bottom,
heat_bc_top_bottom)

Expand Down
20 changes: 10 additions & 10 deletions test/test_parabolic_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ 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.0029963751636357117,
0.0028639041695096433,
0.012691132694550689
])
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 Down
Loading
Loading