I have an Expression
. I generate this expression by sub-classing. I'd like to plot it's inner product with the unit normal. This value only makes sense on the boundary. How do I plot it?
Here's a minimal example.
from dolfin import *
mesh_obj = UnitSquareMesh( 8, 8 )
normal = FacetNormal( mesh_obj )
V = FunctionSpace ( mesh_obj, "CG", 1 )
u = TrialFunction ( V )
v = TestFunction ( V )
f = Constant( 2.0 )
# Define a vector valued Expression.
# The expression I'm using is more complicated.
beta = Expression( ('x[0]', 'x[1]') )
# This is the linear form I want to evaluate. In order
# to test it, i'd like to visualize the boundary function
# in the last term.
a = inner(grad(u), grad(v))*dx + u*v*dx + inner( beta, normal )*u*v*ds
L = f*v*dx
# You guys know better than me what this does.
A = assemble(a)
b = assemble(L)
# Solve the linear system for u.
sol = Function( V )
solve(A, sol.vector(), b, 'lu')
# Plot the solution.
plot ( sol, interactive = True )
So, how do I plot inner(beta,normal)
? This arises from using Robin boundary condition, in case someone was wondering.