Hi all,
Thank you very much for solving my last problem. I learned a lot from the
discussion.
Now I am trying to solve a diffusion problem in 3D. And the diffusivity is
anisotropic. For example:
D=numerix.array(((Dx,0.,0.),(0.,Dy,0.),(0.,0.,Dz)))
I attached a very simple script that use this. But when I run it, I got the
error of "Warning: invalid value encountered in divide".
This feature works fine in 2D. I wonder if anyone has tried the similar
thing. I would greatly appreciate any advice.
Thanks,
Zhiwen
from fipy import *
from fipy.tools import numerix
mesh=Grid3D(nx=50,ny=50,nz=50,dx=0.2,dy=0.2,dz=0.2)
var=CellVariable(mesh=mesh,value=0.,hasOld=1)
X,Y,Z=mesh.getCellCenters()
var.setValue(1.,where=numerix.where(((Z-5.)**2)<=(2.5**2-(X-5.)**2-(Y-5.)**2),1,0))
Dx=1.
Dy=1.
Dz=1.
D=numerix.array(((Dx,0.,0.),(0.,Dy,0.),(0.,0.,Dz)))
dt=0.9*0.2**2/Dx
steps=100
from fipy.boundaryConditions.fixedValue import FixedValue
BCs=(FixedValue(faces=mesh.getFacesRight(),value=1.),
FixedValue(faces=mesh.getFacesLeft(),value=0.))
eq=TransientTerm()==DiffusionTerm((D,))
for i in range(steps):
var.updateOld()
res = 1.
while res > 1e-2:
res = eq.sweep(var, dt=dt)