1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """ Waveguides.py - Definition of waveguides for use with the multimodal
23 wave propagation solver.
24
25 """
26
27 import math
28 import numpy
29 from numpy import sin, cos, cosh, arcsin, sqrt, real, imag, pi, log10
30
34
37
38
41
43 " to be defined be derived class "
44 pass
45
47 " to be defined by derived class "
48
50 " return the area of the axisymmetric duct from free end to source "
51 self.assertZ(z)
52 return numpy.pi * self.radius(z)**2
53
57
61
62 -class Cone(WaveguideProfile):
64 self.a0 = d0/2
65 self.ae = de/2
66 self.L = L
68 self.assertZ(z)
69 return self.ae + (self.a0-self.ae)*z/self.L
70
72 self.assertZ(z)
73 return (self.a0-self.ae)/self.L
74
77 self.a = d/2
78 self.L = L
80 self.assertZ(z)
81 return self.a
82
86
88 - def __init__(self,d0,de,theta1=0.,theta2=numpy.pi/2.):
89 """
90 d1: input diameter of the horn
91 d2: output diameter of the horn
92 theta1: input angle of the horn (radians)
93 theta2: output angle of the horn (radians)
94
95 a: input radius of the horn
96 r: radius of the quarter circle
97 """
98 self.d0 = d0
99 self.de = de
100 self.theta1 = theta1
101 self.theta2 = theta2
102
103 self.a0 = d0/2.
104 self.r_horn = (de-d0) / (2. * (cos(theta1)-cos(theta2)))
105 self.L = self.r_horn * (sin(theta2)-sin(theta1))
106
107
108
109 self.ze = self.r_horn * sin(theta2)
110 self.y0 = self.r_horn * cos(theta1)
111
113 return "QuarterCircleHorn(d0=%.4f,de=%.4f,theta1=%.2f,theta2=%.2f)"%\
114 (self.d0,self.de,self.theta1,self.theta2)
116 self.assertZ(z)
117 theta = arcsin( (self.ze - z) / self.r_horn)
118 return self.a0 + self.y0 - self.r_horn * cos(theta)
119
121 """ derivative of the radius along z
122 the 0.000001 value was added to avoid infinite derivatives
123 """
124 self.assertZ(z)
125 arg = (self.ze - z) / self.r_horn
126 theta = arcsin( arg )
127 if (1. - arg) < 1e-15:
128 arg = 1. - 1.e-15
129 dtheta = -1. / (self.r_horn * sqrt(1.-arg**2))
130 return self.r_horn * sin(theta) * dtheta
131
134 self.L = L
135 self.alpha = alpha
136 self.B = 10**(log10(L) - log10(d1**-1-d2**-1))
137 self.z0 = 10**( alpha**-1 * log10(self.B/d2) )
138
140 return 0.5 * self.B / (self.L - z + self.z0)**self.alpha
141
143 return 0.5 * self.B * self.alpha / \
144 (self.L - z + self.z0)**(self.alpha+1.)
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159