Debug to identify pairs of DoFs that are co-lated and correspond to the components.

14 views
Skip to first unread message

Lex Lee

unread,
Apr 5, 2020, 7:28:28 PM4/5/20
to deal.II User Group

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 .    

 


Screen Shot 2020-04-05 at 4.14.41 PM.png

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

Wolfgang Bangerth

unread,
Apr 7, 2020, 12:08:48 AM4/7/20
to dea...@googlegroups.com

> constraints.add_line(u_i[i]);
>
> constraints.add_line(v_i[i]);

You can only set a constraint for one of the two. Given the next line, I think
you want to set the constraint for u_i[i], but not v_i[i].


> constraints.add_entry(u_i[i],v_i[i],0.5);
>
> constraints.set_inhomogeneity(u_i[i],-0.5);

These two lines then look correct.

Does that make sense?

Best
WB

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages