From fddd75dd5b9d4baffacf397500f3c32583cfe3d6 Mon Sep 17 00:00:00 2001 From: Tristan Montoya Date: Sat, 30 Sep 2023 00:00:15 -0400 Subject: [PATCH] add kelvin-helmholtz --- src/ConservationLaws/ConservationLaws.jl | 2 +- src/ConservationLaws/euler_navierstokes.jl | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ConservationLaws/ConservationLaws.jl b/src/ConservationLaws/ConservationLaws.jl index eef35381..8d7d2d05 100644 --- a/src/ConservationLaws/ConservationLaws.jl +++ b/src/ConservationLaws/ConservationLaws.jl @@ -147,7 +147,7 @@ module ConservationLaws export InviscidBurgersEquation, ViscousBurgersEquation include("burgers.jl") - export EulerEquations, NavierStokesEquations, EulerPeriodicTest, TaylorGreenVortex, IsentropicVortex, TrixiIsentropicVortex + export EulerEquations, NavierStokesEquations, EulerPeriodicTest, TaylorGreenVortex, IsentropicVortex, KelvinHelmholtzInstability include("euler_navierstokes.jl") end \ No newline at end of file diff --git a/src/ConservationLaws/euler_navierstokes.jl b/src/ConservationLaws/euler_navierstokes.jl index 8e7cc046..17a7d16d 100644 --- a/src/ConservationLaws/euler_navierstokes.jl +++ b/src/ConservationLaws/euler_navierstokes.jl @@ -302,4 +302,22 @@ end v = -cos(x[1])*sin(x[2])*cos(x[3]) return SVector{5}(1.0, u, v, 0.0, p/(f.γ-1.0) + 0.5*ρ*(u^2 + v^2)) +end + +struct KelvinHelmholtzInstability <: AbstractGridFunction{2} + γ::Float64 + N_c::Int + function KelvinHelmholtzInstability(conservation_law::EulerEquations{2}) + return new(conservation_law.γ,4) +end + +@inline function evaluate(f::KelvinHelmholtzInstability, + x::NTuple{2,Float64}, t::Float64=0.0) + (x₁,x₂) = (x - 1, y - 1) + B = tanh(15*x₂ + 7.5) - tanh(15*x₂ - 7.5) + ρ = 0.5 + 0.75*B + p = 1.0 + u = 0.5*(B-1) + v = 0.1*sin(2π*x₁) + return SVector{4}(ρ,ρ*u,ρ*v,p/(f.γ-1) + 0.5*ρ*(u^2 + v^2)) end \ No newline at end of file