July 22, 2014

2D Burgers Equation

22.7.14 Posted by Florin No comments
The Burgers' equation sums up the equations solved in the last two posts: the nonlinear convection and the diffusion; still being not very complicated, some analytical solutions exist and the numerical solution can be validated easily.
The set of equations to be solved is the following:
ut+uux+vuy=ν(2ux2+2uy2)
vt+uvx+vvy=ν(2vx2+2vy2)
They all look familiar and to solve them we will be using the steps we already know.
The algebraic approximation is the following:
un+1i,juni,jΔt+uni,juni,juni1,jΔx+vni,juni,juni,j1Δy=

ν(uni+1,j2uni,j+uni1,jΔx2+uni,j+12uni,j+uni,j1Δy2)

vn+1i,jvni,jΔt+uni,jvni,jvni1,jΔx+vni,jvni,jvni,j1Δy=
ν(vni+1,j2vni,j+vni1,jΔx2+vni,j+12vni,j+vni,j1Δy2)

And the scheme to be implemented in Python:

un+1i,j=uni,jΔtΔxuni,j(uni,juni1,j)ΔtΔyvni,j(uni,juni,j1)+
νΔtΔx2(uni+1,j2uni,j+uni1,j)+νΔtΔy2(uni,j+12uni,j+uni,j+1)

vn+1i,j=vni,jΔtΔxuni,j(vni,jvni1,j)ΔtΔyvni,j(vni,jvni,j1)+
νΔtΔx2(vni+1,j2vni,j+vni1,j)+νΔtΔy2(vni,j+12vni,j+vni,j+1)

The code written to solve this is made by reusing pieces from the mentioned codes.
Python code for Burgers Equation [lines 1-44]
Python code for Burgers Equation [lines 45-87]
This time another time of plot is used, the wireframe.
The initial conditions:

The solution after 120 and 1200 steps:



 The discussion from previous steps apply: the wave profile is affected both by convection and diffusion; convection makes the wave to be carried with the flow and deforms it, creating a crest; the diffusion makes the momentum to spread in the domain and reduces the magnitude of the wave.

The code and plots are available on my GitHub account; several changes from the posted code may apply.

If there are any question feel free to leave a comment below.

0 comments:

Post a Comment