I am sorry about this post, it was a bug in my code.

I was doing this

MeshWorker::mesh_loop(
  dof_handler.begin_active(),
  dof_handler.end(),
  cell_assembler,
  std::bind(&CGSEM<dim>::copy_local_to_global,this,std::placeholders::_1),
  scratch_data,
  task_data,
  MeshWorker::assemble_own_cells);

which was calling copier on all cells. Using a filtered range on locally owned 
cells fixed the problem.

Thanks
praveen


> On 4 May 2024, at 12:33 PM, Praveen C <[email protected]> wrote:
> 
> Hello
> 
> In a 2d problem with all periodic bc, I was able to use WorkStream for 
> assembly.
> 
> But when I switch to MeshWorker, I get error about constraints (when running 
> in parallel, serial is ok)
> 
> An error occurred in line <2248> of file 
> </Users/praveen/Applications/deal.II/9.5.1/install/include/deal.II/lac/affine_constraints.h>
>  in function
>     types::global_dof_index 
> dealii::AffineConstraints<>::calculate_line_index(const size_type) const 
> [number = double]
> The violated condition was: 
>     local_lines.is_element(line_n)
> Additional information: 
>     The index set given to this constraints object indicates constraints
>     for degree of freedom 0 should not be stored by this object, but a
>     constraint is being added.
> 
> Everything is same, cell worker, copier are same for both WorkStream and 
> MeshWorker, so I cannot see why only MeshWorker gives this problem.
> 
> Here is how I setup my constraints
> 
>   // Setup affine constraints
>   constraints.clear();
>   constraints.reinit(locally_relevant_dofs);
>   setup_periodic_constraints();
>   constraints.close();
> 
> //------------------------------------------------------------------------------
> template <int dim>
> void
> CGSEM<dim>::setup_periodic_constraints()
> {
>   if(parameters.periodic_x == true ||
>      parameters.periodic_y == true ||
>      parameters.periodic_z == true)
>   {
>     pcout << "Setup periodic constraints ...\n";
>   }
>   else
>   {
>     return;
>   }
> 
>   typedef typename DoFHandler<dim>::cell_iterator Iter;
>   std::vector<GridTools::PeriodicFacePair<Iter>> periodicity_vector;
> 
>   // Periodic along x
>   if(parameters.periodic_x == true)
>     GridTools::collect_periodic_faces(dof_handler,
>                                       0,
>                                       1,
>                                       0,
>                                       periodicity_vector);
> 
>   // Periodic along y
>   if(parameters.periodic_y == true)
>     GridTools::collect_periodic_faces(dof_handler,
>                                       2,
>                                       3,
>                                       1,
>                                       periodicity_vector);
>   // Periodic along z
>   if(dim == 3 && parameters.periodic_z == true)
>     GridTools::collect_periodic_faces(dof_handler,
>                                       4,
>                                       5,
>                                       2,
>                                       periodicity_vector);
> 
>   DoFTools::make_periodicity_constraints<dim, dim>(periodicity_vector, 
> constraints);
> }
> 
> Thanks
> praveen
> 

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/EBFEEF1D-EF53-45FA-8D6B-4C50220D565A%40gmail.com.

Reply via email to