2D cavity flow
OpenLB – Open Source Lattice Boltzmann Code › Forums › on Lattice Boltzmann Methods › General Topics › 2D cavity flow
 This topic has 0 replies, 1 voice, and was last updated 11 years ago by delekth.

AuthorPosts

April 21, 2013 at 10:54 am #1731delekthMember
hi guys, i’ve starded studying the LBM a week ago and i wanted to try to solve an easy problem such as 2D cavity flow using a fortran code.rnrni used a 257×257 lattice with D2Q9 method:rnrn 6 2 5rn  /rn 3 – 0 – 1rn /  rn 7 4 8rnrnhere are the number of each direction.rnrnthe origin of the axis xy is in the low left corner. rnrnthe numeration of the lattice node was made as follows:rnrncrnc ^rnc rnc yrncrnc : : :rnc rnc 3 * * * ..rnc rnc 2 * * * ..rnc rnc 1 * * * ..rnc x >rnc 1 2 3 rnrnrnrnwhere * are the lattice nodes, as you can see the numeration starts at 1 and ends at 257.rnrnnx=256rnny=256rnrnthe first thing i do is the inizialization of all the density distribution functions, which in my code are three dimensional arrays f(k,i,j) where k is the direction of the density distribution and i and j its position in the lattice.rnrnrt_0 = density * 4.d0 / 9.d0rnrt_1 = density / 9.d0rnrt_2 = density / 36.d0rnrnrndo j = 1, ny + 1rn do i = 1, nx + 1rnrnf(0,i,j) = rt_0rnf(1,i,j) = rt_1rnf(2,i,j) = rt_1rnf(3,i,j) = rt_1rnf(4,i,j) = rt_1rnrnf(5,i,j) = rt_2rnf(6,i,j) = rt_2rnf(7,i,j) = rt_2rnf(8,i,j) = rt_2rnend do rnend do rnrnthen i start the MAIN LOOP:rnrndo istep = 1, nsteprnrncall STREAMING ! here all the density are moved to the neighbour nodesrncall BOUNCEBACK ! here the bounceback condition is applied to the external nodesrncall COLLIDE ! here the equilibrium density and the collision at each lattice is computedrnrnend do rnrn1) first question: is the loop correct?rnrnthe subroutine STREAMING is then written in this way:rnrndo j = ny+1,2,1rn do i = 1, nxrn f(2,i,j) = f(2,i,j1)rn f(6,i,j) = f(6,i+1,j1)rn enddorn enddornrn do j = ny+1,2,1rn do i = nx+1,2,1rn f(1,i,j) = f(1,i1,j)rn f(5,i,j) = f(5,i1,j1)rn enddorn enddornrn do j = 1,nyrn do i = nx+1,2,1rn f(4,i,j) = f(4,i,j+1)rn f(8,i,j) = f(8,i1,j+1)rn enddorn enddornrnrn do j = 1,nyrn do i = 1,nxrn f(3,i,j) = f(3,i+1,j)rn f(7,i,j) = f(7,i+1,j+1)rn enddorn enddornrnwhere the nodes with coordinates: rn (1 , 1:ny+1) WEST boundaryrn (nx+1 , 1:ny+1) EAST BOUNDARYrn (1:nx+1 , ny+1) NORTH BOUNDARYrn (1:nx+1 , 1 ) SOUTH BOUNDARYrnrnin this way there is a streaming of F(4,i,j) and F(2,i,j) ON the east and west boundary which are not fluid nodes, and should just bounce back the incoming distributions from the fluid side.rnis this correct? or instead the streaming should be defined just on the fluid nodes? and therefore be :rnrndo j = ny,2,1rn do i = 2, nxrn f(2,i,j) = f(2,i,j1)rn f(6,i,j) = f(6,i+1,j1)rn enddorn enddornrn do j = ny,2,1rn do i = nx,2,1rn f(1,i,j) = f(1,i1,j)rn f(5,i,j) = f(5,i1,j1)rn enddorn enddornrn do j = 2,nyrn do i = nx,2,1rn f(4,i,j) = f(4,i,j+1)rn f(8,i,j) = f(8,i1,j+1)rn enddorn enddornrnrn do j = 2,nyrn do i = 2,nxrn f(3,i,j) = f(3,i+1,j)rn f(7,i,j) = f(7,i+1,j+1)rn enddorn enddornrnrni hope that what i wrote is clear.rnthank you for all the answers.rnrnrn

AuthorPosts
 You must be logged in to reply to this topic.