# Difference between and diffusion and heat equations?

I read everywhere that diffusion and heat equations are similar. The same differential equations can be solved for both.

Consider a finite one-dimensional diffusion or heat transfer where one end is insulated and the other end is kept with a constant flux.

The boundary conditions are the same for diffusion or heat transfer: flux is zero at one end and constant at the other.

$$\frac{\partial u}{\partial x} = C; x = 0$$ $$\frac{\partial u}{\partial x} = 0; x = l$$

and the initial state of $$u(x,0) = 0\ ||\ u(x,0) = K$$ It can be any constant value (initial concentration or temperature).

In the case of heat transfer, the temperature can rise indefinitely. But in the case of diffusion, there is a capacity limit.

How should the diffusion and heat equations be solved for these boundary conditions? Is the solution is the same in both cases?

• Why is there a capacity limit for diffusion? – Ryan Unger Nov 5 '17 at 18:42
• @ocelo7 When a species diffuses into a media, the concentration will be saturated. But the temperature can rise forever. There is a volume limit in the case of diffusion, but not heat. Note that the system is closed. – Kama Nov 5 '17 at 18:57
• That's physics talking. What you've given here is a pure math question. You need something else in your equation to account for a saturation limit. – Ryan Unger Nov 5 '17 at 19:46
• Find an in depth treatment of 1D diffusion here: sciencemadness.org/talk/… . The diffusion and heat equations are indeed very similar and both are solved by means of Separation of Variables. – Gert Nov 5 '17 at 20:05
• @KyleKanos thanks for drawing my attention to that answer. Although it is not an answer to my question, it is connected with the concept I am trying to understand. It was useful! – Kama Nov 6 '17 at 11:37

They are both solved by means of Separation of Variables.

Assume we're looking for a function of the form $u(x,t)$ that satisfies:

$$\frac{\partial u}{\partial t}=\alpha\frac{\partial^2u}{\partial x^2}$$

And satisfies some boundary conditions.

Assume the function to be the product of two functions: $X(x)$ and $T(t)$:

$$u(x,t)=X(x)T(t)$$

Insert into the original PDE:

$$X(x)T'(t)=\alpha T(t)X''(x)$$ Divide both sides by $X(x)T(t)$, rearrange and introduce a separation factor $-\lambda^2$: $$\frac{1}{\alpha}\frac{T'}{T}=\frac{X''}{X}=-\lambda^2$$ We now have two ODEs: $$\frac{X''}{X}=-\lambda^2$$ And: $$T'+\alpha \lambda^2T=0$$

For $X(x)$ we get:

$$X(x)=A\sin(\lambda x)+B\cos(\lambda x)$$

This will be solved by finding the eigenvalues of $\lambda$, using the boundary conditions (example).

With the eigenvalues of $\lambda$ the second ODE for $T(t)$ can also be solved easily:

$$T(t)=C_1e^{-\alpha \lambda^2t}$$

A third boundary condition for the initial state $u(x,0)$ will also be required, to put it all together.

You can find the full derivation here (which I wrote a while back), applied to a 1D ($x$) diffusion problem.

Whether the solutions of the heat equation and diffusion equation are the same (or at least similar in form, bar the material constants) will depend on boundary and initial conditions.

The boundary conditions I used in the linked example do yield eigenvalues for $\lambda$ without particular problems.

$$\frac{\partial u}{\partial x}=0\:\text{at } x=0, x=L$$

A good discussion of various types of boundary conditions and the consequences for the heat equation can be found here.

Another set of boundary conditions as suggested in the comments could be:

$$\Big(\frac{\partial u}{\partial x}\Big)_{x=l}=0$$ $$u(0,t)=C$$

This corresponds to a rod heated to constant temperature $C$ at one end and insulated at the other end.

First we make a transformation of temperature by defining:

$$u=u_{real}-C$$

That then means that the second BC becomes homogeneous, always desirable:

$$u(0,t)=0$$

At the end of our toil we'll simply find:

$$u_{real}(x,t)=u(x,t)+C$$

With the second BC: $u(0,t)=0$:

$$X(0)T(t)=0$$

Assume $T(t)\neq 0$, then:

$$X(0)=0$$

$$A\sin(\lambda 0)+B\cos(\lambda 0)=0$$

$$\implies B=0$$ And:

$$X(x)=A\sin(\lambda x)$$

With the first BC, $u_x(l)=0$:

$$X'(l)T(t)=0$$

Assume $T(t)\neq 0$:

$$A\cos(\lambda l)=0$$

Assuming $A\neq 0$, then:

$$\lambda l=\frac{n\pi}{2}$$

So our eigenvalues become: $$\lambda_n=\frac{n\pi}{2l}$$

For $n=1,2,3,...$

The functions $X_n(x)$ are:

$$X_n(x)=A_n\sin\Big(\frac{n\pi x}{2l}\Big)$$

So we have:

$$u_n(x,t)=A_ne^{-\Big(\frac{n\pi}{2l}\Big)^2\alpha t}\sin\Big(\frac{n\pi x}{2l}\Big)$$

And using the superposition principle:

$$u(x,t)=\displaystyle \sum_{n=1}^{\infty}A_ne^{-\Big(\frac{n\pi}{2l}\Big)^2\alpha t}\sin\Big(\frac{n\pi x}{2l}\Big)$$

As regards the need for an initial condition $u(x,0)$, it should be fairly self-evident that if we're looking to find the time evolution of the distribution of temperature or concentration, we must know what that distribution was at $t=0$. This is much like wanting to know where a car driving at velocity $v(t)$ will be at time $t$: we need to know where it was at $t=0$, otherwise the question can have no definite answer.

In our problem, the initial condition $u(x,0)=f(x)$ will be used to determine the coefficients $A_n$. At $t=0$ the exponential factors all drop out and we get:

$$u(x,0)=f(x)=\displaystyle \sum_{n=1}^{\infty}A_n\sin\Big(\frac{n\pi x}{2l}\Big)$$

The coefficients are determined by Fourier, from:

$$A_n=\frac{2}{l}\int_0^lf(x)\sin\Big(\frac{n\pi x}{2l}\Big)dx$$

Remember that at the end of all of this:

$$u_{real}(x,t)=u(x,t)+C=C+\displaystyle \sum_{n=1}^{\infty}A_ne^{-\Big(\frac{n\pi}{2l}\Big)^2\alpha t}\sin\Big(\frac{n\pi x}{2l}\Big)$$

• How does the initial state change the case of diffusion and heat? Imagine that $u(x,0)=0$. This means that the concentration is zero in the diffusion case and zero temperature (no heat) in the heat case. In the general solution you linked, the key step is to find $f(x)$. How do you define $f(x)$ with the above two boundary conditions and this initial condition? How does $f(x)$ is different for diffusion and heat? – Kama Nov 6 '17 at 10:32
• @Kama: because we're looking for the time evolution of $u$, i.e. $u(x,t)$ we need to know the initial shape of $u(x,t)$, i.e. $u(x,0)=f(x)$. I gave two examples of a practical $f(x)$, here: sciencemadness.org/talk/…. How these are defined stems from the physical reality the problem represents. But whenever time is involved in a problem, an initial ($t=0$) condition is required for a complete solution. This is true also for heat problems. It's also true for time evolution problems that depend only on time, such as Newton's cooling law. – Gert Nov 6 '17 at 14:28
• Also expanded on why your chosen boundary conditions are difficult to use. – Gert Nov 6 '17 at 14:58
• Sorry, it was my typographical mistake. The boundary conditions are flux, and should be $\frac{\partial u}{\partial x}$ not $t$. – Kama Nov 6 '17 at 15:27
• $u_x(l)=0$ (shorthand notation) makes sense: that would be a rod insulated at the end. But $u_x(0)=C$ doesn't seem practical to me: how does one impose a constant flux? Better might be simply $u(0,t)=C$: constant temperature at the other end. – Gert Nov 6 '17 at 15:39

Your observation is good and correct: they are same. Both are diffusions; one diffuses material and the other diffuses heat.

The limit you mentioned also exists for heat transfer as well when you apply fixed temperature as boundary conditions; the temperature cannot be higher that its boundary temperature.

For diffusion, you cannot apply a infinite high concentration of a species. So the limit is not because of equation but because of the boundary value.

The similarities between the two processes were recognized by our ancestors. That's why we sometimes see Schmidt numbers and Prandtl numbers, with which, you know one process, you can get the other without solving the differential equations.

• Note that the boundary condition is not a fixed temperature to be limited. The boundary condition is a constant flux. Thus, there is no limit of temperature in the boundary conditions. – Kama Nov 6 '17 at 10:33
• Heat flux is from temperature gradient and will eventually be determined by temperature. Though you can numerically provide any flux to the equation and get unlimited high temperature, you need to think about the flux twice on how and where it forms. – user115350 Nov 6 '17 at 14:57