Hello, I have started using FiPy to do 3D phase-field simulations, and have encountered some warning messages when I use tensor coefficients in the DiffusionTerm. Here is a simple test code using the identity matrix for the coefficient:
----------------------------------------------------------------------------------------------------------------- #!/usr/bin/python from fipy import * L = 1.0 n = 10 d = L / n mesh = Grid3D(dx=d, dy=d, dz=d, nx=n, ny=n, nz=n) x = mesh.cellCenters[0] y = mesh.cellCenters[1] z = mesh.cellCenters[2] u = CellVariable(name="u", mesh=mesh) u.setValue(0.0) radius = 0.25 center = (0.5 * L, 0.5 * L, 0.5 * L) u.setValue(1.0, where=((x - center[0])**2 + (y - center[1])**2 + (z - center[2])**2 < radius**2)) u.constrain(0.0, mesh.facesLeft) u.constrain(0.0, mesh.facesRight) u.constrain(0.0, mesh.facesTop) u.constrain(0.0, mesh.facesBottom) u.constrain(0.0, mesh.facesFront) u.constrain(0.0, mesh.facesBack) G = numerix.array(((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0))) eq = TransientTerm(var = u) == DiffusionTerm(coeff = G, var = u) for i in range(3): print i eq.solve(var = u, dt = 0.01) ----------------------------------------------------------------------------------------------------------------------------------- The output from the code is ----------------------------------------------------------------------------------------------------------------------------------- 0 /home/wd15/.virtualenvs/default/lib/python2.7/dist-packages/fipy/variables/variable.py:1165: RuntimeWarning: invalid value encountered in divide return self._BinaryOperatorVariable(lambda a,b: a/b, other) /home/wd15/.virtualenvs/default/lib/python2.7/dist-packages/fipy/variables/variable.py:1165: RuntimeWarning: divide by zero encountered in divide return self._BinaryOperatorVariable(lambda a,b: a/b, other) 1 2 ----------------------------------------------------------------------------------------------------------------------------------- >From the output, you can see that the warnings occur only in the first step of >the solution. I ran a similar 2D version of the above code, and it does not >produce any warnings. I am running this on Ubuntu 12.04 and installed FiPy >using the "Ubuntu / Debian Installation" instructions from the FiPy manual. I found that someone reported this problem in 2008 for a similar code, and it seems that the conclusion reached was that the warning is probably not an issue. I solved some 3D PDEs with tensor coefficients using Mathematica and compared the results to FiPy output and the results are consistent. For these test problems the warnings do not seem to matter, but I wonder about more complicated cases. Have any problems with this been found since 2008? Thanks, Mike Fellinger
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
