The Heat Equation for a Square Plate - Michael...

13
The Heat Equation for a Square Plate Let u(x, y, t) be the temperature at (x, y) at time t. The two dimensional heat equation in rectangular coordinates is α 2 (u xx + u yy )= u t . For simplicity we will set α = 1 and work on the 1 × 1 square with corners (0,0), (1,0), (1,1), (0,1). Suppose u(x, y, t)= X (x)Y (y)T (t). Then the heat equation becomes X ′′ YT + XY ′′ T = XYT . Divide through by XYT to get X ′′ Y + XY ′′ XY = T T Since the left does not change with t, both sides are equal to some constant; call it -σ. Now we have T + σT =0 & X ′′ Y + XY ′′ XY = -σ. The equation in T we know how to deal with. For the equation in X and Y we have X ′′ X = -σ - Y ′′ Y . Since one side depends only on x and the other only on y, both must be a constant; call it -β. Now we have X ′′ + βX =0 & Y ′′ +(σ - β)Y =0. The equation in X will only have nontrivial solutions if β = n 2 π 2 for some integer n> 0. You can show that X (x) can then be any multiple of sin(nπx). We let X n (x) = sin(nπx). The equation in Y will only have nontrivial solutions if σ - β = m 2 π 2 for some integer m> 0. Thus σ =(n 2 + m 2 )π 2 . We let Y m (y) = sin(mπy), T m,n (t)= e (m 2 +n 2 )π 2 t , and u m,n (x, y, t)= X n (x)Y m (y)T m,n (t). Then u m,n satisfies the heat equation and the boundary condition for any integers n> 0, m> 0 as would any linear combination. Now, the theory of Fourier series can be extended to functions of two variables. If f (x, y) is odd in both variables and periodic with period 2L is each variable then the series n=1 m=1 c m,n sin nπx L sin mπy L where c m,n = 4 L L 0 L 0 sin nπx L sin mπy L f (x, y) dx dy converges, almost everywhere, to f (x, y). [See Fourier Series and Boundary Value Problems by Brown and Churchill.] Thus, if we are given u(x, y, 0) = f (x, y) we just use the above formulas for the c m,n . Then u(x, y, t)= n=1 m=1 c m,n sin(nπx) sin(mπy)e (m 2 +n 2 )π 2 t . 1

