-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab648aa
commit 29ecc51
Showing
6 changed files
with
224 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ authors = ["Alex Fleming <[email protected]> and contributors"] | |
version = "1.0.0-DEV" | ||
|
||
[deps] | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab" | ||
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
module ShockwaveProperties | ||
|
||
export DRY_AIR | ||
export BilligShockParametrization | ||
export shock_density_ratio, shock_pressure_ratio, shock_temperature_ratio | ||
export conserved_state_behind | ||
|
||
include("cpg.jl") | ||
include("billig.jl") | ||
include("normal_shocks.jl") | ||
|
||
const DRY_AIR = CaloricallyPerfectGas(1.0049, 0.7178, 0.0289647) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,78 @@ | ||
module BilligShock | ||
|
||
end | ||
""" | ||
Implementation of the shockwave parametrization about cylindrical blunt bodies developed by Billig in | ||
*Shock-wave shapes around spherical-and cylindrical-nosed bodies.* | ||
""" | ||
module BilligShockParametrization | ||
using LinearAlgebra | ||
|
||
export shock_front, shock_normal, shock_tangent | ||
|
||
const BILLIG_CONSTANTS = (A=0.386, B=4.67, C=1.386, D=1.8) | ||
|
||
# compute standoff distance relative to a disk of radius 1 in the plane | ||
@inline function standoff_distance(M_inf) | ||
return BILLIG_CONSTANTS.A * exp(BILLIG_CONSTANTS.B / M_inf^2) | ||
end | ||
|
||
# compute critical radius relative to a disk of radius 1 in the plane | ||
@inline function critical_radius(M_inf) | ||
return BILLIG_CONSTANTS.C * exp(BILLIG_CONSTANTS.D / (M_inf - 1)^0.75) | ||
end | ||
|
||
# compute sine and cosine of the critical angle | ||
# formed between the x-axis and the tangent to the shock front at x=0 | ||
@inline function critical_shock_angle(M_inf) | ||
sinθ = 1 / M_inf | ||
cosθ = sqrt(1 - sinθ^2) | ||
return (sinθ, cosθ) | ||
end | ||
|
||
""" | ||
shock_front(α, M_inf, R_b) | ||
Maps a parameter ``α`` to the shock wave generated about a body with radius ``R_b`` | ||
by free-stream flow to the right with mach number ``M_infty``. | ||
The shock wave parametrization developed by *Billig* parametrizes the shock wave on the y-coordinate. | ||
""" | ||
function shock_front(α, M_inf, R_b) | ||
y̅ = α / R_b | ||
Δ = standoff_distance(M_inf) | ||
R̅c = critical_radius(M_inf) | ||
sinθ, cosθ = critical_shock_angle(M_inf) | ||
cotθ = (cosθ / sinθ) | ||
tanθ = (sinθ / cosθ) | ||
return [R_b * (-1 - Δ + R̅c * cotθ^2 * (sqrt(1 + (y̅ * tanθ / R̅c)^2) - 1)), α] | ||
end | ||
|
||
# we'll manually take derivatives here... Zygote doesn't like 2nd derivatives. | ||
# we can also optimize out cot^2 * tan^2 ;) | ||
|
||
""" | ||
shock_normal(α, M_inf, R_b) | ||
Maps a parameter ``α`` to the outward-facing normal to a shock wave generated about a body with radius ``R_b`` | ||
by a free-stream flow to the right with nach number ``M_infty`` | ||
The shock wave parametrization developed by *Billig* parametrizes the shock wave on the y-coordinate. | ||
""" | ||
function shock_normal(α, M_inf, R_b) | ||
R_c = R_b * critical_radius(M_inf) | ||
sinθ, cosθ = critical_shock_angle(M_inf) | ||
tanθ = (sinθ / cosθ) | ||
dxdα = α / (R_c * sqrt(1 + (α * tanθ / R_c)^2)) | ||
n = [-1, dxdα] | ||
return n ./ norm(n) | ||
end | ||
|
||
""" | ||
shock_normal(α, M_inf, R_b) | ||
Maps a parameter ``α`` to the tangent to a shock wave generated about a body with radius ``R_b`` | ||
by a free-stream flow to the right with nach number ``M_infty`` | ||
The shock wave parametrization developed by *Billig* parametrizes the shock wave on the y-coordinate. | ||
""" | ||
function shock_tangent(α, M_inf, R_b) | ||
n = shock_normal(α, M_inf, R_b) | ||
return [n[2], 1] | ||
end | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
using LinearAlgebra | ||
using ShockwaveProperties | ||
using Test | ||
|
||
@testset "ShockwaveProperties.jl" begin | ||
# Write your tests here. | ||
end | ||
@testset "BilligShockParametrization" begin | ||
using .BilligShockParametrization | ||
@testset "Shockwave Normals" begin | ||
y = -10:0.1:10 | ||
for R_b ∈ 1.0:0.25:4.0, M ∈ 1.5:0.5:5.0 | ||
vals = mapreduce(hcat, y) do α | ||
shock_normal(α, M, R_b) ⋅ shock_tangent(α, M, R_b) | ||
end | ||
@test all(≈(0), vals) | ||
end | ||
end | ||
end | ||
end |