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)