pdes_part2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

3 Solution of the one-dimensional wave equation

In this section we will look at the 1D wave equation for a wave H(x, t)

∂ 2 H(x, t) 1 ∂ 2 H(x, t)
=
∂x2 c2 ∂t2
We will start by obtaining standing wave solutions of it via the method of standing variables. We will
then consider travelling wave solutions of this wave equation, including one that is a Fourier series.
Then we look at applying boundary conditions.

3.1 Standing-wave solution via separation of variables


A standard way of solving PDEs such as the wave equation, diffusion equation, Schrödinger’s equation,
etc, is to start by assuming that the solution, e.g., the function of two variables H(x, t), can be written
as a product of functions, each of which is a function of only one of the variables. The idea is that
H(x, t) is a function of x only, call it X(x), times a function of t only, call it T (t):

H(x, t) = X(x)T (t)

Note that T (t) is a function of t, not the temperature. At the moment, X and T are unknown
functions.
Now, by assuming that we can write the solution to the PDE as a product of a function of x times
a function of t, we can obtain a solution of PDE but we will not obtain the general solution to the
PDE. Typically (as we will see below) we use this method to obtain sets of possible solutions, and then
we sum many of these solutions to obtain the particular solution that we want, i.e., one that satisfies
the boundary conditions on the solution. An example of this is when the solutions are sine and cosine
waves and the the sum over many of these solutions is a Fourier series.
If we substitute H(x, t) = X(x)T (t) into the one-dimensional wave equation we get

d2 X(x) 1 d2 T (t)
T (t) = X(x)
dx2 c2 dt2
because we can take T out of the x differentiation as it is independent of x, and similarly we can take
X out of the t differentiation. If we divide both sides by XT , we get

1 d2 X(x) 1 1 d2 T (t)
=
X(x) dx2 c2 T (t) dt2

Now, we notice that the left-hand side is a function of x but not of t while the right-hand side is a
function of t but not of x. So the LHS tells us that the equation cannot depend on t, and the RHS
tells us that it cannot depend on x. Therefore it cannot depend on either x or t, and so must be a
constant. We will call this constant −k 2 . As we will see the minus sign will give us the sine and cosine
functions that will be most useful here1 . The fact that k is squared is just to make some of the later
equations look neater.
1
We choose the − sign as we wanted sine and cosine functions. If we picked a + sign, we would get exponentials,
which are not useful for the problems we study here but might be in other problems.

8
So we have
1 d2 X(x) 1 1 d2 T (t)
= = −k 2
X(x) dx2 c2 T (t) dt2
which gives us the two ODEs
d2 X(x) d2 T (t)
= −k 2 X(x) and = −k 2 c2 T (t)
dx2 dt2
The solutions of these ODEs are
X(x) = A cos(kx) + B sin(kx) and T (t) = C cos(kct) + D sin(kct)
where A, B, C and D are constants. You can check this by substituting these solutions back into the
ODEs and checking that the LHS equals the RHS. These ODEs were covered in the semester 1 ODE
course, please refer to your notes or to a textbook if you are unsure about these solutions. You need
to understand how to solve these simple ODEs if you are to understand how to solve the PDEs.
We can multiply X and T together and get the solution for H
H(x, t) = X(x)T (t) = [A cos(kx) + B sin(kx)] [C cos(kct) + D sin(kct)]
or
H(x, t) = AC cos(kx) cos(kct) + AD cos(kx) sin(kct) + BC sin(kx) cos(kct) + BD sin(kx) sin(kct)
Defining the four new constants I = AC, J = AD, P = BC and Q = BD we have that the solution is
H(x, t) = I cos(kx) cos(kct) + J cos(kx) sin(kct) + P sin(kx) cos(kct) + Q sin(kx) sin(kct)
This solution has four terms: the four combinations of sines and cosines as functions of space and of
time.
It is a solution but not the most general solution. However, as the wave equation is a linear
homogeneous PDE then the sum of any solutions of this PDE is also a solution to the PDE. In other
words we can add lots of terms like cos(kx) cos(kct), with different k ′ s, and the sum is also a solution,
e.g.,
H(x, t) = I1 cos(k1 x) cos(k1 ct) + I2 cos(k2 x) sin(k2 ct)
is a solution of the PDE, for any values of the constants I1 and I2 , and of the wavevectors k1 and k2 .
This means that we can add lots of these terms together and vary the constants, and so get an
expression that satisfies the boundary conditions. This is how we can use a Fourier series to obtain a
particular solution of a PDE.
To write a Fourier series general solution to the wave PDE we add subscript n’s to the I, J, P , Q
and k to indicate that we could have many terms like these with different values of I, k, etc. Then we
have
X∞
H(x, t) = [In cos(kn x) cos(kn ct) + Jn cos(kn x) sin(kn ct) + Pn sin(kn x) cos(kn ct) + Qn sin(kn x) sin(kn ct)]
n=1

