Dear Daniel and Timo,

Thank you very much for your advises. I have figured out  the problem with 
the periodic constraints but I do not know where this problem comes from.
Let me explain the issue more. As I mentioned earlier, I have applied 
periodic BC for displacement field and I want to apply boundary 
displacement as well using constraints.set_inhomogeneit. I mean, 
u(0,y)=u(L,y)+delta_x  for the left and right faces and 
u(x,0)=u(x,L)+delta_y for the bottom and top faces. 

 The following is my periodic constraints and the code for boundary 
displacement. 
//////////////////////////////////////////////////////////////////////////////////
    template <int dim>
    void Solid<dim>::make_constraints(const int &it_nr)
    {
      if (it_nr > 1)
        return;

      constraints.clear();

      const bool apply_dirichlet_bc = (it_nr == 0);
      

       DoFTools::make_periodicity_constraints(dof_handler,
                                                    /*b_id*/ 0,
                                                    /*b_id*/ 1,
                                                    /*direction*/ 0,
                                                    constraints);
       DoFTools::make_periodicity_constraints(dof_handler,
                                                    /*b_id*/ 2,
                                                    /*b_id*/ 3,
                                                    /*direction*/ 1,
                                                    constraints);

            // This block add to the periodicity constraint the boundary 
displacement
           // in x direction for left and right faces and in y direction 
for top and bottom faces


    {
            {
              IndexSet selected_dofs_x;
              std::set< types::boundary_id > boundary_ids_x= 
std::set<types::boundary_id>();
                      boundary_ids_x.insert(0);

              DoFTools::extract_boundary_dofs(dof_handler,
                                                                
fe.component_mask(x_displacement),
selected_dofs_x,
boundary_ids_x);
              unsigned int nb_dofs_face_x = selected_dofs_x.n_elements();
              IndexSet::ElementIterator dofs_x = selected_dofs_x.begin();

             
              for(unsigned int i = 0; i < nb_dofs_face_x; i++)
              {
             constraints.set_inhomogeneity(*dofs_x, (apply_dirichlet_bc ? 
5e-2 : 0.0));
                  dofs_x++;
              }
            }

            {
                IndexSet selected_dofs_y;
                std::set< types::boundary_id > boundary_ids_y= 
std::set<types::boundary_id>();
                        boundary_ids_y.insert(2);

                DoFTools::extract_boundary_dofs(dof_handler,
                                                                
 fe.component_mask(y_displacement),
           selected_dofs_y,
   boundary_ids_y);
                unsigned int nb_dofs_face_y = selected_dofs_y.n_elements();
                IndexSet::ElementIterator dofs_y = selected_dofs_y.begin();

                for(unsigned int i = 0; i < nb_dofs_face_y; i++)
                {

              constraints.set_inhomogeneity(*dofs_y, (apply_dirichlet_bc ? 
-5e-2: 0.0));
                    dofs_y++;
                }
              }
    }


//and here I fix one displacement DoF in every direction .... 
              }
              }

      constraints.close();

    }

//////////////////////////////////////////////////////
I printed the constraint matrix for a domain of just one 2D linear element 
(4 node and 8 DoFs) as follows:                  
                                   
                       4,5___________6,7
                         |                      | 
                         |                      |
                         |                      | 
                         |                      | 
                       0,1__________ 2,3 

when I just apply delta_x:

0 6: 1

0: 0.05

1 7: 1

2 6: 1

3 7: 1

4 6: 1

4: 0.05

5 7: 1


when I just have delta_y:

0 6: 1

1 7: 1

1: -0.1

2 6: 1

3 7: 1

3: -0.05

4 6: 1

5 7: 1

As you can see, the inhomogenity applied on DoF 1 is ironically doubled and 
that's why the corner element get distorted.

I was wondering why despite the identical code 
for constraints.set_inhomogeneity for the x and y direction, I have this 
problem.

Any hint would be appreciated,

Thanks,
Hamed

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to