# 1.2.1.3. 1D Second-order Linear Diffusion - The Heat Equation¶

## 1.2.1.3.1. Understand the Problem¶

What is the final temperature profile for 1D diffusion when the initial conditions are a square wave and the boundary conditions are constant?

1D diffusion is described as follows:

Consider looking for a solution of type:

Represents a wave of amplitude \(\hat u\), \(\omega = 2 \pi f\)

Introducing into PDE, we obtain:

Leading to a solution:

where \(e^{\nu k^2 t}\) is the exponential damping term. So diffusion is an exponentially damped wave.

Note: \(\nu > 0\) for physical diffusion (if \(\nu < 0\) would represent an exponentially growing phenomenon, e.g. an explosion or ‘the rich get richer’ model)

The physics of diffusion are:

An expotentially damped wave in time

Isotropic in space - the same in all spatial directions - it does not distinguish between upstream and downstream

The phenomenon of diffusion is isotropic - so the finite difference formula that represents that physics is **central differencing** CD, because CD takes values from upstream and downstream equally.

## 1.2.1.3.2. Formulate the Problem¶

Same as Linear Convection

## 1.2.1.3.3. Design Algorithm to Solve Problem¶

### 1.2.1.3.3.1. Space-time discretisation¶

FD in time

**CD in space**

### 1.2.1.3.3.2. Numerical scheme¶

i \(\rightarrow\) index of grid in x

n \(\rightarrow\) index of grid in t

### 1.2.1.3.3.3. Discrete equation¶

### 1.2.1.3.3.4. Transpose¶

### 1.2.1.3.3.5. Pseudo-code¶

Very similar to Linear Convection

## 1.2.1.3.5. Conclusions¶

### 1.2.1.3.5.1. Why isn’t the square wave maintained?¶

The square wave isn’t maintained because the system is attempting to reach equilibrium - the rate of change of velocity being equal to the shear force per unit mass. There are no external forces and no convective acceleration terms.

### 1.2.1.3.5.2. Why does increasing the viscosity, spatial points and time period cause instability?¶

If the viscosity is too large, or if the number of spatial points is too large or if the timestep is too large, then the central differencing method becomes unstable. This is due to the ratio, r. If r is too large, the method becomes unstable: