Dear all,
In this example on how to solve the Navier Stokes equations with Fenics, an integration by parts leads to boundary terms, see the fourth and fifth term in the left-hand side of Eq. (3.33).
Now consider, in the same webpage, section “Test problem 1: Channel flow”.
As specified here, “the test function \nu is required to vanish on the parts of the boundary where the solution u is known”. In this test problem, the solution u is known on the walls, where it vanishes:
It follows that \nu must vanish on the walls, and only some parts of those boundary terms are nonzero. However, I don’t see how this is implemented in the code: the boundary terms are set in
# Define variational problem for step 1
F1 = [...] + dot(p_n*n, v)*ds - dot(mu*nabla_grad(U)*n, v)*ds
Where is it specified that these terms vanish if ds lies on the walls ?
The initial step of constructing your finite element matrix with FEniCS is assembling the bilinear formulation. Once this is complete Dirichlet boundary conditions may be imposed “strongly” (as opposed to “weakly” where Dirichlet boundary conditions may be enforced as a component of the formulation itself, cf. Nitsche’s method). The imposition of Dirichlet boundary conditions in this fashion modifies the underlying matrix. The rows and columns corresponding to the degrees of freedom associated with the BCs will be altered such that the numerical approximation is strongly enforced to be equivalent to the prescribed boundary data. Doing this modification “overwrites” the weak formulation at these degrees of freedom. This is why you don’t need to carefully account for all boundaries in the UFL (FEniCS) formulation of the Navier Stokes problem you’ve cited.
I can see how this could be confusing as the mathematics of the formulation doesn’t follow intuitively from the UFL. However, this short hand is popular. If you were to correctly curate all the exterior boundary components for the natural boundary condition, you should see an equivalent numerical approximation.
This is still quite unclear. In this problem, the boundary term is set to zero : “In the present problem, this means that \nu = 0 on the whole boundary ∂Ω. The second term on the right-hand side of (5) therefore vanishes.”
On the other hand, in this problem the boundary term is not set to zero. One difference between the two problems is that in the former u is set on the whole boundary, on the latter it is set only on part of the boundary. Is this the reason why there is this difference?
In a general problem where the velocity field u is fixed on all the boundaries, may I set the terms
F1 = [...] + dot(p_n*n, v)*ds - dot(mu*nabla_grad(U)*n, v)*ds