Figure 1: Bessel functions J cylinder eigenvalues k

advertisement
1
m=0
m=1
m=2
m=3
Jm(k)
0.5
0
−0.5
0
2
4
6
8
10
12
14
16
18
20
k
Figure 1: Bessel functions Jm (k) for m = 0, 1, 2, 3. The nonzero roots k give the −∇2 cylinder
eigenvalues k 2 . The smallest three roots are shown as dots, and are the first roots of m = 0, 1, 2
respectively.
18.303 Problem Set 4 Solutions
Problem 1: (10+5)
(a) Since Dx and Dy both act on the same column vector u of the M N unknowns um,n , they
must
have
the same number (M N ) of columns. Therefore, we can form a new matrix D =
Dx
out of Dx and Dy , from which it follows that DT = DxT DyT
and DT D =
Dy
DxT Dx + DyT Dy = Ax + Ay = A.
(b) Using the given commands to form Dx and Dy, D is then formed by D=[Dx;Dy] ... the command
A-D’*D then yields “All zero sparse: 100-by-100”, indicating that the matrices are the same.
Problem 2: (10+(5+5)+10)
(a) The eigenvalues of −∇2 are k 2 , where k is a root of Jm (kR). These functions are plotted in figure 1 for m = 0, 1, 2, 3 via the fplot command, and one can clearly see that
the smallest (nonzero) three roots are the first roots of m = 0, 1, 2. Using the command
fzero(@(k) besselj(m,k), kinit) for m = 0, 1, 2 with initial guesses kinit of 2.5, 4, 5
from the plot, these roots are found to be k0 ≈ 2.40482555769577, k1 ≈ 3.83170597020751,
and k2 ≈ 5.13562230184068. The corresponding eigenvalues k 2 are ≈ 5.7832, 14.6820, 26.3746.
Note that some of these eigenvalues are actually repeated. Recall that the eigenfunctions
are Jm (kr)[α sin(mθ) + β cos(mθ)]. For any m 6= 0, there are two independent solutions:
cosine and sine. For m = 0, the sine solution disappears so there is only one solution. So, the
first five eigenvalues should actually be 5.7832, 14.6820, 14.6820, 26.3746, 26.3746.
(b) Comparing the eigenvalues and eigenvectors for the 50 × 50 finite-difference (FD) grid, we
find:
(i) The FD eigenvalues are 5.8676, 14.8831, 14.8831, 26.6500, and 26.7611. These have
roughly the same magnitudes and repetition pattern as what we expected from (a). (Note
that the last two eigenvalues are not exactly equal: this is because the grid breaks the
rotational symmetry.) Quantitatively, computing the fractional error compared to the
exact values, the errors are roughly 1.46%, 1.37%, 1.37%, 1.04%, and 1.47%, respectively.
(ii) The eigenfunctions are plotted (as 2d color plots with pcolor) in figure 2, with a
blue/white/red color scale for negative/zero/positive values. Both the radial and an1
Figure 2: The first five eigenfunctions of −∇2 in the cylinder, with blue/white/red indicating
negative/zero/positive values. They are labelled as m = 0, 1, 2 eigenfunctions since the sign patterns
clearly show cos(mθ) (or sine) dependence.
gular dependence qualitatively matches what we expect from the analytical solution.
Since k was the first nonzero root, we expect Jm (kr) to have roots only at r = R, and at
r = 0 for m > 0, and indeed the radial dependence shows that there is only one radial
oscillation starting from the origin, with a node at r = 0 for m > 0. Angularly, we expect
the first solution to be m = 0, which is rotationally invariant, the next two solutions
to be m = 1, which have one sign oscillation in the angular direction corresponding to
cos(θ) and sin(θ) solutions (90 degrees out of phase), and the next two solutions to be
m = 2, which have two sign oscillations in the angular direction corresponding to cos(2θ)
and sin(2θ) (45 degrees out of phase). This is exactly what we observe in figure 2.
(c) The errors in the first five eigenvalues are plotted versus N in figure 3, along with a line
∼ ∆x for reference. All five eigenvalues have errors that clearly scale roughly with ∼ ∆x,
not with ∼ ∆x2 . The reason is because our computational domain does not exactly conform
to a cylinder: it is a cylinder approximated by a rectangular grid, which necessarily makes
a jagged (“stairstepped”) approximation of the curved cylinder boundary. Hence, the u = 0
boundary points in the FD grid are only within ∼ ∆x of the “true” boundary location, which
means the boundary condition is imposed at the wrong points by ∼ ∆x, which induces a
first-order error like in pset 3.
Problem 3: (10+(5+10)+10)
This question involves mathematical equations similar to those of problem 2, but asks some physical
questions if we interpret u(x, y) as the vertical displacement of a stretched surface on a circular
drum of radius R. This displacement satisfies the 2d wave equation ∇2 u = c12 ∂ 2 u/∂t2 (this is
derived from F = ma where ∂ 2 u/∂t2 is acceleration) where c is a constant (the “wave speed” as we
will see later in the semester) that depends on the tension and density; here, say c = 200 m/s. If
the edges of the drum are held flat, then the boundary condition is the Dirichlet u|r=R = 0.
2
0
10
λ5
λ4
λ2,3
λ1
−1
|error| in λ
10
∆x
−2
10
−3
10
1
2
10
10
3
10
resolution N
Figure 3: Absolute errors in the first five eigenvalues of −∇2 in a cylinder, computed by an N × N
finite-difference grid, compared to the semi-analytical solutions. For reference, a line ∆x ∼ 1/N is
also plotted, showing that the eigenvalues are clearly converging ∼ ∆x (not ∼ ∆x2 ).
(a) Recall from class that the solutions of the wave equation c2 ∇2 u = ü can be written √as a
superposition of eigenfunctions un (x, y) multiplied by sine or cosine of ωt, where ω = −λ
from the eigenvalue λ of c2 ∇2 : these are the oscillating “normal modes” of the drum. (The
only difference from class is that we are multiplying the operator, and hence multiplying the
eigenvalues, by c2 .) When you bang on it, the initial condition will excite some superposition
of these, of which the lowest-frequency component will correspond to the smallest |λ|. The
smallest |λ| of ∇2 , from class (and problem 2), is just k 2 where k is the first root of J0 (kR);
2 2
2
2
from problem 2, this is kR ≈ 2.4048. Hence, the smallest
√ |λ| of c ∇ is ≈ c (2.4048/R) ,
and hence the corresponding frequency is 2πf = ω = λ = c(2.4048/R), and hence R ≈
2.4048c/(2πf ) ≈ 0.7655 m (a pretty big drum).
(b) Setting R = 1 again, suppose that your drum surface is at rest, but that you have twisted the
edges so that the drum edges are at a height x2 y 2 = R cos2 (θ) sin2 (θ) (for simplicity, assume
they are still at a radius R).
(i) Since the drum surface is at rest, ∂ 2 u/∂t2 = 0 and hence u satisfies ∇2 u = 0 (Laplace’s
equation). The boundary conditions are no longer u = 0, however, but rather at the
edge of the drum the height is u|r=R = R cos2 (θ) sin2 (θ) = x2 y 2 (general Dirichlet
boundaries).
(ii) As in problem set 1 and in class, we can handle general boundary conditions u|dΩ = g(x)
by defining a new function u0 = u − g, so that u0 |dΩ = 0 (ordinary Dirichlet boundaries),
and ∇2 u = 0 implies −∇2 u0 = ∇2 g. Here, g = x2 y 2 , so ∇2 g = 2x2 + 2y 2 . Now we can
use the delsq function in Matlab, which only works with Dirichlet boundaries.
To approximate −∇2 on the cylinder, we can use exactly the same Matlab instructions as in problem 2 to make a matrix A, freely choosing units of distance where R = 1
(i.e. measuring distance in units of R). We will now solve Au0 = b for u0 . Following
the hint, we form the right-hand side b (∇2 g) by the commands b2=2*(x2.^2+y2.^2);
b=b2(G>0); and solve with u0=A\b; to obtain u0 . Given the vector g in the hint (representing the function g), the solution vector u is then simply u=u0+g. To plot, we use,
similar to above, U=G; U(G>0)=u(G(G>0)); surf(U); we also plot u0 = u − g in the
same way (with u0 instead of u), and the result is shown in figure 4. As expected,
u(x, y) meets x2 y 2 on the boundaries, while u0 (x, y) is zero on the boundaries.
(c) The results are plotted in figure 5. Looking at the plot, the figures resemble someone pushing up at “one point” on the stretched drum surface, and this is in fact precisely what they
3
u0(x,y) = u(x,y) − x2 y2
u(x,y)
0.35
0.14
0.3
0.12
0.25
0.1
0.2
0.08
0.15
0.06
0.1
0.04
0.05
0.02
0
0
60
60
60
40
60
40
40
20
40
20
20
0
20
0
0
0
Figure 4: Left: Solution u(x, y) for the shape of a stretched circular drum at rest, with the boundaries held at height x2 y 2 . Right: u0 (x, y) = u(x, y) − x2 y 2 , showing that the boundary condition is
indeed satisfied (u0 = 0 at the boundaries).
inverse at shifted point
inverse at center point
−3
−3
x 10
x 10
6
6
4
4
2
2
30
30
0
30
0
30
20
20
20
20
10
10
10
10
0 0
0 0
Figure 5: Columns of the inverse finite-difference Laplacian matrix A−1 ≈ (−∇2 )−1 on the cylinder.
Left: A−1 column corresponding to a point in the center of the cylinder. Right: corresponding to
a point shifted halfway to one side.
4
represent.
Each column ck of the inverse matrix A−1 solves Ack = ek , where ek is a unit vector in
the k-th direction (the k-th column of the identity matrix). On the grid, a unit vector ek corresponds to one grid point that is nonzero, the rest being zero—it only remains to show thath
this right-hand-side can be interpreted as a force, and then this will be a force at one grid point
as suggested above. It was given in the problem that the wave equation c2 ∇2 u = ∂ 2 u/∂t2
came from F = ma where ∂ 2 u/∂t2 is acceleration—the ∇2 u term is therefore proportional to
the force from the drum tension. If we add an external force (per unit area) f (x, y), therefore,
the equation would look like #f + c2 ∇2 u = ü for some proportionality constant # (that is,
adding the external force to the tension force on the left-hand side). If the drum is at rest
(ü = 0), then we obtain −∇2 u = c#2 f (x, y): the right-hand side of this equation is proportional to the force at each point. This is exactly the equation A−1 solves, since A ≈ −∇2 , so
each column ck of A−1 is proportional to the solution u in response to a force ∼ ek (i.e. at
one grid point) when the drum is at rest.
5
Download