No, you were right, I couldn't get the correct results without 'Triangulation::add_periodicity()'.
The current my local environment does not configure deal.ii with MPI and Trilinos as the example step-45, which shows how this function is used. But I guess I can still use the " 'Triangulation::add_periodicity() " function For example, template <int dim> void AdvectionProblem<dim>::create_grid () { double pi = 3.14159265359; const Point<2> end (4*pi,1); const Point<2> start (0.0,0.0); std::vector< unsigned int > repetitions(2); repetitions[0]=5; repetitions[1]=1; GridGenerator::subdivided_hyper_rectangle (triangulation,repetitions, start, end, false); for (typename Triangulation<dim>::active_cell_iterator cell=triangulation.begin_active(); cell!=triangulation.end(); ++cell) { cell->set_refine_flag(RefinementCase<dim>::cut_x); for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f) { // You need this line to ensure that this doesn't affect anything other than bondary faces! if (cell->face(f)->at_boundary() == true) { cell->face(f)->set_boundary_id(0); // Boundary faces static const double tol = 1e-12; if ( std::abs(cell->face(f)->center()[0]-0.0)< tol ) { cell->face(f)->set_boundary_id(5); std::cout << " read boundary 5 " << std::endl; } if ( std::abs(cell->face(f)->center()[0]-4*pi)< tol ) { cell->face(f)->set_boundary_id(6); std::cout << " read boundary 6 " << std::endl; } if ( std::abs(cell->face(f)->center()[1]-0.0)< tol ) { cell->face(f)->set_boundary_id(2); //std::cout << " read boundary 2 " << std::endl; } if ( std::abs(cell->face(f)->center()[1]-1.0)< tol ) { cell->face(f)->set_boundary_id(4); //std::cout << " read boundary 4 " << std::endl; } } } } //original argument std::vector<dealii::GridTools:: PeriodicFacePair<typename DoFHandler<dim>::cell_iterator>> pairs; GridTools::collect_periodic_faces(dof_handler, /*b_id1*/ 6, /*b_id2*/ 5, /*direction*/ 0, pairs); triangulation.add_periodicity(pairs); triangulation.refine_global (3); } However, I got error when I use add_periodicity function which says that no viable conversion from 'vector<PeriodicFacePair<TriaIterator<dealii::internal::DoFHandler::Iterators<dealii::DoFHandler<2, 2>, false>::CellAccessor>>>' to 'const vector<PeriodicFacePair<TriaIterator<CellAccessor<2, 2>>>>' triangulation.add_periodicity(pairs); ^~~~~ candidate constructor not viable: no known conversion from 'std::vector<dealii::GridTools::PeriodicFacePair<typename DoFHandler<2>::cell_iterator> >' (aka 'vector<PeriodicFacePair<TriaIterator<DoFCellAccessor<DoFHandler<2, 2>, false> > > >') to 'const std::__1::vector<dealii::GridTools::PeriodicFacePair<dealii::TriaIterator<dealii::CellAccessor< 2, 2> > >, std::__1::allocator<dealii::GridTools::PeriodicFacePair<dealii::TriaIterator<dealii::CellAccessor< 2, 2> > > > > &' for 1st argument vector(const vector& __x); ^ Do you have any idea how to fix the problem ? Thanks! Best, Jaekwang On Friday, November 9, 2018 at 7:46:02 PM UTC-6, Daniel Arndt wrote: > > Jaekwang, > > It seems that I don't need to add_periodicity to the triangulation unless >> it is parallel distributed triangulation? >> > I would be heavily surprised if you get correct results without calling > Triangulation::add_periodicity() if you are using discontinuous elements > and a serial Triangulation. > Otherwise, you are not providing any kind of information to these objects > that you want to treat specific boundaries as periodic ones. > > >> By the way, when I 'add_periodicity', I have compiler error on the red >>> line of the code. >>> >>> Can you give me a clue to resolve this error? >>> >>> //original argument >>> >>> std::vector<dealii::GridTools:: >>> >>> PeriodicFacePair<typename DoFHandler<dim>::cell_iterator>> >>> pairs; >>> >>> >>> >>> GridTools::collect_periodic_faces(dof_handler, >>> >>> /*b_id1*/ 6, >>> >>> /*b_id2*/ 5, >>> >>> /*direction*/ 0, >>> >>> pairs); >>> >>> >>> >>> triangulation.add_periodicity(pairs); >>> >> You need to call GridTools::collect_periodic_faces with a parameter of > type > > std::vector<dealii::GridTools::PeriodicFacePair<typename > Triangulation<dim>::cell_iterator>> pairs; > > if you want to use the resulting object for > Triangulation::add_periodicity(). > > Best, > Daniel > -- 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.