The Problem of Dirichlet Boundary Conditions for a Certain Component in H (curl)

Hi everyone!
I attempt to give a Dirichlet boundary condition on a component of a vector field in a subspace of mixed finite elements.
I have reading (https://github.com/FEniCS/dolfinx/blob/main/python/test/unit/fem/test_bcs.py#L172-L202)
But When I use A_boundary.sub(0).collapse() to obtain the first component of A.Will report an error.

import numpy as np
import ufl
from dolfinx import cpp as _cpp
from dolfinx import fem
from dolfinx.fem import (Constant, Function, FunctionSpace, dirichletbc,
                         extract_function_spaces, form,
                         locate_dofs_geometrical, locate_dofs_topological)
from dolfinx.io import XDMFFile
from dolfinx.mesh import (CellType, GhostMode, create_rectangle,
                          locate_entities_boundary,create_unit_cube)
from ufl import div, dx, grad, inner,dot,outer,ds,dS,avg,jump,rot,cross
from mpi4py import MPI
from petsc4py import PETSc
from petsc4py import PETSc as _PETSc

# Create mesh
msh = create_unit_cube(MPI.COMM_WORLD,
                       1,1,1,
                       CellType.tetrahedron, GhostMode.none)

u_element=ufl.VectorElement("DG", ufl.tetrahedron, 1)     # H(div)         Vh
A_element=ufl.FiniteElement("N1curl",ufl.tetrahedron,1)   # H(curl)            Ch
P_element=ufl.FiniteElement("DG",ufl.tetrahedron,0)       #                         Qh
TH= ufl.MixedElement([u_element, A_element,P_element])
W =fem.FunctionSpace(msh,TH)
W0,_=W.sub(0).collapse()
W1,_=W.sub(1).collapse()
W2,_=W.sub(2).collapse()

Dh=fem.FunctionSpace(msh,A_element)
A_boundary = Function(W1)
A_boundary.sub(0).collapse()

Where A is a vector.
If I use A_element=ufl.VectorElement("N1curl",ufl.tetrahedron,1) I will obtain a tensor function space.
How can I attach a Dirichlet boundary condition of 0 to the first component of A.
Many thanks .

The N1curl element basis is vector valued. The DoFs are integral moments and not subcomponents of a vector space. See, e.g., DefElement: Nédélec (first kind).

A VectorElement("N1curl", ...) is a tensor product of N1curl elements on the geometry. This yields the tensor function space.

1 Like

Thanks nate!
So in this case, I cannot directly apply the Dirichlet boundary condition to a certain component of the vector in H (curl).Is that right?

You cant. You can enforce a given tangential component though: DefElement
as each dof is a scalar value controlling the tangential vector over a given Edge.

1 Like

I am sorry dokken.I don’t understand your solution. Can you elaborate on it.
What you mean is that I can only have tangential constraints, not component constraints?

Hello @wanghao

The FEM approximation of a vector-valued function u in H(curl) is an expansion in the global basis given as

u\approx \sum_i ^N \underbrace{\psi_i(u)}_{\equiv u_i} \phi_i(x)

The basis functions \phi_i of Nedelc elements can be calculated (usually based on a condition that looks something like this: \delta_{ij} = \psi_i(\phi_j)) and are vector-valued and are quite “simple”/built from elementary functions. The basis functions look like visualized here: DefElement .

The functional \psi_i for the first Nedelec element is a curve integral over element edge E_i:

\psi_i(u) \equiv \int_{E_i} u ds

The value of this integral is what we solve for in FEM, which is why we give it a simpler name: u_i. It is the scalar valued coefficient used in the definition of the interpolation/expansion that i have written above. It is also the degree of freedom (=“DOF”) associated with the element edge E_i.

If you prescribe (Dirichlet) boundary conditions on a Nedelec FEM space, you basically fix the value of the u_i for all i that are on the boundary. This means, you fix the value of the coefficient in front of the basis function \phi_i associated to E_i.

When you say

I cannot directly apply the Dirichlet boundary condition to a certain component of the vector in H (curl).Is that right?

Then you are right. You can only apply Dirichlet BC to all scalar expansion coefficients/DOFs/unkowns u_i, that are associated with a boundary DOF/boundary element edge. You can not prescribe boundary conditions for a vector component, as the unkowns u_i of a FEM problem are scalars (scalar expansion coefficients).

Does this answer your question?

2 Likes

Thanks renol ! Helped me a lot!