Note that for each solution all the constants are different, the In , Jn , Pn , Qn and kn are all different.
kn = 2π/λn is the wavevector of the nth term in the sum, and so the nth term is 4 waves, each with the
same wavelength, but each term has a different wavelength. The boundary conditions will determine
the values of the constants In , Jn , Pn and Qn , and of the kn and then once these values are determined
we have the particular solution.

9
Figure 2: A plot of a square wave H(x) of wavelength L = 1, plus two sine wave series approximations
to it. The square wave is the black solid curve. A sine wave of the same wavelength is shown as a
dot-dashed green (grey) curve. This is a sine series approximation to the square wave, truncated after
the first term. A sum of up to the n = 9 terms is shown as the dashed red (grey) curve. We see
that the dashed curve follows the square wave much better than the dot-dashed curve but it is still an
approximation, only an infinite series perfectly follows the square wave.

0
h

-1

-20 0.2 0.4 0.6 0.8 1


x

3.2 Travelling wave solutions


The method of separation of variables gives us the solution in terms of standing waves, i.e., a sine
(or cosine) of kx times a sine (or cosine) of kct, e.g., sin(kx) sin(kct). Any solution of the wave PDE
can be expressed as a sum of standing waves. However, any solution of the wave PDE can also be
written in terms of a sum of travelling waves, i.e., functions like sin(k(x − ct)). So, we can also write
the solution to the 1D wave equation as

X
H(x, t) = [An cos(kn (x − ct)) + Bn sin(kn (x − ct)) + Cn cos(kn (x + ct)) + Dn sin(kn (x + ct))]
n=1

The first two terms are sine and cosine waves moving to the right, with speed c, whereas the last two
terms are sine and cosine waves moving to the left, with speed −c.

3.2.1 Fourier series travelling wave solutions


A simple sine wave with wavelength λ = 2π/k, amplitude B, moving with speed c is

H(x, t) = B sin(k(x − ct))

This just gives a sine curve of course, but other shapes can be built up from a sum of sines (and/or
cosines). We can consider a simple example: the square wave, defined by

+1 0 < x < L/2
H(x, t = 0) =
−1 L/2 < x < L

10
This can be written as the sum of sine waves
X 8  nπx 
H(x, t = 0) = sin
n=2,6,10,14,...
nπ L

Note that for this particular square wave, the sum only includes every 4th term, the n = 3, 4 and 5
terms are zero, the n = 6 term is non-zero, the n = 7, 8 and 9 terms are zero, and so on.
Starting with this square wave at t = 0, a square wave moving with speed c is then obtained by
just subtracting ct from x in the argument of the sine waves, i.e.,
 
X 8 nπ(x − ct)
H(x, t) = sin
n=2,6,10,14,...
nπ L

The first few terms are


     
4 2π(x − ct) 4 6π(x − ct) 4 10π(x − ct)
H(x, t) = sin + sin + sin + ···
π L 3π L 5π L

3.3 Applying boundary conditions


Above we started with the wave at time t = 0, and if we know the direction the wave is travelling in,
then we can just subtract ct from x in the sine functions, to get the solution at any time t. When we
did this we were effectively specifying boundary conditions: these were the initial condition, which is
the wave at t = 0, plus a direction.
Here we will look at two more examples of the application of boundary conditions to solutions of
the wave PDE. One to a standing wave solution and another to a travelling wave solution. First the
standing wave solution.

3.3.1 Simple example boundary conditions applied to a standing wave solution


In general the solution will be an infinite sum of waves (also called Fourier modes), each with a different
k, i.e., with a different wavelength. But here we will consider a simple example, where there is only
one standing wave, a wavelength λ, with a corresponding wavevector k = 2π/λ.
In this simple case where there the solution is known to have just one wavelength the solution is
just

H(x, t) = I cos(kx) cos(kct) + J cos(kx) sin(kct) + P sin(kx) cos(kct) + Q sin(kx) sin(kct)

As a simple example of how boundary conditions are applied, we consider boundary conditions that
are initial conditions. The first initial condition is that at time t = 0, the function H(x, t = 0) is given
by
H(x, t = 0) = 10 cos(kx)
and the second initial condition is that the time derivative is zero, i.e., the string is stationary at t = 0
 
∂H(x, t)
=0
∂t t=0

where the subscript t = 0 on the brackets indicates that we evaluate the time derivative at t = 0.

11
Now, having written down the boundary conditions that the particular solution must satisfy, we
must apply these boundary conditions. We start2 by applying the boundary condition on H at t = 0

H(x, t = 0) = 10 cos(kx) = I cos(kx) cos(0) + J cos(kx) sin(0) + P sin(kx) cos(0) + Q sin(kx) sin(0)

and as sin(0) = 0 and cos(0) = 1, this simplifies to

10 cos(kx) = I cos(kx) + P sin(kx)

So I = 10 and P = 0. Putting these values in our expression for H(x, t) we get

H(x, t) = 10 cos(kx) cos(kct) + J cos(kx) sin(kct) + Q sin(kx) sin(kct)

Now we apply the boundary condition on the initial time derivative. First we take the time
derivative of H
∂H(x, t)
= −10kc cos(kx) sin(kct) + Jkc cos(kx) cos(kct) + Qkc sin(kx) cos(kct)
∂t
At t = 0, this time derivative equals zero
 
∂H(x, t)
= 0 = −10kc cos(kx) sin(0) + Jkc cos(kx) cos(0) + Qkc sin(kx) cos(0)
∂t t=0

0 = Jkc cos(kx) + Qkc sin(kx)


so both J and Q are zero, J = 0, and Q = 0. So the standing-wave solution that satisfies both
boundary conditions is
H(x, t) = 10 cos(kx) cos(kct)

3.3.2 Simple example boundary conditions applied to a travelling wave solution


We will now look at exactly the same boundary conditions but with a travelling wave. The general
travelling wave solution for one fixed value of k is

H(x, t) = A cos(k(x − ct)) + B sin(k(x − ct)) + C cos(k(x + ct)) + D sin(k(x + ct))

As before, the first initial condition is that at time t = 0, the function H(x, t = 0) is given by

H(x, t = 0) = 10 cos(kx)

so we have

H(x, t = 0) = 10 cos(kx) = A cos(kx) + B sin(kx) + C cos(kx) + D sin(kx)

H(x, t = 0) = (A + C) cos(kx) + (B + D) sin(kx)


To satisfy this boundary condition, A + C = 10 and B + D = 0.
2
We start with this boundary condition as it simplifies the solution by eliminating some terms. Note that in principle
we can apply the boundary conditions in any order, but that in practice applying the boundary conditions in one order
is usually easier (and sometimes a lot easier) than applying these boundary conditions in other orders.

12
The second initial condition is that the time derivative is zero at t = 0. The time derivative of the
solution is
∂H(x, t)
= Akc sin(k(x − ct)) − Bkc cos(k(x − ct)) − Ckc sin(k(x + ct)) + Dkc cos(k(x + ct))
∂t
At t = 0 this derivative is zero
 
∂H(x, t)
= Akc sin(kx) − BkcB cos(kx) − Ckc sin(kx) + Dkc cos(kx)
∂t t=0
 
