Hello all,
I designed a coupled Laplace problem to play with ConstraintMatrix for coupled components. On face \Gamma_4 and \Gamma_2, I let u=0.5v-0.5, v=2u+1, respectively .

Both u and v use the same finite element: FE_Q<dim>(1), 1, and 'block_component (2, 0)' is used to store the relevant scalar values.
Below is the pieces of incompleted codes for my trying to identify pairs of DoFs that are coupled and correspond to u and v components.
However, this part doesn't work.
Could you kindly help me check some lines? Thanks!
for (const auto &cell : dof_handler.active_cell_iterators())
{
for (unsigned int face_number = 0; face_number < GeometryInfo<dim>::faces_per_cell; ++face_number)
{
if (cell->face(face_number)->at_boundary() &&
( cell->face(face_number)->boundary_id() == 4 ) )
{
std::vector<unsigned int> local_face_dof_indices (fe.dofs_per_face);
//unsigned int n_nodes=fe.dofs_per_face/2.0;//n_node=1 dofs=u,v
{
cell->face(face_number)->get_dof_indices (local_face_dof_indices);
std::vector<unsigned int> u_i(fe.dofs_per_face),v_i(fe.dofs_per_face);
unsigned int component;
{
for (unsigned int i=0; i<local_face_dof_indices.size(); ++i)
{
component=fe.face_system_to_component_index(i).first;
if(component==0)
{
u_i[i]=local_face_dof_indices[i];
}
else
{
v_i[i]=local_face_dof_indices[i];
}
constraints.add_line(u_i[i]);
constraints.add_line(v_i[i]);
constraints.add_entry(u_i[i],v_i[i],0.5);
constraints.set_inhomogeneity(u_i[i],-0.5);
Lex