July 19, 2014

1D Diffusion only

19.7.14 Posted by Florin No comments
The Diffusion component from the Navier Stokes equations is a second order partial derivative.
ut=ν2ux2

In order to approximate this by finite differences we will need to use a Taylor expansion;
I will not get into the mathematics of this, but in the end the approximation is the following:

2ux2=ui+12ui+ui1Δx2+O(Δx2)

The last part is the error that will be considered negligible.
This is used to re-write the equation stated above.
un+1iuniΔt=νuni+12uni+uni1Δx2

After reordering for the unknown, the scheme is the following:
un+1i=uni+νΔtΔx2(uni+12uni+uni1)

This scheme is implemented in Python using the same IC and BC as in the other first steps from this project.

The code can be seen in the following:
Python code for solving the 1D Diffusion
In the following plot the solution (in green) is shown over the initial conditions (in blue).
IC and solution after 100 iterations
As it can be seen, the wave is stationary and the amplitude is decaying, influencing the velocity of neighboring cells. In the next picture all 100 iterations are plotted simultaneously.
IC and solution for all 100 iterations
The physical reason for the diffusion is the chaotic movement of the fluid particles.

The code for 1D Diffusion problem can be downloaded from GitHub, here.

In the next step we will be discussing the 1D Burgers' equation.

If you have any questions feel free to leave a comment below.

0 comments:

Post a Comment