∂H(x, t)
= kc(A − C) sin(kx) + kc(D − B) cos(kx) = 0
∂t t=0
so to satisfy this boundary condition A − C = 0 and D − B = 0.
By combining the equations for A and C from the two boundary conditions we obtain two simul-
taneous linear equations for A and C

A + C = 10 A−C =0

which have the solution A = C = 5. For B and D we have two simultaneous linear equations

B+D =0 D−B =0

which have the solution B = D = 0. So the particular travelling wave solution that satisfies these
boundary conditions is
H(x, t) = 5 cos(k(x − ct)) + 5 cos(k(x + ct))
These are two cosine travelling waves, one travelling left to right and the other right to left. These
two travelling waves sum to give the standing wave we found in the previous section, i.e., the two
solutions we found, one in terms of a standing wave, and the other in terms of two travelling waves,
are completely equivalent. We can choose to use one or the other, whichever we find more convenient
for the problem we are studying.

13
Figure 3: Plot of the metal strip in the xy plane. The x and y axes are shown, and the strip itself is
the shaded area bounded by the dashed line. Although the x axis is shown only up to a little over
four, the strip continues off to x → ∞.

0 1 2 3 4 x

4 Laplace’s equation in two dimensions


Having considered the wave PDE, here we will consider Laplace’s equation. We will essentially just
consider a specific case of Laplace’s equation in two dimensions, for the system with the boundary
conditions shown in Fig. 3. I.e., we will solve the equation and then apply a specific set of boundary
conditions. We use the method of separation of variables to solve it, as we did for the wave equation.
We start not with Laplace’s equation, but with the diffusion PDE. We will see that at steady-state
(i.e., no time dependence) the diffusion equation reduces to the Laplace’s equation. This is a bit like
a Maxwell equation reducing to Laplace’s equation in electrostatics.
The diffusion equation applies to the diffusion of molecules, and also to the motion of heat in a
solid. In a solid, thermal energy diffuses. Thus, the temperature T (x, y, t) in a strip of metal in the
xy plane obeys the diffusion equation
 2
∂ 2T

2 ∂T (x, y, t) ∂ T ∂T
D∇ T (x, y, t) = or D + =
∂t ∂x 2 ∂y 2 ∂t

where D is the diffusion constant for thermal energy in the metal, and in second equation we have
written ∇2 out for two dimensions. Now once the metal has reached steady state, the temperature is
no longer a function of time, we have T (x, y), and so the derivative with respect to time is zero and
we have the two-dimensional Laplace’s equation

∂ 2T ∂ 2T
+ =0
∂x2 ∂y 2
Solving this and applying the boundary conditions will give us the temperature as function of position
in the metal strip.
The specific strip of metal is illustrated in Fig. 3. The strip is rectangular, with its bottom edge
along the x axis and its top along the line y = 2. Its leftmost edge is along the y axis, and it is so long
in the x direction that we will take its length along the x axis to be infinite. We take the temperature
T = 100◦ C along the side of the strip along the y axis and T = 0◦ C along the other three sides. These
boundary conditions are along all four sides of the metal strip and so are a complete set of boundary
conditions.

14
Now, the standard way to solve our PDE is to assume that the solution is a product of a function
of x only, X(x), times a function of y only, Y (y). This is the method of separation of variables. Now,
substituting T (x, y) = X(x)Y (y) into our PDE we get

d2 X(x) d2 Y (y) 1 d2 X(x) 1 d2 Y (y)


Y (y) + X(x) =0 or + =0
dx2 dy 2 X(x) dx2 Y (y) dy 2

where in the second equation we divided both sides by XY . We rearrange to

1 d2 X(x) 1 d2 Y (y)
= −
X(x) dx2 Y (y) dy 2

Now, we notice that the LHS is a function of x but not of y while the RHS is a function of y but not
of x. However, they must be equal to each other for all values of x and y. So, if we change y the
LHS does not change, and if we change x the RHS does not change. As the LHS = RHS then neither
can change if x is changed, or if y is changed. So the equation must equal a constant. We call this
constant k 2 , and then
1 d2 X(x) 1 d2 Y (y)
= − = k2
X(x) dx2 Y (y) dy 2
We can now separate this into two equations

1 d2 X(x) 1 d2 Y (y)
= k2 = −k 2
X(x) dx2 Y (y) dy 2

We have split the PDE into two ODEs. We can now solve these two ODEs and combine the solutions
X and Y to make up T , the temperature profile of interest. The solution of

d2 X(x)
= k 2 X(x) is X(x) = C exp(kx) + D exp(−kx)
dx 2

with C and D the two unknown constants, that we always get in the general solution of a second-order
ODE. The solution of
d2 Y (y)
= −k 2 Y (y) is Y (y) = E sin(ky) + F cos(ky)
dy 2
with E and F the two unknown constants.
Note that because the ODE for x is the second derivative equal to a positive constant times X,
the solutions for X(x) were exponentials, while the constant for the ODE for y was negative, and so
we got sines and cosines for Y . We could have used −k 2 instead of k 2 , and then we would have got an
X which was sines and cosines, and a Y in terms of exponentials. That other solution is just as valid
a solution of Laplace’s equation as the one just above. Which one is best depends on the boundary
conditions.
We in fact chose to arrange things so that the right-hand side of the equation of Y was negative
so that we got cosine and sine functions for Y . This is because we know that T = 0 at the top and
bottom of the strip and so we expect that trig functions, which are of course periodic, will be better
suited to the y direction. Also, along the x axis one side is at infinity, and sines and cosines of infinity
are not well defined, whereas exponentials are OK at infinity.

15
Let us return to the solution, now that we have general solutions for X and Y we have for the
temperature profile

T (x, y) = X(x)Y (y) = [C exp(kx) + D exp(−kx)] [E sin(ky) + F cos(ky)]

Now, this is a solution of T (x, y) although it is not the most general solution of our PDE. The constants
C, D, E and F are arbitrary, as is k, but note that the same k appears in both parts of the solution.

4.1 Applying the boundary conditions


To obtain the temperature as a function of x and y in the metal strip we need to consider the boundary
conditions. There are four boundary conditions. We apply them in turn. As with the wave equation
there are easy orders in which to apply the boundary conditions, and orders which still work but are
less easy. We pick the easy way, here. With a bit of experience you will get better at picking the easy
order. Until then you can try trial and error, i.e., try applying the boundary conditions one way and
if it looks a bit messy, try applying a different boundary condition first. Note that, as we will see,
boundary conditions where the function is zero are often good to apply first, as they often set some
terms to zero which simplifies the solution.

4.1.1 Boundary condition 1


We start with the boundary condition along the right-hand side of the strip. This is that T = 0◦ C all
along this side, which is at such large x that we consider that there x → ∞.

T (x → ∞, y) = [C exp(∞) + D exp(−∞)] [E sin(ky) + F cos(ky)]

T (x → ∞, y) = C × ∞ × [E sin(ky) + F cos(ky)] = 0
where in the final equality we applied the boundary condition, and equated it to zero. Now unless
either C = 0 or both E and F are zero, the LHS is infinity, not 0. We cannot have both E and F
equal to zero as then the entire solution is zero and disappears. So we must have that C = 0. So our
first boundary condition has told us the value of the one of the four constants. Then with C = 0, the
solution T simplifies to
T (x, y) = D exp(−kx) [E sin(ky) + F cos(ky)]

4.1.2 Boundary condition 2


Now, we consider the boundary conditions along the bottom of the strip, at y = 0. Here T (x, y =
0) = 0, so
T (x, y = 0) = D exp(−kx) [E sin(0) + F cos(0)] = D exp(−kx) × F = 0
where in the final equality we applied the boundary condition, and equated it to zero. Now, we cannot
have D = 0 as if D is 0 then the entire solution T = 0 everywhere, which won’t work as we know
T = 100◦ C along the left side of the strip. The exponential also will vary with x and so will not be
zero for all values x, so the only way to make the LHS equal 0 for all values of x is for F = 0. Thus
our second boundary condition has told us that F = 0, and so the solution simplifies again to

T (x, y) = DE exp(−kx) sin(ky) = G exp(−kx) sin(ky)

where we we defined a new constant G = DE.

