/
circle.jl
42 lines (34 loc) · 1.65 KB
/
circle.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
AcousticCircleParticle{T} = Particle{2,Acoustic{T,2},Sphere{T,2}}
"""
t_matrix(Particle{2,Acoustic{T,2},Sphere{T,2}}, Acoustic{T,2}, ω, order)
The T-matrix for a 2D circlular acoustic particle in a 2D acoustic medium.
"""
function t_matrix(p::Particle{2,Acoustic{T,2},Sphere{T,2}}, outer_medium::Acoustic{T,2}, ω::T, basis_order::Integer)::Diagonal{Complex{T}} where T <: AbstractFloat
# Check for material properties that don't make sense or haven't been implemented
check_material(p, outer_medium)
"Returns a ratio used in multiple scattering which reflects the material properties of the particles"
function Zn(m::Integer)::Complex{T}
m = T(abs(m))
ak = outer_radius(p)*ω/outer_medium.c
# set the scattering strength and type
if isinf(p.medium.c) || isinf(p.medium.ρ)
numer = diffbesselj(m, ak)
denom = diffhankelh1(m, ak)
elseif iszero(outer_medium.ρ)
numer = diffbesselj(m, ak)
denom = diffhankelh1(m, ak)
elseif iszero(p.medium.ρ) || iszero(p.medium.c)
numer = besselj(m, ak)
denom = hankelh1(m, ak)
else
q = impedance(p.medium)/impedance(outer_medium) # Impedance ratio
γ = outer_medium.c/p.medium.c #speed ratio
numer = q * diffbesselj(m, ak) * besselj(m, γ * ak) - besselj(m, ak)*diffbesselj(m, γ * ak)
denom = q * diffhankelh1(m, ak) * besselj(m, γ * ak) - hankelh1(m, ak)*diffbesselj(m, γ * ak)
end
return numer / denom
end
# Get Zns for positive m
Zns = map(Zn,0:basis_order)
return - Diagonal(vcat(reverse(Zns), Zns[2:end]))
end