This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Incompressible NS coupled solver fails to solve the problem with negative inlet velocity

0 votes

Hi,

I use incompressible Navier-Stokes coupled solver solver to solve a problem in a rectangular prism.
The error happens when I set negative inlet velocity instead of possitive.

If I use the folowing bcs and properties:

u_inlet = 1 m/s; p_outlet = 0.0; slip bcs on a wall

then everything works fine, but

if I use the folowing bcs:

u_inlet = -1 m/s; p_outlet = 0.0; slip bcs on a wall

then a solver fails to solve the problem after some time.

To set slip bcs on a wall I use Dirichlet BC.

Propeties are:

nu = 1E-5; pho = 1.0

I have checked everything:
equation, equation parameters, linear algebra solver settings, tried to use both iterative and direct solver, boundary conditions.

Nothing helps.

The solver can't solve equation after some time (about 500 or more iterations).
Hovewer, a relative error raises every iter when I use the negative inlet velocity.

An example of the log with the error:

t = 4.89; iter_ = 489
Solving linear variational problem.
  Solving linear system of size 5378 x 5378 (PETSc Krylov solver).
error_relative_u = 0.00296959487366; error_relative_p = 0.00354750141978
inner_iter = 1; eps = 0.00354750141978
Solving linear system of size 275 x 275 (PETSc Krylov solver).

I write below Navier-Stokes coupled equation.

My fenics/dolfin code you could get by the link.

Sorry, due to the size of the code, I can't post it here due to the limit size of a post.

navier_stokes_coupled.py

# region Define equations.
def epsilon(u):
    """Return the symmetric gradient."""

    return 0.5 * (dolfin.grad(u) + dolfin.grad(u).T)


F = (1 / dt_exp) * dolfin.inner(u - u_1, v_u) * dolfin.dx \
    + dolfin.inner(dolfin.dot(dolfin.grad(u), u_0), v_u) * dolfin.dx \
    + nu_exp * 2.0 * dolfin.inner(epsilon(u), epsilon(v_u)) * dolfin.dx \
    - nu_exp * dolfin.inner(dolfin.grad(u).T * n, v_u) * dolfin.ds(2) \
    - p * dolfin.div(v_u) * dolfin.dx \
    + dolfin.inner(p_outlet_exp * n, v_u) * dolfin.ds(2) \
    + dolfin.div(u) * v_p * dolfin.dx \
    - dolfin.inner(f_exp, v_u) * dolfin.dx
# endregion

I think negative inlet velocity should not crash the solver, because any CFD code could solve the same problem easily.

Any help appreciated!

Thanks in advance!

Regards, Maksim

asked Nov 25, 2015 by Maks FEniCS User (2,430 points)
...