16
4.1.3 Boundary condition 3
The third boundary condition we apply is along the top of the strip, at y = 2, where the temperature
T (x, y = 2) = 0. So we must have that

T (x, y) = G exp(−kx) sin(2k) = 0

As G has to be a non-zero constant to avoid the entire solution being zero, and as exp(−kx) is also
non-zero the sine term must be zero. So,

sin(k2) = 0 2k = nπ

n = 1, 2, 3, . . .
k=
2
In order to have T = 0 along the top, k must equal an integer, n, times π/2. Putting this in our
solution, it is
T (x, y) = Gn exp (−nπx/2) sin (nπy/2) n = 1, 2, 3, . . .
we have not one solution but a whole series of them, depending on the value of n. As each solution
can have a different constant in front we have replaced the constant G by Gn , where G1 is the constant
for the n = 1 solution, G2 for the n = 2 solution etc.

4.1.4 Boundary condition 4


We have one remaining boundary condition: T (y, x = 0) = 100◦ C, the condition along the left-hand
side. For x = 0 the exponential term in the solution equals one, leaving us with the sine term. However,
we want T to be a constant not a sine function. To obtain a constant we will need to add an infinite
set of the sine terms with successive values of n together. In effect we need to express a constant as a
sine Fourier series. See your notes for Fourier series.
So, we express T (x, y) as a sum of terms with all possible ns
X
T (x, y) = Gn exp (−nπx/2) sin (nπy/2)
n=1,2,...

and set this for x = 0 to 100


X
T (x = 0, y) = Gn sin (nπy/2) = 100
n=1,2,...

As usual with Fourier series we want to calculate the values of the constants Gn , which we get by
multiplying both sides by sin(mπy/2) and integrating. Here the integration interval is along y, and
from y = 0 to y = 2
X Z 2 Z 2
Gn dy sin (mπy/2) sin (nπy/2) = 100 dy sin (mπy/2)
n=1,2,... 0 0

Now, the integral over the product of sine functions is zero unless m = n so we have
Z 2 Z 2
2
Gm dy sin (mπy/2) = 100 dy sin (mπy/2)
0 0

17
The integral on the left-hand side is
2 2  2
1 1 1 1
Z Z
2
dy sin (mπy/2) = dy [1 − cos(mπy)] = y− sin(mπy) = (2 − 0 − 0 + 0) = 1
0 0 2 2 mπ 0 2

and on the right-hand side


2  2  4
2 2
Z
m odd
dy sin (mπy/2) = − cos(mπy/2) =− (cos(mπ) − 1) = mπ
0 mπ 0 mπ 0 m even

because cos(mπ) = −1 if m = 1, 3, 5, . . . and = +1 if m = 2, 4, 6, . . .. So the right-hand side is zero for


m even, and therefore the constants Gm = 0 for m even. Note that we are calling the integer m here
not n but of course as it is just an integer we are summing over to get our solution it does not matter
what we call it. Using the values for the integrals we have
 4  400
m odd m odd
Gm × 1 = 100 × mπ Gm = mπ
0 m even 0 m even

Putting this in our sum for T (x, y) we have


X 400
T (x, y) = exp (−nπx/2) sin (nπy/2)
n=1,3,5,...

or if we explicitly write out the first few terms


400 400 80
T (x, y) = exp (−πx/2) sin (πy/2)+ exp (−3πx/2) sin (3πy/2)+ exp (−5πx/2) sin (5πy/2)+· · ·
π 3π π
This is our final solution to the PDE with the boundary conditions we specified. Note that the sum
is over only the odd integers. Also, not too close to the y axis, i.e., at x at least equal to say two or
three or more, then the first term in the sum is the dominant one. All the terms decay exponentially
as x increases but the first term decays more slowly than the others. Thus we have
400
T (x, y) ≈ exp (−πx/2) sin (πy/2) x not too small
π
So the temperature profile is the product of an exponential decay as x increases and we move away
from the hot edge along the y axis, and a sine wave along the y direction with a maximum at the
midpoint, y = 1, and zero at the top and bottom of the strip, y = 0 and y = 2.

18

You might also like