Skip to content

Commit

Permalink
Merge branch 'subcell-limiting' into subcell_positivity_nonconservative
Browse files Browse the repository at this point in the history
  • Loading branch information
amrueda committed Oct 25, 2023
2 parents ee21f0a + f3399b6 commit 6f43419
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 433 deletions.
71 changes: 0 additions & 71 deletions examples/structured_2d_dgsem/elixir_euler_double_mach.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,81 +7,10 @@ using Trixi
gamma = 1.4
equations = CompressibleEulerEquations2D(gamma)

"""
initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D)
Compressible Euler setup for a double Mach reflection problem.
Involves strong shock interactions as well as steady / unsteady flow structures.
Also exercises special boundary conditions along the bottom of the domain that is a mixture of
Dirichlet and slip wall.
See Section IV c on the paper below for details.
- Paul Woodward and Phillip Colella (1984)
The Numerical Simulation of Two-Dimensional Fluid Flows with Strong Shocks.
[DOI: 10.1016/0021-9991(84)90142-6](https://doi.org/10.1016/0021-9991(84)90142-6)
"""
# @inline function initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D)

# if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3)
# phi = pi / 6
# sin_phi, cos_phi = sincos(phi)

# rho = 8
# v1 = 8.25 * cos_phi
# v2 = -8.25 * sin_phi
# p = 116.5
# else
# rho = 1.4
# v1 = 0
# v2 = 0
# p = 1
# end

# prim = SVector(rho, v1, v2, p)
# return prim2cons(prim, equations)
# end
initial_condition = Trixi.initial_condition_double_mach_reflection


# boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_double_mach_reflection)
boundary_condition_inflow_outflow = BoundaryConditionCharacteristic(initial_condition)


# Supersonic outflow boundary condition. Solution is taken entirely from the internal state.
# See `examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl` for complete documentation.
# @inline function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, direction, x, t,
# surface_flux_function, equations::CompressibleEulerEquations2D)
# # NOTE: Only for the supersonic outflow is this strategy valid
# # Calculate the boundary flux entirely from the internal solution state
# return flux(u_inner, normal_direction, equations)
# end

# Special mixed boundary condition type for the :Bottom of the domain.
# It is Dirichlet when x < 1/6 and a slip wall when x >= 1/6
# @inline function boundary_condition_mixed_dirichlet_wall(u_inner, normal_direction::AbstractVector, direction,
# x, t, surface_flux_function,
# equations::CompressibleEulerEquations2D)
# if x[1] < 1 / 6
# # # From the BoundaryConditionDirichlet
# # # get the external value of the solution
# # u_boundary = initial_condition_double_mach_reflection(x, t, equations)
# # # Calculate boundary flux
# # flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)

# # From the BoundaryConditionCharacteristic
# # get the external state of the solution
# u_boundary = Trixi.characteristic_boundary_value_function(initial_condition,
# u_inner, normal_direction, direction, x, t, equations)
# # Calculate boundary flux
# flux = surface_flux_function(u_boundary, u_inner, normal_direction, equations)
# else # x[1] >= 1 / 6
# # Use the free slip wall BC otherwise
# flux = boundary_condition_slip_wall(u_inner, normal_direction, direction, x, t, surface_flux_function, equations)
# end

# return flux
# end

