The idea is that in a given static (i.e. velocity is zero) fluid domain a property will be transported from high concentration regions to low concentration regions; this transport is possible because of the particles collision and is more powerful for gases than for liquids.
Using the methods seen in previous steps, this equation can be approximated as:
And the scheme to be implemented in Python is the following:
un+1i,j=uni,j+νΔtΔx2(uni+1,j−2uni,j+uni−1,j)
+νΔtΔy2(uni,j+1−2uni,j+uni,j−1)
The scheme will be implemented as a function to be called with different values of iteration. The Python code is the following:
Python code for 2D Diffusion [lines 1-43] |
Python code for 2D Diffusion [lines 26-67] |
The solution is plotted for various steps in order to see the evolution in time:
The images tell the story better than any words; the code and plots are available on my GitHub account.
If you have any questions feel free to leave a comment below.
If you have any questions feel free to leave a comment below.
0 comments:
Post a Comment