Lecture 24 2nd Order Partial Differential Equations...
Transcript of Lecture 24 2nd Order Partial Differential Equations...
Lecture 24 2nd Order Partial Differential Equations I
In this Lecture we discuss solutions of differential equations expressed as expansions in terms of the
appropriate functions we have learned about in the course. The specific choices of functions and
arguments correspond to the specific boundaries, and especially the boundaries with zero boundary
values. The coefficients in these expansions are then determined from fitting the non-zero boundary
conditions. While Mathematica has some facility for directly solving partial differential equations, the
most important application for us will be evaluating the integrals to find the coefficients and then making
plots of the resulting solutions - the desired distributions, typically in more than 1 dimension.
Consider first the 1-D case were Mathematica can easily do everything, including matching the bound-
ary conditions. For the example in the lecture we have
In[97]:= DSolve@ y''@xD � 0, y@xD, xDOut[97]= 88y@xD ® C@1D + x C@2D<<
and with boundary conditions
In[98]:= DSolve@8 y''@xD � 0, y@0D � c, y'@0D � 0<, y@xD, xDOut[98]= 88y@xD ® c<<
In[99]:= DSolve@ D@Y@x, yD, 8x, 2<D + D@Y@x, yD, 8y, 2<D � 0, Y@x, yD, 8x, y<DOut[99]= 88Y@x, yD ® C@1D@ä x + yD + C@2D@-ä x + yD<<
In this case Mathematica is telling us that we want solutions as functions of argument ±ä x +y, which is
true but not so useful. It is much easier to use the know expansions in Eq. (24.4) and use Mathematica
to find the coefficients. So consider the example starting on page 2 of the Lecture with a non-zero
boundary condition on the side y = Ly, which here we take to be the constant Y[x,Ly] = 100, with Lx = Ly
= 10.
In[100]:= Lx = 10; Ly = 10;
In[101]:= Y1@x_D := 100
In[102]:=
2
SinhA n Π Ly
LxE Lx
IntegrateBSinBn Π x
Lx
F Y1@xD, 8x, 0, Lx<F
Out[102]= -200 H-1 + Cos@n ΠDL Csch@n ΠD
n Π
In[103]:= a@n_D := -
200 H-1 + Cos@n ΠDL Csch@n ΠDn Π
Thus the (truncated) sum for the result distribution is
In[104]:= Y@x_, y_, m_D := SumBa@nD SinBn Π x
Lx
F SinhBn Π y
Ly
F, 8n, 1, m<F
In[105]:= Y@x, y, 10D
Out[105]=
400 Csch@ΠD SinA Π x
10E SinhA Π y
10E
Π
+
400 Csch@3 ΠD SinA 3 Π x
10E SinhB 3 Π y
10F
3 Π
+
80 Csch@5 ΠD SinA Π x
2E SinhA Π y
2E
Π
+
400 Csch@7 ΠD SinA 7 Π x
10E SinhA 7 Π y
10E
7 Π
+
400 Csch@9 ΠD SinA 9 Π x
10E SinhB 9 Π y
10F
9 Π
Now make a plot in 2-D - we'll use a contour plot
In[106]:= ContourPlot@Y@x, y, 10D, 8x, 0, Lx<, 8y, 0, Ly<, Contours ® Automatic,
ContourLabels ® Automatic, FrameLabel ® 8"x", "y"<, LabelStyle ® 8Large<D
Out[106]=
0 2 4 6 8 10
0
2
4
6
8
10
x
y
Clearly the function is near 100 at the top boundary and falls off into the interior, as expected. How-
ever, 10 terms is too few to get a smooth result. Try more terms and more contours
2 Lec24_228_09.nb
In[107]:= ContourPlot@Y@x, y, 100D, 8x, 0, Lx<, 8y, 0, Ly<,
Contours ® 8890<, 880<, 870<, 860<, 850<, 840<, 830<, 820<, 810<<,
ContourLabels ® Automatic, FrameLabel ® 8"x", "y"<, LabelStyle ® 8Large<D
Out[107]=
0 2 4 6 8 10
0
2
4
6
8
10
x
y
Note the expected symmetries.
Now consider a similar situation where we add a similar nonzero boundary condition on x = Lx, and
thus another sum of terms with x and y switched. Define
In[108]:=
2
SinhB n Π Ly
LyF Ly
IntegrateBSinBn Π y
Lx
F Y1@yD, 8y, 0, Ly<F
Out[108]= -200 H-1 + Cos@n ΠDL Csch@n ΠD
n Π
In[109]:= b@n_D := -
200 H-1 + Cos@n ΠDL Csch@n ΠDn Π
With a distribution
In[110]:= Y2@x_, y_, m_D :=
SumBa@nD SinBn Π x
Lx
F SinhBn Π y
Ly
F, 8n, 1, m<F + SumBb@nD SinhBn Π x
Lx
F SinBn Π y
Ly
F, 8n, 1, m<F
Lec24_228_09.nb 3
In[111]:= ContourPlot@Y2@x, y, 100D, 8x, 0, Lx<, 8y, 0, Ly<,
Contours ® 8890<, 880<, 870<, 860<, 850<, 840<, 830<, 820<, 810<<,
ContourLabels ® Automatic, FrameLabel ® 8"x", "y"<, LabelStyle ® 8Large<D
Out[111]=
0 2 4 6 8 10
0
2
4
6
8
10
x
y
A distribution that should be intuitively reasonable.
Next consider a similar situation but in cylindrical coordinates. The relevant functions are given in Eq.
(24.14). Here we will define a radius and temperature on the edge via
In[112]:= Ρ0 = 10; Y0@Φ_D := 100 Sin@ΦD;
The coefficients are
In[113]:=
1
Π
Integrate@Cos@n ΦD Y0@ΦD, 8Φ, 0, 2 Π<D
Out[113]= -200 Sin@n ΠD2
I-1 + n2M Π
In[114]:= a@n_D := -
200 Sin@n ΠD2
I-1 + n2M Π
i.e., really zero for all n and
In[115]:=
1
Π
Integrate@Sin@n ΦD Y0@ΦD, 8Φ, 0, 2 Π<D
Out[115]=
100 Sin@2 n ΠDI-1 + n2M Π
In[116]:= b@n_D :=
100 Sin@2 n ΠD
I-1 + n2M Π
4 Lec24_228_09.nb
In[117]:= b@1D
Power::infy : Infinite expression
1
0
encountered. �
Infinity::indet : Indeterminate expression 0 ComplexInfinity encountered. �
Out[117]= Indeterminate
So all zero except n = 1 but must be careful
In[118]:= Limit@b@nD, n ® 1DOut[118]= 100
In[119]:= Y3@Ρ_, Φ_D := 100Ρ
Ρ0
Sin@ΦD UnitStep@Ρ0 - ΡD
In[120]:= ContourPlotBY3B x2
+ y2
, ArcTan@x, yDF, 8x, -Ρ0, Ρ0<, 8y, -Ρ0, Ρ0<,
Contours ® 8880<, 860<, 840<, 820<, 80<, 8-20<, 8-40<, 8-60<, 8-80<<,
ContourLabels ® Automatic, FrameLabel ® 8"x", "y"<, LabelStyle ® 8Large<F
Out[120]=
-10 -5 0 5 10
-10
-5
0
5
10
x
y
Finally consider a 3-D rectangular situation as in the Lecture in side a cube of side 10.
In[121]:= Lx = 10; Ly = 10; Lz = 10;
Next assume all sides are at zero temperature except the side at z = 0 where Y2=100. The coefficients
are
Lec24_228_09.nb 5
In[122]:=
100
I Lx
2M I Ly
2M SinhBΠ Lz I m
LxM2
+ J n
LyN
2
F
IntegrateBSinBm Π x
Lx
F SinBn Π y
Ly
F, 8x, 0, Lx<, 8y, 0, Ly<F
Out[122]=
1600 CschB10m
2
100+
n2
100ΠF SinA m Π
2E2
SinA n Π
2E2
m n Π2
In[123]:= b@m_, n_D :=
1600 CschB10m2
100+
n2
100ΠF SinA m Π
2E2
SinA n Π
2E2
m n Π2
In[124]:= Clear@Y4D
In[125]:= Y4@x_, y_, z_, M_D := SumB
b@m, nD SinBm Π x
Lx
F SinBn Π y
Ly
F SinhBΠ HLz - zL Km
Lx
O2
+
n
Ly
2
F, 8m, 1, M<, 8n, 1, M<F
In[126]:= Y4@x_, y_, z_D := Y4@x, y, z, 10D
In[127]:= ContourPlot3D@Y4@x, y, zD == 50, 8x, 0, Lx<,
8y, 0, Ly<, 8z, 0, Lz<, LabelStyle ® 8Large<DOut[127]= $Aborted
ContourPlot3D@Y4@x, y, zD, 8x, 0, Lx<,
8y, 0, Ly<, 8z, 0, Lz<, Contours ® 2, LabelStyle ® 8Large<D$Aborted
6 Lec24_228_09.nb