Hi. I'm solving a PDE with a Neumann boundary value that is a scalar product of a function with the normal to the boundary facets. Because I get faulty results, I'm trying to debug my code. My first step is to plot FacetNormal(mesh), but I'm not succeeding.
from dolfin import *
mesh = UnitSquareMesh(5,5)
bmesh = BoundaryMesh(mesh, 'exterior')
f = Expression(('x[0]','x[1]'))
n = FacetNormal(mesh)
# works
File('f.pvd') << project(f, VectorFunctionSpace(bmesh, 'Lagrange', 1))
# error in instant compilation, see below
File('n.pvd') << project(n, VectorFunctionSpace(bmesh, 'Lagrange', 1))
[...]
‘n1’ was not declared in this scope
A[j] += (FE0_C1[0][j]n1 + FE0_C0[0][j]n0)W1det;
[...]
‘n0’ was not declared in this scope
A[j] += (FE0_C1[0][j]n1 + FE0_C0[0][j]n0)W1det;
I expect that I'm missing something obvious. Thanks for your help!