I have probably a very stupid problem. I can't solve a simple Poiseuille flow in a straight 2-D channel driven by a pressure drop. Results are complete nonsense. (Setting zero pressure on the outflow gives trivial solution/no flow. Taking pressure on the outflow non-zero (but still having some pressure drop) gives a solution flowing in to the channel from both ends). Also satisfying of the incompressibility is very vague. Could you, please, look at my code? I have no idea what I am doing wrong.
Marek
from dolfin import *
mesh = Mesh("P.xml")
V = VectorFunctionSpace(mesh,"CG",2)
Q = FunctionSpace(mesh,"CG",1)
W = V*Q
w = Function(W)
nu = 100
L = 20
noslip = DirichletBC(W.sub(0),(0,0),"on_boundary && (x[1] > 4.0 - DOLFIN_EPS | x[1] < DOLFIN_EPS)")
inflow = DirichletBC(W.sub(1),10,"on_boundary && x[0] < DOLFIN_EPS")
outflow = DirichletBC(W.sub(1),2,"on_boundary && x[0] > L - DOLFIN_EPS")
bcs = [noslip,inflow,outflow]
(u,p) = TrialFunctions(W)
(v,q) = TestFunctions(W)
f = Constant((0,0))
a = nu*inner(grad(u),grad(v))*dx + p*div(v)*dx + div(u)*q*dx
L = inner(f,v)*dx
problem = LinearVariationalProblem(a,L,w,bcs=bcs)
solver = LinearVariationalSolver(problem)
solver.solve()
(u,p) = split(w)
plot(p)
plot(div(u))
plot(u)
interactive()