← Back to team overview

dolfin team mailing list archive

Re: [Question #155649]: Changing a stokes problem to navier-stokes with a non-linear term

 

Question #155649 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/155649

    Status: Open => Solved

Kyle confirmed that the question is solved:
>From nlPoisson_vp2.py we have, I am trying to do this for navier-stokes
but am unsure how to handle it with a mixed problem:

Gamma_0 = DirichletBC(V, Constant(0.0), left_boundary)
Gamma_1 = DirichletBC(V, Constant(1.0), right_boundary)
bc = [Gamma_0, Gamma_1]

# Choice of nonlinear coefficient
m = 2

def q(u):
    return (1+u)**m

def Dq(u):
    return m*(1+u)**(m-1)

# Define variational problem
v  = TestFunction(V)
du = TrialFunction(V)
u = Function(V)  # the unknown
F = inner(q(u)*grad(u), grad(v))*dx
J = derivative(F, u, du)
# Compute solution
problem = VariationalProblem(J, F, bc, nonlinear=True)
u = problem.solve(u)

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.