# Example calculations¶

Note

For all simulations $$a=1$$, $$d=0.001$$ on a domain where $$0\leq x \leq 1$$, with mesh spacing $$h=0.02$$ and time step $$\tau=0.01$$. The equations are solver with the boundary conditions $$u(0,t)=1$$ and $$u(1,t)=0$$ and initial conditions $$u(x,0)=sin(\pi x)^{100}$$. With these boundary conditions a boundary layer will form near $$x=1$$.

## Uniform grid¶

First we test the finite-volume method using a standard uniform grid. Note that the Peclet number for the above parameters is $$\mu=20$$ so the central discretisation scheme is not stable as illustrated by the oscillations in the solution. The upwind scheme does not have a stability criteria related to the Peclet number so the solutions for the upwind case are smooth. Finally, the exponentially fitted scheme has automatically weighted in favour of the upwind discretisation, the value of $$\kappa\approx 0.9$$.

## Random grid¶

Although a random grid is of no practical use it is a good test of the code because bugs are more likely to show up when symmetry has been reduced. I the follow simulations $$\text{min}(\kappa)$$ =0.004 and $$\text{max}(\kappa)$$ =0.98 so the discretisation scheme is abruptly changing from cell to cell.

## Nonuniform grid¶

Nonuniform grids can be used to reduce to improve the solution as shown here. The following simulation contains the same number of cells as the previous simulations however the cell centres are clustered towards the right hand boundary. The increased density of cells allow the boundary layer to be resolved. The transient solution computed from the central scheme is still significantly affected by the high Peclet number but it is interesting to observe that the steady-state solution of all three methods are very similar. Furthermore, $$\kappa\approx0.01-0.1$$ in the region of the boundary layer which implies the local value of Peclet number as been reduced enough so allow the exponentially fitted scheme to weight in favour of the higher accuracy central discretisation.