from dolfin import *
Discretization parameters
family = 'Lagrange'
shape = 'triangle'
vel_order = 2
pres_order = 1
eta = Constant(shape)
h_num = 32
mesh
mesh = UnitSquareMesh(h_num, h_num, "crossed")
Define function spaces
V = VectorFunctionSpace(mesh, family, vel_order)
Q = FunctionSpace(mesh, family, pres_order)
W = MixedFunctionSpace([V, Q])
T = FunctionSpace(mesh, family, vel_order)
Test and Trial functions
(u, p) = TrialFunctions(W)
(v, q) = TestFunctions(W)
Equation parameters
z = Function(T)
f = Function(V)
a = (etainner(grad(v), grad(u)) - div(v)p - qdiv(u) + zv[1]u[0] - zv[0]u[1])dx
L = inner(v, f)*dx
w = Function(W)
solve(a == L, w)
(u, p) = w.split()
plot(u)
plot(p)
plot(mesh)
interactive()