Hi Chucui, I’ll try to answer some of your questions quickly:
> 1. Why the source code of function "GridTools::collect_periodic_faces" use > "cell_iterator" rather than "active_cell_iterator”? Because your mesh should be periodic from the coarsest representation all the way down to the finest representation. This is important for very large problems, as deal.II can then exploit the parent-child relationship to find matching DoF pairs rather than traversing the entire fine-scale problem to do the same. > As I need to refine my domain by > triangulation.refine_global (7); > in https://www.mail-archive.com/[email protected]/msg00220.html > <https://www.mail-archive.com/[email protected]/msg00220.html> > I find the same problem, what "Periodic boundaries can only have a difference > of 1 refinement level between pairs of faces." means? Consider a mesh on which boundary with id 0 is considered the periodic match to a boundary with id 1. This means that there are faces that have boundary id 0 that are considered the periodic neighbours to faces with boundary id 1. In the simplest view of things, one might wish to ensure that refinement of cells along boundary 0 is exactly the same as that along boundary 1, and the number of DoFs along boundary 0 exactly matches boundary 1. However, it is possible to implement constraints for “hanging nodes” between boundaries 0 and 1, i.e. the refinement of cells along boundary 0 is not the same as that along boundary 1, and the number of DoFs does not necessarily match either. To accomplish this, the same arguments for normal internal hanging nodes applies, and therefore periodic neighbours can only have 1 level of refinement difference between them. > And how can I implement my project for refine global (not in parallel)? There should be no problem with this. I would suggest looking at step-45 <https://dealii.org/9.0.0/doxygen/deal.II/step_45.html> if you haven’t done so already. > 2. If I use "Triangulation<dim>" rather than > "parallel::distributed::Triangulation<dim>", shall I use the function > "GridTools::collect_periodic_faces"? Or just use only > "DoFTools::make_periodicity_constraints"? I guess that depends on what you’re trying to achieve… Based on your first query with your problem statement, DoFTools::make_periodicity_constraints() should do what you are wanting. > 3. If use "DoFTools::make_periodicity_constraints" only, my code is > template <int dim> > void StokesProblem<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 (); > const unsigned int n_dofs_per_face = fe.dofs_per_face; > FullMatrix<double> rotation_matrix(n_dofs_per_face); > for (unsigned int d=0; d<n_dofs_per_face; ++d) > { > rotation_matrix[d][d]=1.; > } > > > Tensor<1,dim> offset; > 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); > > const typename DoFHandler<dim>::active_face_iterator face_0; > const typename DoFHandler<dim>::active_face_iterator face_1; > const typename DoFHandler<dim>::active_face_iterator face_2; > const typename DoFHandler<dim>::active_face_iterator face_3; > > for (typename DoFHandler<dim>::active_cell_iterator cell = > dof_handler.begin_active(); > cell != dof_handler.end(); > ++cell) > { > > for (unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i) > { > const typename DoFHandler<dim>::active_face_iterator face = > cell->face(i); > > if (face->at_boundary() && face->boundary_id() == 0) > { > const typename DoFHandler<dim>::active_face_iterator face_0 = > face; > } > > else if (face->at_boundary() && face->boundary_id() == 1) > { > const typename DoFHandler<dim>::active_face_iterator face_1 > = face; > } > else if (face->at_boundary() && face->boundary_id() == 2) > { > const typename DoFHandler<dim>::active_face_iterator face_2 = > face; > } > > else if (face->at_boundary() && face->boundary_id() == 3) > { > const typename DoFHandler<dim>::active_face_iterator face_3 > = face; > } > > } > > DoFTools::make_periodicity_constraints (face_0, face_1, > constraints, component_mask, true, false, false, rotation_matrix, > first_vector_components); > DoFTools::make_periodicity_constraints (face_2, face_3, > constraints, component_mask, true, false, false, rotation_matrix, > first_vector_components); > } > [...] > > but get the error: > Linking CXX executable Problem13-2 > /.../13-4-pbc-for-run/together-pbc.cc:647: error: undefined reference to > 'void > dealii::DoFTools::make_periodicity_constraints<dealii::TriaActiveIterator<dealii::DoFAccessor<1, > dealii::DoFHandler<2, 2>, false> > > >(dealii::TriaActiveIterator<dealii::DoFAccessor<1, dealii::DoFHandler<2, 2>, > false> > const&, > dealii::identity<dealii::TriaActiveIterator<dealii::DoFAccessor<1, > dealii::DoFHandler<2, 2>, false> > >::type const&, dealii::ConstraintMatrix&, > dealii::ComponentMask const&, bool, bool, bool, dealii::FullMatrix<double> > const&, std::vector<unsigned int, std::allocator<unsigned int> > const&)' > /.../13-4-pbc-for-run/together-pbc.cc:648: error: undefined reference to > 'void > dealii::DoFTools::make_periodicity_constraints<dealii::TriaActiveIterator<dealii::DoFAccessor<1, > dealii::DoFHandler<2, 2>, false> > > >(dealii::TriaActiveIterator<dealii::DoFAccessor<1, dealii::DoFHandler<2, 2>, > false> > const&, > dealii::identity<dealii::TriaActiveIterator<dealii::DoFAccessor<1, > dealii::DoFHandler<2, 2>, false> > >::type const&, dealii::ConstraintMatrix&, > dealii::ComponentMask const&, bool, bool, bool, dealii::FullMatrix<double> > const&, std::vector<unsigned int, std::allocator<unsigned int> > const&)' > collect2: error: ld returned 1 exit status > make[3]: *** [Problem13-2] Error 1 > make[2]: *** [CMakeFiles/Problem13-2.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. I don’t feel too inclined to look into this in any detail, but it could be that DoFTools::make_periodicity_constraints() <https://github.com/dealii/dealii/blob/master/source/dofs/dof_tools_constraints.cc#L2310> is only instantiated for a dealii::TriaIterator <https://github.com/dealii/dealii/blob/master/source/dofs/dof_tools_constraints.inst.in#L49> rather than a dealii::TriaActiveIterator. I guess that you would need to pass it a typename DoFHandler<dim>::face_iterator. I hope that I’ve been able to give you a little useful insight into what you’ve asked here. Best, Jean-Paul -- 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.
