Skip to content

Commit

Permalink
add option to specify initial baseflow density in Kelvin-Helmholtz
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanmontoya committed Oct 23, 2023
1 parent 1a5893d commit 1c61451
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ConservationLaws/euler_navierstokes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,21 @@ Domain should be [0,2]²
"""
struct KelvinHelmholtzInstability <: AbstractGridFunction{2}
γ::Float64
ρ_0::Float64
N_c::Int
function KelvinHelmholtzInstability(conservation_law::EulerEquations{2})
return new(conservation_law.γ,4)
function KelvinHelmholtzInstability(conservation_law::EulerEquations{2},
ρ_0::Float64=0.5)
return new(conservation_law.γ,ρ_0,4)
end
end

@inline function evaluate(f::KelvinHelmholtzInstability,
x::NTuple{2,Float64}, t::Float64=0.0)
x_rel = (x[1]-1, x[2]-1)
B = tanh(15*x_rel[2] + 7.5) - tanh(15*x_rel[2] - 7.5)
ρ = 0.5 + 0.75*B
ρ = f.ρ_0 + 0.75*B
p = 1.0
u = 0.5*(B-1)
u = 0.5*(B-1)
v = 0.1*sin(2π*x_rel[1])
return SVector{4}(ρ,ρ*u,ρ*v,p/(f.γ-1) + 0.5*ρ*(u^2 + v^2))
end

0 comments on commit 1c61451

Please sign in to comment.