Hi All,

I am having a problem of implementing periodic boundary condition, I have 4 
variables to solve, and I make them into a blockvector:

<https://lh3.googleusercontent.com/-jmzkpCuUrkk/W2akwJYUMZI/AAAAAAAAAFA/3EiAArcLnhsdgG_JqiELCuDUj8mcf2RxgCLcBGAs/s1600/41.JPG>

each component of it is a scalar. All of them have periodic boundary 
condition: 

<https://lh3.googleusercontent.com/-6PfzVlYgEU8/W2amBarR40I/AAAAAAAAAFM/YaaoluYI27gEOCr_HZ1SgXdOM7ugnk7BQCLcBGAs/s1600/42.JPG>

on domain:

<https://lh3.googleusercontent.com/-4pByA83BmH4/W2amZDpVxDI/AAAAAAAAAFU/bupKGz4Io4gvt90cOPXatjcodVJhy6WOQCLcBGAs/s1600/43.JPG>

and my code is:
  template <int dim>
  void Problem<dim>::setup_dofs ()
  {
    
    std::vector<unsigned int> block_component (4);
    block_component[0] = 0;
    block_component[1] = 1; 
    block_component[2] = 2;
    block_component[3] = 3;
    
    
    dof_handler.distribute_dofs (fe);
    //DoFRenumbering::component_wise (dof_handler);
    DoFRenumbering::component_wise (dof_handler, block_component);
    
     
      constraints.clear ();
      
      FullMatrix<double> rotation_matrix(dim);
      rotation_matrix[0][0]=1.;
      rotation_matrix[1][1]=1.;

      Tensor<1,dim> offset;

      std::vector<GridTools::PeriodicFacePair<typename 
DoFHandler<dim>::cell_iterator> >
      periodicity_vector;

    const unsigned int direction = 0;

           const ComponentMask component_mask = ComponentMask();
           
           std::vector<unsigned int> first_vector_components;
           first_vector_components.push_back(0);
           first_vector_components.push_back(1);
           first_vector_components.push_back(2);
           first_vector_components.push_back(3);
           
           GridTools::collect_periodic_faces(dof_handler,
                                  /*b_id1*/ 0,
                                  /*b_id2*/ 1,
                                  /*direction*/ 0,
                                  periodicity_vector);
           GridTools::collect_periodic_faces(dof_handler,
                                  /*b_id1*/ 2,
                                  /*b_id2*/ 3,
                                  /*direction*/ 0,
                                  periodicity_vector);
           DoFTools::make_periodicity_constraints<DoFHandler<dim> >
      (periodicity_vector, constraints);

    constraints.close ();    
    
[...]  

  template <int dim>
  void Problem<dim>::run ()
  {
   
        const unsigned int n_cycles = 1;

      for (unsigned int cycle=0; cycle<n_cycles; ++cycle)
      {
        if (cycle == 0)
          {
            GridGenerator::hyper_cube (triangulation, 0, 2.25);
            
            triangulation.refine_global (7);

            for (typename Triangulation<dim>::active_cell_iterator
                cell = triangulation.begin_active();
                cell != triangulation.end();
                ++cell)
                for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; 
++f)
                   if (cell->face(f)->at_boundary())

                          if (std::fabs(cell->face(f)->center()(0) - 
(2.25)) < 1e-12)
                          cell->face(f)->set_boundary_id (1);
                          else if(std::fabs(cell->face(f)->center()(1) - 
(0)) < 1e-12)
                               cell->face(f)->set_boundary_id (2);
                                else 
if(std::fabs(cell->face(f)->center()(1) - (2.25)) < 1e-12)
                                     cell->face(f)->set_boundary_id (3);
                                     else 
if(std::fabs(cell->face(f)->center()(0) - (0)) < 1e-12)
                                          cell->face(f)->set_boundary_id 
(0);

           std::vector<
           GridTools::PeriodicFacePair<typename 
DoFHandler<dim>::cell_iterator>>
           periodicity_vector;
            FullMatrix<double> rotation_matrix(dim);
            rotation_matrix[0][0]=1.;
            rotation_matrix[1][1]=1.;
           
           const ComponentMask component_mask = ComponentMask();
           
           std::vector<unsigned int> first_vector_components;
           first_vector_components.push_back(0);
           first_vector_components.push_back(1);
           first_vector_components.push_back(2);
           first_vector_components.push_back(3);
                      GridTools::collect_periodic_faces(dof_handler,
                                  /*b_id1*/ 0,
                                  /*b_id2*/ 1,
                                  /*direction*/ 0,
                                  periodicity_vector);
          GridTools::collect_periodic_faces(dof_handler,
                                  /*b_id1*/ 2,
                                  /*b_id2*/ 3,
                                  /*direction*/ 0,
                                  periodicity_vector); 
           DoFTools::make_periodicity_constraints<DoFHandler<dim> >
      (periodicity_vector, constraints);
 }
        }
        
        setup_dofs ();
[...]
but when make run it, got the following error:
An error occurred in line <3751> of file 
<.../boost/deal.ii-8.5.1/src/source/grid/grid_tools.cc> in function
    void dealii::GridTools::collect_periodic_faces(const MeshType&, 
dealii::types::boundary_id, dealii::types::boundary_id, int, 
std::vector<dealii::GridTools::PeriodicFacePair<typename 
MeshType::cell_iterator> >&, const dealii::Tensor<1, MeshType:: 
space_dimension>&, const dealii::FullMatrix<double>&) [with MeshType = 
dealii::DoFHandler<2>; dealii::types::boundary_id = unsigned char; typename 
MeshType::cell_iterator = 
dealii::TriaIterator<dealii::DoFCellAccessor<dealii::DoFHandler<2>, false> 
>]
The violated condition was: 
    pairs1.size() == pairs2.size()
Additional information: 
    Unmatched faces on periodic boundaries

Stacktrace:
-----------
#0  .../boost/deal.ii-8.5.1/deal.II/lib/libdeal_II.g.so.8.5.1: void 
dealii::GridTools::collect_periodic_faces<dealii::DoFHandler<2, 2> 
>(dealii::DoFHandler<2, 2> const&, unsigned char, unsigned char, int, 
std::vector<dealii::GridTools::PeriodicFacePair<dealii::DoFHandler<2, 
2>::cell_iterator>, 
std::allocator<dealii::GridTools::PeriodicFacePair<dealii::DoFHandler<2, 
2>::cell_iterator> > >&, dealii::Tensor<1, dealii::DoFHandler<2, 
2>::space_dimension, double> const&, dealii::FullMatrix<double> const&)
#1  ./Problem13-2: Step22::StokesProblem<2>::run()
#2  ./Problem13-2: main
--------------------------------------------------------

make[3]: *** [CMakeFiles/run] Aborted (core dumped)
make[2]: *** [CMakeFiles/run.dir/all] Error 2
make[1]: *** [CMakeFiles/run.dir/rule] Error 2
make: *** [run] Error 2


I wander what is the reason for this issue, and I don't need to implement 
it in parallel. 

Thanks in advance.

Chucui

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to