Skip to content

Instantly share code, notes, and snippets.

@wence-
Created May 8, 2015 16:13
Show Gist options
  • Select an option

  • Save wence-/f26a73724e46181a345e to your computer and use it in GitHub Desktop.

Select an option

Save wence-/f26a73724e46181a345e to your computer and use it in GitHub Desktop.
from firedrake import *
mesh = UnitTriangleMesh()
V = FunctionSpace(mesh, 'RT', 1)
u = TrialFunction(V)
v = TestFunction(V)
n = FacetNormal(mesh)
mu = Constant(1.0)
muM = as_tensor([[mu, 0], [0, mu]])
a = mu*(-inner(outer(v,n),grad(u)) -inner(outer(u,n),grad(v)))*ds
b = (-inner(outer(v, n), dot(grad(u), muM)) - inner(outer(u, n), dot(grad(v), muM)))*ds
print "b"
print assemble(b).M.values
print "a"
print assemble(a).M.values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment