Boundary conditions on Navier Stokes Fenics example

Hello,
In Section ’ Test problem 1: Channel flow’ of this Fenics example, it is shown how to obtain Poiseille flow with fenics.

It is not clear to me how the boundary conditions (BCs) are implemented. The PDEs are Navier Stokes equations (2nd order in the velocity \bf u and first order in the pressure p) defined on a rectangle \Omega. It follows that one correct set of BCs is the following:

  • fix both components \bf u on \partial \Omega, (1)
  • fix p on the outflow, \partial \Omega_{\rm out}. (2)

Other BCs which come down to the same number of constraints are also valid.

However, it is unclear how these have been implemented in the example: in the variational problem for step 1, it seems that only bcu = [bcu_noslip] have been fixed for \bf u, plus the BC n^i \partial_i U_j=0 implemented as a natural BC on some part of \partial \Omega (unclear). Also, it is unclear what BCs are implemented for \bf u at the inflow, if any.

May you please show me explicitly what are the BCs implemented in the example, and show me that they are equivalent, in terms of number of constraints, to (1) and (2)?

Thank you !

I attach here an image of the code in the test problem you are referring to where the BC objects are created:

The boundary condition bcu_noslip constrains the velocity vector to be the zero vector at the boundaries define by walls, i.e. \mathbf{u}=\mathbf{0} on the walls y=0 and y=1.
The boundary conditions bcp_inflow and bcp_outflow set, respectively, the pressure p=8 at x=0 and p=0 at x=1.

What might be confusing is that the tutorial for the test problem only shows what is done for the first of the three steps of the splitting scheme. There, the velocity BC bcu is applied because one solves for the velocity. The boundary conditions for the pressure (bcp_inflow and bcp_outflow) would be applied in the second step of the solver, which would be a solve for the pressure, since a pressure-correction splitting scheme is discussed.

If you download the full code ft07_navier_stokes_channel.py which is linked to in the tutorial, you will find this in the solver loop:

    # Step 2: Pressure correction step
    b2 = assemble(L2)
    [bc.apply(b2) for bc in bcp]
    solve(A2, p_.vector(), b2)

where the pressure BCs are set.

I would recommend downloading that code and playing around with it to gain further understanding. Hope this helps!:slight_smile:

Kind regards,
Halvor

Thank you for your reply. I know the meaning of bcu and bcp in that code, but that does not answer my question. In fact, some other BCs appear to have been imposed as natural BCs. I would like to clearly understand which ones, and to see that the total number of imposed BCs matches the number of BCs appropriate for a PDE of second order in the velocity and first order in the pressure (see the OP). :slight_smile:

Ah, apologies, I must have misinterpreted your question. Yes, for the type of ICPS splitting-scheme considered in the example you linked to, I think it is standard to consider a homogeneous Neumann BC (natural BC) for p on the boundaries where \mathbf{u} is set strongly. Furthermore, the velocity on the inlet and the outlet is specified weakly by only including the term \mu(\nabla\mathbf{u})^T\mathbf{n} from the symmetric gradient in the stress boundary integral, meaning that \mu(\nabla\mathbf{u})\mathbf{n}=\mathbf{0} has been imposed. To clarify, originally the weak form would include the boundary integral

-\int_{\Gamma}\sigma\mathbf{n}\cdot\mathbf{v}\, ds = -\int_{\Gamma}(\mu(\nabla\mathbf{u} + (\nabla\mathbf{u})^T) - p\mathbf{I})\mathbf{n}\cdot\mathbf{v}\, ds

and in the weak formulation in the code only

-\int_{\Gamma}(\mu(\nabla\mathbf{u})^T - p\mathbf{I})\mathbf{n}\cdot\mathbf{v}\, ds

is included in the weak form, so the \nabla\mathbf{u} term has been dropped.

So to summarize: on the walls \mathbf{u}=\mathbf{0} and a homogeneous Neumann BC on p is imposed. On the inlet and outlet, p is set strongly and \mathbf{u} is handled weakly.

Let me know if this is of help!

Best,
Halvor