Hello,
since recently I have a problem interpolating functions in nested meshes. The following example code triggers this problem:
from dolfin import *
elem = "CG"
deg = 1
mesh1 = UnitSquareMesh(10, 10)
mesh2 = refine(refine(mesh1))
space1 = FunctionSpace(mesh1, elem, deg)
space2 = FunctionSpace(mesh2, elem, deg)
fun = Function(space1)
interpolate(fun, space2)
This results in:
Traceback (most recent call last):
File "/home/neumann/software/fenics/FEniCS/test.py", line 17, in <module>
interpolate(fun, space2)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/interpolation.py", line 64, in interpolate
Pv.interpolate(v)
RuntimeError:
*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
*** https://answers.launchpad.net/dolfin
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error: Unable to evaluate function at point.
*** Reason: The point is not inside the domain. Consider setting "allow_extrapolation" to allow extrapolation.
*** Where: This error was encountered inside Function.cpp.
*** Process: 0
*** -------------------------------------------------------------------------
Does anybody else have this problem.
parameters['allow_extrapolation'] = True # TODO: Bug Workaround?!?
solves the problem and the results seem to be ok so it might just be a corner case which is triggered. Probibly it has to do with rounding errrors (I have a 64-Bit machine) and was not happening until now. I used this function in this manner for a long time now. So the error was introduced not long ago.
I tested with the Ubuntu Version as well as PPA and PPA-dev.
Thanks,
Jo
My System:
Ubuntu 13.10 64-Bit, 8GB RAM, Intel Core i7