# 1-d diffusion

Hey all,
I'm wondering if someone can help me understand how to apply the boundary conditions to the diffusion equation in one dimension. Diffusion equation is:

$$\frac{\partial u}{\partial t}$$=D*$$\frac{(\partial)^{2}u}{\partial x^{2}}$$

The initial condition is:
$$u(x,0)=0$$

And the boundary conditions are:
$$\frac{\partial u(0,t)}{\partial x}$$=$$\frac{\partial u(L,t)}{\partial x}$$=0

I've been trying to solve this by seperation of variables, and letting $$u(x,t)=T(t)X(x)$$I get the two equations:

$$\frac{dT}{dt}+DT=a^{2}$$
and
$$\frac{d^{2}X}{dx^{2}}+X=a^{2}$$

Then for my solutions I get:
$$T(t)=C_{1}e^{-a^{2}Dt}$$
and
$$X(x)=C_{2}sin(ax)+C_{3}cos(ax)$$

so then,
$$u(x,t)=T(t)X(x)=C_{1}e^{-a^{2}Dt}(C_{2}sin(ax)+C_{3}cos(ax))$$

To apply my boundary/initial conditions, I then differentiate wrt x, and obtain the three simultaneous equations:

$$C_{1}(C_{2}sin(ax)+C_{3}cos(ax))=0$$
$$C_{2}C_{1}e^{-a^{2}Dt}=0$$
$$C_{1}e^{-a^{2}Dt}(C_{2}cos(aL)-C_{3}sin(aL))=0$$

When I try to solve this, I find that the only possible solutions are $$C_{1}=C_{2}=C_{3}=0$$ but that can't be right.

What am I missing?

Overall, everything looks pretty good.
I don't think the initial condition works however, if at t = 0, U = 0 for all x... then there is nothing to diffuse.
Also, C1 shouldn't be there, if you distribute C1 to the sin and cos term, its absorbed into C2 and C3 (so there should only be 2 constants of integration), in addition to the constant a (which should be Pi*n/L for some integer n) --> and the solutions should actually be a sum over all n (in general)

Mute
Homework Helper
First, note that you don't actually need $C_1$. It can be absorbed into $C_3$ and $C_2$. That said, the boundary conditions are not going to place constraints on the C's, but on your constant $a$. i.e., what values of $a$ are permitted such that your boundary conditions are satisfied?

You don't want to be looking for conditions on the $C_i$, since you should find that there will be an infinite number of possible values of $a \equiv a_n$ that satisfy your boundary conditions, and the general solution to the problem will in fact be an infinite sum:

$$\sum_{n=0}^{\infty}e^{-a_n^2Dt}\left\{A_n \cos a_n x + B_n \sin a_n x \right\}$$

All right, everything you guys said makes sense, especially getting rid of one of the constants. But, I'm trying to apply this to a physical situation, so I need to find a way to get rid of the constants. There is nothing in the region of interest [0,L] at t=0, but at t>0, material diffuses thru the boundary regions into the region of interest. If $$a_{n}=\frac{n/pi}{L}$$, how do I go about finding the other constants?

The paper I'm looking at gives,
$$\lambda_{0}=0$$
$$\lambda_{j}=(\frac{\pi j}{L})^{\frac{1}{2}}$$
$$\psi_{0}(x)=(\frac{1}{L})^{\frac{1}{2}}$$
$$\psi_{j}(x)=(\frac{2}{L})^{\frac{1}{2}})cos(\frac{\pi j x}{L})$$

as eigenvalues and eigenfunctions. I thought these were obtained from the boundary and initial conditions, but apparently that isn't the case. I'm not seeing the eigenvalue equation that they derived these from...Where do these come from?

HallsofIvy
Homework Helper
Hey all,
I'm wondering if someone can help me understand how to apply the boundary conditions to the diffusion equation in one dimension. Diffusion equation is:

$$\frac{\partial u}{\partial t}$$=D*$$\frac{(\partial)^{2}u}{\partial x^{2}}$$

The initial condition is:
$$u(x,0)=0$$

And the boundary conditions are:
$$\frac{\partial u(0,t)}{\partial x}$$=$$\frac{\partial u(L,t)}{\partial x}$$=0

I've been trying to solve this by seperation of variables, and letting $$u(x,t)=T(t)X(x)$$I get the two equations:

$$\frac{dT}{dt}+DT=a^{2}$$
and
$$\frac{d^{2}X}{dx^{2}}+X=a^{2}$$

Then for my solutions I get:
$$T(t)=C_{1}e^{-a^{2}Dt}$$
and
$$X(x)=C_{2}sin(ax)+C_{3}cos(ax)$$

so then,
$$u(x,t)=T(t)X(x)=C_{1}e^{-a^{2}Dt}(C_{2}sin(ax)+C_{3}cos(ax))$$

To apply my boundary/initial conditions, I then differentiate wrt x, and obtain the three simultaneous equations:

$$C_{1}(C_{2}sin(ax)+C_{3}cos(ax))=0$$
$$C_{2}C_{1}e^{-a^{2}Dt}=0$$
$$C_{1}e^{-a^{2}Dt}(C_{2}cos(aL)-C_{3}sin(aL))=0$$

When I try to solve this, I find that the only possible solutions are $$C_{1}=C_{2}=C_{3}=0$$ but that can't be right.

What am I missing?
The first thing you should do is combine that "C1" into C2 and C3. What you really have is
$$u(x,t)=T(t)X(x)=e^{-a^{2}Dt}(C_{2}sin(ax)+C_{3}cos(ax))$$
with two unknown constants, not 3. Now, since the derivatives are to be 0 and x=0, and the derivative of sin(ax) is cos(ax) which is NOT 0 and x= 0, yes, yes C2= 0. That leaves you with
[tex]u_x(L, t)= e^{-a^2Dt}(-aC_3 sin(aL))= 0[/itex]
which requires that C3 be 0 unless sin(aL)= 0. If aL is a multiple of $\pi$: that is if $a= n\pi/L$, you have non-trivial solutions. THEN pick C3 to satisfy "initial condition".

Because that initial condition is u(x,0)= 0 for all x, you do, in fact, get u(x,t)= 0 as the solution. If the initial temperature is 0 and no heat can diffuse in or out, the temperature stays 0!

lzkelley is right: with the boundary conditions you have specified, the answer is 0 at all times. Think of it this way: if u=0 at t=0, then du/dx = d^2u/dx^2 = 0. But then, by the diffusion equation, du/dt = 0, and so the solution cannot change with time.

damn, I see what you're saying. Thanks for your help! I emailed the author of the paper in hopes that he can shed some light on how he obtained his solution.