This maybe raises more questions than it answers, but here is what I think one should do.
Lets assume that at the boundary point p
, the velocity u
is defined as
$$
u(p) = u_1 \phi_k(p) + u_2 \phi_{k+1} (p),
$$
where $$\phi_k = \begin{bmatrix} \phi \\ 0 \end{bmatrix}, \quad \phi_{k+1} = \begin{bmatrix} 0 \\ \phi \end{bmatrix} $$
are corresponding nodal basis functions in the corresponding 2D VectorFunctionSpace
.
Let
$$
n = \begin{bmatrix} n_1 \\ n_2 \end{bmatrix} \quad \text{and} \quad n_\perp = \begin{bmatrix} n_1 \\ -n_2 \end{bmatrix}
$$
be the normal vector and the tangent vector at the boundary at point $p$. Then the TrialFunction
that corresponds to the normal v
component would be
$$
\phi_n = n_1\phi_1 + n_2\phi_2
$$
and
$$
\phi_t = n_1\phi_1 - n_2\phi_2
$$
would correspond to the tangential component.
I'm not sure whether FEniCS
allows for redefinitions of TrialFunctions
or TestFunctions
and a corresponding adaptation of how the DirichletBC
s are treated.
If one exports the assembled operators to matrices, one can now apply, say, normal and tangential boundary conditions at $p$ as follows.
Replace the k
-th column, by $n_1$ times the k
-th plus $n_2$-times the k+1
-st column (this is as if we had $\phi_n$ in the trial space instead of $\phi_k$).
Replace the k+1
-st column, by $n_1$ times the k
-th minus $n_2$-times the k+1
-st column (this is as if we had $\phi_t$ in the trial space instead of $\phi_{k+1}$).
Then the k
-th degree of freedom v_k
can be fixed to the normal component of the boundary condition or the k+1
-st (v_{k+1}
) to the tangential component.
If symmetry is an issue, one can perform the same actions on the columns of the matrices.
The solution in the actual coordinates is then established as $$u(p) = v_kn(p) + v_{k+1}n_\perp (p).$$