Skip to content

Instantly share code, notes, and snippets.

@funsim
Created September 26, 2014 10:51
Show Gist options
  • Save funsim/b4a31d858c4837648914 to your computer and use it in GitHub Desktop.
Save funsim/b4a31d858c4837648914 to your computer and use it in GitHub Desktop.
from dolfin import *
mesh = UnitSquareMesh(2, 2)
V = VectorFunctionSpace(mesh, "DG", 0)
P = FunctionSpace(mesh, "DG", 0)
W = V*P
f = interpolate(Expression(("x[0]", "x[1]", "x[0]*x[1]")), W)
pvd_p = File("out_p.pvd")
pvd_u = File("out_u.pvd")
pvd_p << f.sub(1)
pvd_u << f.sub(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment