You can do something like: assemble_local(form, cell)
to get the local stiffness corresponding to cell
. For e.g.,
from dolfin import *
# check for a trivial case of a mesh comprised of two elements
mesh = UnitSquareMesh(1, 1)
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
for i, cell in enumerate(cells(mesh)):
if i==1: # for the second element
A = assemble_local(inner(grad(u), grad(v)) *dx, cell) # A is the local stiffness
I have personally never done this, but it is easily verifiable by a simple hand calculation.