Hi All, I am working on this project and find some problems new:
1. Why the source code of function "GridTools::collect_periodic_faces" use " cell_iterator" rather than "active_cell_iterator"? As I need to refine my domain by triangulation.refine_global (7); in 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? And how can I implement my project for refine global (not in parallel)? 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"? 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. Thanks very much! Best, Chucui 在 2018年8月5日星期日 UTC+8下午3:28:01,[email protected]写道: > > 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.
