DOLFIN can't find point inside mesh

Asked by Torbjørn Bækø Ness

Hi,

I'm trying to solve Poisson's equation with a variable conductivity, sigma, and I'm overriding the "eval" function of Expression to
do so. For some reason the interpolated "sigma" can't return values at seemingly random points inside the domain.
A minimal working script is given bellow as well as the error messages I get with and without extrapolation.

Is there any way around this problem?

Error with "parameters['allow_extrapolation'] = False":

Evaluating at x = <Point x = 0.233 y = 0.638 z = 0.039>
Traceback (most recent call last):
  File "minimal_debug.py", line 26, in <module>
    print sigma(0.233, 0.638, 0.039)
  File "/usr/lib/python2.7/dist-packages/dolfin/functions/function.py", line 382, in __call__
    self.eval(values, x)
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
*** -------------------------------------------------------------------------

Error with "parameters['allow_extrapolation'] = True":

Traceback (most recent call last):
  File "minimal_debug.py", line 27, in <module>
    print sigma(0.233, 0.638, 0.039)
  File "/usr/lib/python2.7/dist-packages/dolfin/functions/function.py", line 382, in __call__
    self.eval(values, x)
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 perform call to DOLFIN function.
*** Reason: The function compute has not been implemented (in /build/buildd/dolfin-1.2.0+dfsg/dolfin/intersection/IntersectionOperatorImplementation.h line 302).
*** Where: This error was encountered inside log.h.
*** Process: 0
*** -------------------------------------------------------------------------

from dolfin import *

class DebugConductivity(Expression):
    """ This inherits from ConductivityClass and contains the specific
    conductivity of the control set-up"""

    def eval(self, value, x):
        """ This function is written like this so I can use return_conductivity() outside the class for
        debugging reasons """
        value[0] = 1

parameters['allow_extrapolation'] = True
N = 25
mesh = BoxMesh(0, 1, 0, 1, 0, 1, N, N, N)

V = FunctionSpace(mesh, "CG", 2)
Vs = FunctionSpace(mesh, "DG", 0) # For conductivity tensor
sigma = Function(Vs)

Cond = DebugConductivity()
sigma.interpolate(Cond)

Cheers,
Torbjørn

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Torbjørn Bækø Ness
Solved:
Last query:
Last reply:
Revision history for this message
Torbjørn Bækø Ness (torbjorn-ness) said :
#1

Additional info:
To actually get the error, you need to add the line
print sigma(0.233, 0.638, 0.039)

I did not encounter these problems when I wrote my code some time
earlier this fall. I'm now using FEniCS version 1.2.0., but I'm not
entirely sure when my code stopped working.

Revision history for this message
Torbjørn Bækø Ness (torbjorn-ness) said :
#2