I am trying to run the code below for a level set 1D problem (example in fipy webpage). I am getting this error:
Traceback (most recent call last):
File "C:/Users/sgowda/Documents/pde solver code/level set 1D.py", line 20, in
var.calcDistanceFunction()
File "C:\Users\sgowda\AppData\Local\Continuum\Anaconda\lib\site-packages\fipy\variables\distanceVariable.py", line 335, in calcDistanceFunction
raise Exception, "Neither lsmlib
nor skfmm
can be found on the $PATH"
Exception: Neither lsmlib
nor skfmm
can be found on the $PATH
Could you please let me know how to fix this. i tried looking into the distancefucntion() but im not sure what this error means?
from fipy import Grid1D, CellVariable, TransientTerm, DiffusionTerm, Viewer, DistanceVariable
import matplotlib.pyplot as plt
velocity = 1.
dx = 1.
nx = 10
timeStepDuration = 1.
steps = 2
L = nx * dx
interfacePosition = L / 5.
from fipy.tools import serialComm
mesh = Grid1D(dx=dx, nx=nx, communicator=serialComm)
var = DistanceVariable(name='level set variable',
mesh=mesh,
value=-1.,
hasOld=1)
var.setValue(1., where=mesh.cellCenters[0] > interfacePosition)
var.calcDistanceFunction()
advEqn = TransientTerm() + FirstOrderAdvectionTerm(velocity)
viewer = Viewer(vars=var, datamin=-10., datamax=10.)
viewer.plot()
for step in range(steps):
var.updateOld()
advEqn.solve(var, dt=timeStepDuration)
viewer.plot()
plt.show()
FiPy doesn't have a native level set implementation so uses either LSMLIB or Scikit-fmm to provide the level set / fast marching method functionality.
To see whether you have them installed correctly, use either
$ python -c “import pylsmlib; pylsmlib.test()”
or
$ python -c “import skfmm; skfmm.test()”
to test.
The requirement is outlined in the FiPy documentation, see http://www.ctcms.nist.gov/fipy/INSTALLATION.html#level-set-packages
It is probably easier to install Scikit-fmm initially, see https://pythonhosted.org/scikit-fmm/, but
$ pip install scikit-fmm
should work.