#!/usr/bin/python
from palabos import *
nx, ny, nz = 100, 50, 50
tau = 0.6
lattice = Block3D(nx,ny,nz, D3Q19, BGK(omega=1/tau))
pout.display( lattice[10,10,10].getPopulations() )
lattice[10,10,10].initializeAtEquilibrium(1.1, [0.,0.,0.])
lattice.collideAndStream()
for i in range(1,100):
lattice.collideAndStream()
imShow(lattice[:,:,nz/2].velocityNorm())
lattice[10:30,10:30,10:30].defineDynamics(BounceBack(1.))
dir(lattice)
help(lattice.defineDynamics)
for i in range(1,100):
lattice.collideAndStream()
imShow(lattice[:,:,nz/2].velocityNorm())
lattice.defineDynamics(BGK(omega=1./tau))
x,y,z = lattice.meshGrid()
media = (x−10)**2 + (y−10)**2 + (z−10)**2 < 10**2
pout.isoSurface(media, [1.])
nobst = 30
r = 8
for cx,cy,cz in zip(rand_int(nobst,nx), rand_int(nobst,ny), rand_int(nobst,nz)):
pout.display(’Sphere at position’, cx, cy, cz)
media += (x−cx)**2 + (y−cy)**2 + (z−cz)**2 < r**2
pout.isoSurface(media>0, [1.])
boundary.regularized().definePressureBC(lattice[0,:,:])
lattice[0,:,:].setBoundaryDensity(1.02)
boundary.regularized().definePressureBC(lattice[nx−1,:,:])
lattice[nx−1,:,:].setBoundaryDensity(1.)
lattice[media>0].defineDynamics(BounceBack(1.))
for i in range(1,200):
lattice.collideAndStream()
imShow(lattice[:,:,20].velocityNorm())
pout.display( lattice[media==0][nx/2,:,:].velocityComponent(0).average() )
pout.imagesc( [ lattice.velocity().strainRate().symmetricTensorNorm()[:,:,20],
lattice.strainRateFromStress().symmetricTensorNorm()[:,:,20] ] )