Thank you so much for the answer Jason, here comes a couple of
followup questions/comments.
> ... I think the magnitude of the
> gradient is noisy in this example because the initial zero level set of phi
> has sharp angles. If you define the initial contour as
>
> phi = 0.5*X**2 + Y**2 -1
My understanding of the FMM was that the distance function was
uniquely determined by the algorithm, given the identification of
nodes inside and outside a boundary. At least, that is how I
understood the chapter on FMM in Sethian's book. If this is not the
case, how do you use the initial values to determine phi, are you
using some kind of front reconstruction scheme to find the position of
the front between inside and outside nodes?
> .... The curvature kappa is
> usually written as div (grad phi/|grad phi|) so maybe normalizing the
> gradient will give better results?
This is the general expression for the curvature; if you evaluate the
expression at a point, it will correspond to the curvature of the
contour of that point. If phi is a solution of the eikonal equation,
we have by definition that |grad phi| = 1, and the above expression
will simplify to the laplacian of phi. I don't think that using the
general expression would improve the results. The unwanted behaviour
is related to that |grad phi| isn't close enough to 1, and I see no
reason why it would reduce the error by introducing an approximation
of |grad phi| in the expression.
Another thing I don't understand is that the code doesn't seem to
converge to the analytical solution as I increase the grid
size/decrease the lattice spacing. Rather, the error takes a finite
value (e.g. max(Q) in my code example). This might be a property of
the scheme. To be able to extract the laplacian of phi, I guess the
numerical scheme has to be accurate to a higher order. This article
http://arxiv.org/abs/1111.6903 suggest an approach, but I don't know
how hard it would be to implement. (btw what exactly is the 'order'
parameter input referring to?)
Also thanks for the suggestions on alternative implementations. I had
some problems getting lsmlib to work properly. I just installed FiPy,
and will give it a try.
If I get the skfmm package to work properly, I would be more than
happy about writing a tutorial example on curvature.
best
jon