Transcript of The Heat Equation for a Square Plate - Michael...

  • The Heat Equation for a Square Plate

    Let u(x, y, t) be the temperature at (x, y) at time t. The two dimensional heat equation inrectangular coordinates is

    2(uxx + uyy) = ut.

    For simplicity we will set = 1 and work on the 1 1 square with corners (0,0), (1,0), (1,1), (0,1).Suppose u(x, y, t) = X(x)Y (y)T (t). Then the heat equation becomes

    X Y T + XY T = XY T .

    Divide through by XY T to getX Y + XY

    XY=

    T

    TSince the left does not change with t, both sides are equal to some constant; call it . Now wehave

    T + T = 0 &X Y + XY

    XY= .

    The equation in T we know how to deal with. For the equation in X and Y we have

    X

    X=

    Y

    Y.

    Since one side depends only on x and the other only on y, both must be a constant; call it . Nowwe have

    X + X = 0 & Y + ( )Y = 0.

    The equation in X will only have nontrivial solutions if = n22 for some integer n > 0. You canshow that X(x) can then be any multiple of sin(nx). We let

    Xn(x) = sin(nx).

    The equation in Y will only have nontrivial solutions if = m22 for some integer m > 0. Thus = (n2 + m2)2. We let

    Ym(y) = sin(my),

    Tm,n(t) = e(m2+n2)2t,

    andum,n(x, y, t) = Xn(x)Ym(y)Tm,n(t).

    Then um,n satisfies the heat equation and the boundary condition for any integers n > 0, m > 0 aswould any linear combination.

    Now, the theory of Fourier series can be extended to functions of two variables. If f(x, y) is oddin both variables and periodic with period 2L is each variable then the series

    n=1

    m=1

    cm,n sin(nx

    L

    )

    sin(my

    L

    )

    where

    cm,n =4

    L

    L

    0

    L

    0

    sin(nx

    L

    )

    sin(my

    L

    )

    f(x, y) dx dy

    converges, almost everywhere, to f(x, y). [See Fourier Series and Boundary Value Problems byBrown and Churchill.]

    Thus, if we are given u(x, y, 0) = f(x, y) we just use the above formulas for the cm,n. Then

    u(x, y, t) =

    n=1

    m=1

    cm,n sin(nx) sin(my)e(m2+n2)2t.

    1

  • Example

    Suppose u(x, y, 0) = f(x, y) = (x 0.5)2 + (y 0.5)2. Then we can compute the cm,ns andanimate the result by the commands below.

    > c := (m,n) -> 4*int(int(sin(n*Pi*x) * sin(m*Pi*y) *

    ((x-0.5)^2 + (y-0.5)^2),x=0..1),y=0..1);

    > animate(plot3d ,[sum(sum(c(m,n)*sin(n*Pi*x)*sin(m*Pi*y)*

    exp(-(m^2+n^2)*t),m=1..10),n=1..10),x=0..1,y=0..1],t=0..0.3,frames=100);

    t=0.0 t=0.01

    t=0.05 t=0.1

    See the course website to view the animation.

    2

  • Discussion of Heat Equation on a Metal Disk

    We consider a metal disk of radius 1 with temperature held to 0 degrees around the circumference.The initial temperature is given by f(r, ). Let u(r, , t) be the temperature at (r, ) at time t. Thus,

    u(1, , t) = 0 & u(r, , 0) = f(r, ).

    Now, the heat equation in rectangular coordinates in

    2(uxx + uyy) = ut.

    Our first task is to translate this into polar coordinates. Ill show one of the steps involved and thengive the final result. The main tool is the multivariable chain rule.

    u(r, , t)

    x=

    u

    r

    r

    x+

    u

    x+

    u

    t

    t

    x.

    Since t is independent of x we know xt = 0, so we can drop the last term. For polar coordinateswe know

    r =

    x2 + y2 & = arctan(y/x).

    Thereforer

    x=

    2x

    2

    x2 + y2=

    r cos

    r= cos ,

    and

    x=

    1

    1 + (y/x)2

    (y

    x

    )

    =1

    1 + (y/x)2y

    x2=

    y

    x2 + y2=

    sin

    r.

    Hence,

    ux = ur cos 1

    ru sin .

    One repeats this to get uxx and similarly for uyy. After simplifying the result is

    2(urr +1

    rur +

    1

    r2u) = ut.

    3

  • Now we try to find solutions. As before we suppose u(r, , t) = R(r)()T (t). Plugging into theheat equation gives.

    2(

    RT +1

    rRT +

    1

    r2RT

    )

    = RT .

    Divide through by 2RT to get

    R

    R+

    1

    r

    R

    R+

    1

    r2

    =

    1

    2T

    T.

    Since the right side depends only on t and the left side is independent of t, both sides are constant;call it . We get

    r2R

    R+ r

    R

    R+ r2 =

    & T + 2T = 0

    Thus, there is a constant such that

    r2R

    R+ r

    R

    R+ r2 =

    = .

    Thus we getr2R + rR + (r2 )R = 0 & + = 0.

    Thus, we have there separate ODEs.We shall make a simplifying assumption, that we will hopefully drop later. But for now assume

    u(r, , t) is independent of . This means = 0 and hence so does . Thus () = 0 So, unlessthe temperature is always zero, will require = 0. The R equation becomes

    r2R + rR + r2R = 0.

    Let 2 = and p = r. Also define P (p) = R(p/) = R(r). Then

    rdR

    dr=

    p

    dR(p)

    dr=

    p

    dP

    dp

    dp

    dr= pP (p).

    Similarly, r2R(r) = p2P (p). Thus our equation for R becomes

    p2P + pP + p2P = 0.

    This is Bessels Equation of Order Zero. It is solved in Section 5.7. The general solution is

    P (p) = C1J0(p) + C2Y0(p).

    Switching back to R and r we get

    R(r) = C1J0(r) + C2Y0(r).

    The functions J0 and Y0 are called Bessel functions of the first and second kind, respectively, bothof order zero. They are determined by certain power series.

    4

  • Bessels Equations

    Below are graphs of J0(x) and Y0(x).

    6420 8

    1

    0.8

    0.6

    0.4

    0.2

    0

    -0.2

    -0.4

    x

    10

    Jo

    6

    -1

    4

    0.5

    -0.5

    2

    -1.5

    0

    -3

    x

    80

    -2

    -2.5

    10

    Yo

    Next we consider the boundary conditions. First, u(1, , 0) = 0 implies R(1) = 0. But this is asecond boundary condition that is implicit: the temperature is bounded. In particular |u(0, , t)| evalf(BesselJZeros(0,1..20));

    2.404825558, 5.520078110, 8.653727913, 11.79153444, 14.93091771,

    18.07106397, 21.21163663, 24.35247153, 27.49347913, 30.63460647,

    33.77582021, 36.91709835, 40.05842576, 43.19979171, 46.34118837,

    49.48260990, 52.62405184, 55.76551076, 58.90698393, 62.04846919

    Then we letRn(r) = J0(nr).

    Each Rn(r) satisfies the boundary conditions. Let

    Tn(t) = e2

    n2t & un(r, t) = Xn(r)Tn(t).

    Then each un satisfies the heat equation and the boundary conditions and so too would anylinear combination. (We dropped since we are still assuming u is independent of .) It can beshown that this holds for

    u(r, t) =

    n=1

    cnJ0(nr)e2

    n2t

    if the cns are such that the series convergences. Thus if we can find cns such that

    n=1

    cnJ0(nr) = u(r, 0) = f(r)

    we are done! It looks almost like the Fourier expansion with J0(nr) in stead of sin(nr) or cos(nr).In fact, Section 11.4 shows that this can be done and gives a formula for cn.

    cn =

    1

    0rf(r)J0(nr) dr

    1

    0 rJ20 (nr) dr

    .

    5

  • Example

    Suppose f(r) = 1 r2. We approximate f(r) with a series of Bessel functions. Then we plot afew partial sums to see how good the approximation is. We define f(r), g(n) is n and c(n) is cm.

    > f := r -> 1-r^2;

    > g := n -> evalf(BesselJZeros(0,n)); # g(n) is n-th zero of Bessel function Jo.

    > c := n -> (int(r*f(r)*BesselJ(0,g(n)*r) ,r=0..1))/(int(r*BesselJ(0,g(n)*r)^2 ,r=0..1));

    > N:=1:

    > plot([sum(c(n)*BesselJ(0,g(n)*r),n=1..N),1-r^2 ] ,r=0..1,

    thickness=2,color=[red,blue]);

    0.60.4

    0.6

    0.20

    1

    0.4

    r

    1

    0.2

    0.8

    0.8

    0

    We repeat for N = 2, 3, &5.

    0.60.4

    0.8

    0.2

    r

    0

    1

    1

    0.4

    0

    0.2

    0.8

    0.6

    0.60.4

    0.8

    0.2

    r

    0

    1

    1

    0.4

    0

    0.2

    0.8

    0.6

    0.60.4

    0.8

    0.2

    r

    0

    1

    1

    0.4

    0

    0.2

    0.8

    0.6

    Looks good! But lets plot the graph out to r = 5; N is still 5.

    32

    -20

    10

    r

    -15

    40

    -10

    5

    -5

    6

  • Yikes! Fortunately, we only care about r [0, 1]. Next we compute u(r, t) and plot it for severalvalues of t. I used N = 10 and then did plots for t = 0.01, 0.02, 0.1, 0.2, 0.3&1.0. Only the commandfor t = 0.01 is shown.

    > N:=10:t:=0.01:

    > plot(sum(c(n)*BesselJ(0,g(n)*r)*exp(-g(n)^2*t),n=1..N) ,r=0..1,

    thickness=2,color=red,view=0..1);

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    0.20

    r

    1

    1

    0.8

    0.8

    0.6

    0.6

    0.4

    0.40

    0.2

    Extra Credit

    Suppose f(r) = r(1 r2). The temperature at the origin starts at 0 and in the limit as t it will tend towards 0. What is the maximum temperature of the origin and when will it occur?Approximate as best you can.

    7

  • Example

    Suppose = 1 and f(r) = r(1 r2) sin(3)2. Here is a graph.

    > plot3d(sqrt(x^2+y^2)*(1-x^2-y^2)*sin(3*arctan(y,x))^2, x=-1..1,y=-1..1,

    view=0..0.5,color=sqrt(x^2+y^2)*(1-x^2-y^2)*sin(3*arctan(y,x))^2,numpoints=10000);

    We revisit the separated equations.

    r2R + rR + (r2 )R = 0 + = 0

    T + T = 0

    The implied boundary condition on is just (0) = (2). For < 0 only the trivial solutionis periodic. For = 0, any constant solution will do. For > 0 the general solution is

    () = C1 sin

    + C2 cos

    .

    Therefore, = n2 for n > 0. Thus, using any linear combination of 1, sinn, and cosn will do. Let

    0() = C0 & n() = an sinn + bn cosn,

    for n = 1, 2, 3, ..... Then for each n = 0, 1, 2, 3... we have that n() solves + n2 = 0 and

    Thetan(0) = Thetan(2).Let 2 = , > 0, and consider

    r2R + rR + (2r2 n2)R = 0.

    The change of variable p = r transforms this to

    p2P pP + (p2 n2)P = 0.

    8

  • This is Bessels equation of order n. It is general solution takes the form

    P (p) = C1Jn(p) + C2Yn(p).

    This is equivalent toR(r) = C1Jn(r) + C2Yn(r).

    Here Jn is Bessels function of the first kind of order n, and Yn is Bessels function of the secondkind of order n, as you might have guessed. They are defined have certain power series (see Section). Again, Yn is unbounded at 0 and so C2 = 0. Again Jn has infinitely many zeros. We denote themby n,m, m = 1, 2, 3, .... Their numerical values can be found in tables or via a computer. For eachn = 0, 1, 2, 3... and m = 1, 2, 3... let

    Rn,m(r) = Jn(n,mr).

    Then Rn,m(1) = 0 and Rn,m(r) solves r2R + rR + (2n,mr

    2 n2)R = 0.Define

    Tn,m = e2

    n,mt.

    Finally, define

    un,m(r, , t) = Rn,m(r)Tn,m(t) sin(n) & vn,m(r, , t) = Rn,m(r)Tn,m(t) cos(n),

    for integers n 0, m > 0. Each satisfies the heat equation in polar coordinates, will be 0 whenr = 1, be bounded and periodic in with least period 2/n. So too would any linear combination.If {an,m} and {bn,m} are chosen so that

    u(r, , t) =

    n=0

    m=1

    an,mRn,m(r)Tn,m(t) sin(n) bn,mRn,m(r)Tn,m(t) cos(n)

    converges, then its limit will satisfy the heat equation, be 0 when r = 1, bounded and periodic in with period 2. All that if left is to find values for the an,m and bn,m such that

    u(r, , 0) = f(r, ) = r(1 r2) sin2(3).

    In our case we can use that

    sin2(3) =1

    2

    1

    2cos(6).

    Thus

    u(r, , 0) = r(1 r2)1

    2 r(1 r2)

    1

    2cos(6).

    We need for

    m=1

    b0,mR0,m(r) =

    m=1

    b0,mJ0(0,mr) = r(1 r2)

    and

    m=1

    b6,mR6,m(r) =

    m=1

    b6,mJ6(6,mr) = r(1 r2).

    Each family of functions {Jn(n,m}

    m=1 satisfies the orthogonality conditions needed to do seriesapproximations. We get

    b0,m =

    1

    0r2(1 r2)J0(0,mr) dr 1

    0 rJ20 (0,mr) dr

    and

    b6,m =

    1

    0 r2(1 r2)J6(6,mr) dr 1

    0rJ26 (6,mr) dr

    .

    Next we plot u(r, , 0) and compare the graph for f(r, ) above.

    9

  • > f := r -> r*(1-r^2);

    > g := (n,m) -> evalf(BesselJZeros(n,m));

    > b0 := b0 := m -> (int(r*f(r)*BesselJ(0,g(0,m)*r)

    ,r=0..1))/(int(r*BesselJ(0,g(0,m)*r)^2 ,r=0..1));

    > b6 := m -> (int(r*f(r)*BesselJ(6,g(6,m)*r)

    ,r=0..1))/(int(r*BesselJ(6,g(6,m)*r)^2 ,r=0..1));

    > U := (r,theta) -> 1/2*sum( b0(m)*BesselJ(0,g(0,m)*r) ,m=1..M) -

    1/2*cos(6*theta)*sum(b6(m)*BesselJ(6,g(6,m)*r), m=1..M);

    > M:=10:

    > plot3d(U(sqrt(x^2+y^2),arctan(y,x)),x=-1..1,y=-1..1,view=0..0.5,

    color=U(sqrt(x^2+y^2),arctan(y,x)),numpoints=1000);

    [I have no idea why Maple used a different color scheme.]Now we put all the pieces together to get

    u(r, , t) =1

    2

    m=1

    a0,mJ0(n,mr)e2

    0,mt

    1

    2cos(6)

    m=1

    a6,mJ6(n,mr)e2

    6,mt.

    We plot this for a few values of t.

    10

  • t = 0.01

    t = 0.02

    11

  • t = 0.05

    [Maple is re-calibrating the color scale each time. I do not know how to fix this.]

    12

  • Note: We took advantage of the fact the given f(r, ) was separable. This is not always the case.General case: See http://faculty.fiu.edu/ meziani/MAP4401.html, NOTE12: Fourier-

    Bessel Series and BVP in Cylindrical Coordinates by Hamid Meziani, 2016.We have...

    u(r, , t) =

    n=0

    m=1

    an,mRn,m(r)Tn,m(t) sin(n) bn,mRn,m(r)Tn,m(t) cos(n)

    =

    n=0

    m=1

    an,mJn(n,mr)e2

    n,mt sin(n) bn,mJn(n,mr)e

    2n,m

    t cos(n).

    At time t = 0 we need

    u(r, , 0) =

    n=0

    m=1

    an,mJn(n,mr) cos(n) bn,mJn(n,mr) sin(n) = f(r, ).

    For each value of r [0, 1] the function f(r, ) is periodic with period 2 and so has a Fourierseries. We compute the coefficients as normal, but regard them as functions of r.

    f(r, ) =A0(r)

    2+

    n=1

    An(r) cos(n) + Bn(r) sin(n)

    where

    An(r) =1

    f(r, ) cos(n) d,

    and

    Bn(r) =1

    f(r, ) sin(n) d,

    for n = 0, 1, 2, 3, ... (of course B0 = 0 so we ignore it).Now each An(r) and Bn(r) has a Bessel series in terms of any Jk so choose k = n. We have

    An(r) =

    j=1

    AnmJn(nmr) & Bn(r) =

    j=1

    BnmJn(nmr),

    where

    Anm =

    1

    0 rAn(r)Jn(nmr) dr 1

    0rJ2n(nmr) dr

    & Bnm =

    1

    0 rBn(r)Jn(nmr) dr 1

    0rJ2n(nmr) dr

    .

    Example

    Let f(r, ) = r(1 r)er sin

    Discontinuous Example

    Let

    f(r, ) =

    {

    1 0 &r < sin 0 otherwise

    13