Hi,
I try to solve a stationary Navier-Stokes equation here but some how there is an error that Newton solver did not converge because maximum number of iterations reached.
I changed the viscosity from 1.9E-5 to 0.01 but the results is obviously wrong because the boundary condition of inflow and out flow is supposed to be 0.05m/s.
here is my code:
from dolfin import *
mesh = UnitSquareMesh(40,40);
V = VectorFunctionSpace(mesh,"CG",2)
P = FunctionSpace(mesh, "CG", 1)
W = V * P
v, q = TestFunctions(W)
up = Function(W)
u, p = split(up)
f = Constant((0.0, 0.0))
nu = Constant(0.01)
noslip = DirichletBC(V, (0, 0), "on_boundary")
inlet = DirichletBC(V, Constant((0.0,0.05)), "on_boundary && (x[0] < 0.25 && x[1] == 0)")
outlet = DirichletBC(V, Constant((0.0,0.05)), "on_boundary && (x[0] > 0.75 && x[1] == 1)")
bcu = [noslip,inlet,outlet]
F = inner(grad(u)*u, v)*dx + nu*inner(grad(u), grad(v))*dx \
- inner(p, div(v))*dx + inner(q, div(u))*dx + inner(f, v)*dx
solve(F == 0, up, bcu)
plot(u)