This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Poisson adaptive in 3D, runtime error

0 votes

the adaptive Poisson solver below works on a 2D domain but gives an runtime error in 3D:
Can anyone help with it? The (condensed) code follows below.

Traceback (most recent call last):
File "poisson3d.py", line 34, in
solve(a == L, u, bc, tol=0.1, M=M) ...

*** 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

generated by the python script in FEniCS 1.2.0 on OSX 10.8

from dolfin import *

# build mesh and define function space
quader = Box(0, 0, 0, 10, 2, 1)
obstracle = Box(4, 0, 0, 5, 1, 1)
mesh = Mesh(quader - obstracle, 20)

V = FunctionSpace(mesh, "Lagrange", 1)

# set Dirichlet boundary
def boundary(x, on_boundary):
    return on_boundary and ( near(x[1], 0.0) )
bc = DirichletBC(V, Constant(0.0), boundary)

# define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Expression('-2*(x[0]-1)')
a = inner(grad(u), grad(v))*dx
L = f*v*dx

# compute solution and plot
u = Function(V)
solve(a == L, u, bc)
plot(u); interactive()

# adaptive solve
M = u*ds
solve(a == L, u, bc, tol=0.1, M=M)
asked Dec 20, 2013 by achim FEniCS Novice (260 points)
edited Dec 20, 2013 by achim

Please format you code (indent the text to get code formatting) and report the verison of DOLFIN you are using.

1 Answer

+2 votes

The error message says: "Consider setting "allow_extrapolation" to allow extrapolation". "allow_extrapolation" is a parameter, so try:

from dolfin import *
parameters["allow_extrapolation"] = True
answered Jan 13, 2014 by Marie E. Rognes FEniCS User (5,380 points)

this solved my problem. thank you.

...