boundary_conditions = (y_neg=Trixi.boundary_condition_mixed_dirichlet_wall,
y_pos=boundary_condition_inflow_outflow,
x_pos=boundary_condition_inflow_outflow,
Expand Down
71 changes: 0 additions & 71 deletions examples/structured_2d_dgsem/elixir_euler_double_mach_MCL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,81 +7,10 @@ using Trixi
gamma = 1.4
equations = CompressibleEulerEquations2D(gamma)

"""
initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D)
Compressible Euler setup for a double Mach reflection problem.
Involves strong shock interactions as well as steady / unsteady flow structures.
Also exercises special boundary conditions along the bottom of the domain that is a mixture of
Dirichlet and slip wall.
See Section IV c on the paper below for details.
- Paul Woodward and Phillip Colella (1984)
The Numerical Simulation of Two-Dimensional Fluid Flows with Strong Shocks.
[DOI: 10.1016/0021-9991(84)90142-6](https://doi.org/10.1016/0021-9991(84)90142-6)
"""
# @inline function initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D)

# if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3)
# phi = pi / 6
# sin_phi, cos_phi = sincos(phi)

# rho = 8
# v1 = 8.25 * cos_phi
# v2 = -8.25 * sin_phi
# p = 116.5
# else
# rho = 1.4
# v1 = 0
# v2 = 0
# p = 1
# end

# prim = SVector(rho, v1, v2, p)
# return prim2cons(prim, equations)
# end
initial_condition = Trixi.initial_condition_double_mach_reflection


# boundary_condition_inflow = BoundaryConditionDirichlet(initial_condition_double_mach_reflection)
boundary_condition_inflow_outflow = BoundaryConditionCharacteristic(initial_condition)


# Supersonic outflow boundary condition. Solution is taken entirely from the internal state.
# See `examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl` for complete documentation.
# @inline function boundary_condition_outflow(u_inner, normal_direction::AbstractVector, direction, x, t,
# surface_flux_function, equations::CompressibleEulerEquations2D)
# # NOTE: Only for the supersonic outflow is this strategy valid
# # Calculate the boundary flux entirely from the internal solution state
# return flux(u_inner, normal_direction, equations)
# end

# Special mixed boundary condition type for the :Bottom of the domain.
# It is Dirichlet when x < 1/6 and a slip wall when x >= 1/6
# @inline function boundary_condition_mixed_dirichlet_wall(u_inner, normal_direction::AbstractVector, direction,
# x, t, surface_flux_function,
# equations::CompressibleEulerEquations2D)
# if x[1] < 1 / 6
# # # From the BoundaryConditionDirichlet
# # # get the external value of the solution
# # u_boundary = initial_condition_double_mach_reflection(x, t, equations)
# # # Calculate boundary flux
# # flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)

# # From the BoundaryConditionCharacteristic
# # get the external state of the solution
# u_boundary = Trixi.characteristic_boundary_value_function(initial_condition,
# u_inner, normal_direction, direction, x, t, equations)
# # Calculate boundary flux
# flux = surface_flux_function(u_boundary, u_inner, normal_direction, equations)
# else # x[1] >= 1 / 6
# # Use the free slip wall BC otherwise
# flux = boundary_condition_slip_wall(u_inner, normal_direction, direction, x, t, surface_flux_function, equations)
# end

# return flux
# end

boundary_conditions = (y_neg=Trixi.boundary_condition_mixed_dirichlet_wall,
y_pos=boundary_condition_inflow_outflow,
x_pos=boundary_condition_inflow_outflow,
Expand Down
28 changes: 24 additions & 4 deletions src/equations/compressible_euler_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -497,33 +497,53 @@ end
return cons
end

"""
initial_condition_double_mach_reflection(x, t, equations::CompressibleEulerEquations2D)
Compressible Euler setup for a double Mach reflection problem.
Involves strong shock interactions as well as steady / unsteady flow structures.
Also exercises special boundary conditions along the bottom of the domain that is a mixture of
Dirichlet and slip wall.
See Section IV c on the paper below for details.
- Paul Woodward and Phillip Colella (1984)
The Numerical Simulation of Two-Dimensional Fluid Flows with Strong Shocks.
[DOI: 10.1016/0021-9991(84)90142-6](https://doi.org/10.1016/0021-9991(84)90142-6)
"""
@inline function initial_condition_double_mach_reflection(x, t,
equations::CompressibleEulerEquations2D)
if x[1] < 1 / 6 + (x[2] + 20 * t) / sqrt(3)
phi = pi / 6
sin_phi, cos_phi = sincos(phi)

rho = 8
rho = 8.0
v1 = 8.25 * cos_phi
v2 = -8.25 * sin_phi
p = 116.5
else
rho = 1.4
v1 = 0
v2 = 0
p = 1
v1 = 0.0
v2 = 0.0
p = 1.0
end

prim = SVector(rho, v1, v2, p)
return prim2cons(prim, equations)
end

# Special mixed boundary condition type for the :Bottom of the domain.
# It is charachteristic when x < 1/6 and a slip wall when x >= 1/6
@inline function boundary_condition_mixed_dirichlet_wall(u_inner,
normal_direction::AbstractVector,
direction,
x, t, surface_flux_function,
equations::CompressibleEulerEquations2D)
# Note: Only for StructuredMesh
if x[1] < 1 / 6
# # From the BoundaryConditionDirichlet
# # get the external value of the solution
# u_boundary = initial_condition_double_mach_reflection(x, t, equations)

# From the BoundaryConditionCharacteristic
# get the external state of the solution
u_boundary = Trixi.characteristic_boundary_value_function(initial_condition_double_mach_reflection,
Expand Down
Loading

0 comments on commit 6f43419

Please sign in to comment.