Dear Jean-Paul,

Thank you for your help. For small number of repetition argument, for 
example less than 50, the code reaches the end. 
However, I just checked 100 for repetition and it has been for about an 
hour that the code is still stuck at the 
"triangulation.add_periodicity(periodicity_vector);" !!
It seems that repetition factor refines the mesh and makes add_periodicity 
too slow.

Thanks


On Tuesday, May 16, 2017 at 12:03:14 PM UTC-5, Jean-Paul Pelteret wrote:
>
> Dear Hamed,
>
> I could not find a bug in the code you provided. It worked perfectly fine 
> for me using deal.II 8.5 and with the number of MPI processes = {1,2}. 
>
> I've attached a slightly amended version of your code that I think will 
> highlight what the perceived problem is. When you use GridGenerator 
> ::hyper_rectangle you start out with a single cell that is refined globally 
> 3 times, which in dim=3 results in 1*(2^3)^3 = 512 cells. For your other 
> grid you start off with 30*30*1 = 900 cells on the coarsest level, which 
> upon refinement becomes 900*(2^3)^3 = 460 800 cells. I think that you might 
> find that its taking a little while to produce the final refined grid.
>
> Can you confirm that the code I've attached reaches the end, i.e. that you 
> see this result:
>
> $ mpirun -np 2 ./distib_tria_periodicity
>> Adding periodicity...  done.
>> Refinement iteration: 1
>> Refinement iteration: 2
>> Refinement iteration: 3
>> Finished.
>
>
> Regards,
> Jean-Paul
>
> On Tuesday, May 16, 2017 at 6:17:07 PM UTC+2, Hamed Babaei wrote:
>>
>> Dear Jean-Paul and Daniel,
>>
>> I provided a minimal code which demonstrates the issue. There is no 
>> problem when I use  GridGenerator::hyper_rectangle to create a course mesh 
>> and after adding periodicity, triangulation.refine_global is called.
>> However, when I use subdivided_hyper_rectangle with repetition argument, 
>> code gets stuck ! which I quess is because of repetition argument that 
>> refines the mesh before adding periodicity. 
>>
>> //////////////////////////////////////
>> #include <deal.II/grid/grid_generator.h>
>> #include <deal.II/grid/grid_tools.h>
>> #include <deal.II/grid/grid_in.h>
>> #include <deal.II/grid/tria.h>
>> #include <deal.II/grid/tria_boundary_lib.h>
>> #include <deal.II/grid/tria_accessor.h>
>> #include <deal.II/grid/tria_iterator.h>
>>
>> #include <deal.II/distributed/tria.h>
>> #include <deal.II/distributed/grid_refinement.h>
>>
>> #include <iostream>
>> #include <fstream>
>> /////////////////////////
>> using namespace dealii;
>>
>> template <int dim>
>>   class Solid
>>   {
>>   public:
>>     Solid();
>>
>>     void    make_grid();
>>
>>   private:
>>     MPI_Comm                         mpi_communicator;
>>     parallel::distributed::Triangulation<dim> triangulation;
>>
>>   };
>>
>> template <int dim>
>>   Solid<dim>::Solid()
>>     :
>>     mpi_communicator (MPI_COMM_WORLD),
>>     triangulation (mpi_communicator,
>>                    typename Triangulation<dim>::MeshSmoothing
>>                    (Triangulation<dim>::smoothing_on_refinement |
>>                     Triangulation<dim>::smoothing_on_coarsening))
>>
>> {}
>>
>> template <int dim>
>>   void Solid<dim>::make_grid()
>>     {
>>       std::vector< unsigned int > repetitions(dim, 30);
>>       if (dim == 3)
>>       repetitions[dim-1] = 1;
>>
>> //      GridGenerator::subdivided_hyper_rectangle(triangulation,
>> //                                            repetitions,
>> //        Point<dim>(0.0, 0.0, -0.5),
>> //        Point<dim>(20.0, 20.0, 0.5),
>> //        true);
>>
>>
>>    GridGenerator::hyper_rectangle(triangulation,
>>                                   Point<dim>(0.0, 0.0, 0.0),
>>                                   Point<dim>(20.0, 20.0, 20.0),
>>                                   true);
>>
>>    std::vector<GridTools::PeriodicFacePair<typename 
>> parallel::distributed::Triangulation<dim>::cell_iterator> >
>>    periodicity_vector;
>>
>>    GridTools::collect_periodic_faces(triangulation,
>>                                  /*b_id1*/ 0,
>>                                  /*b_id2*/ 1,
>>                                  /*direction*/ 0,
>>       periodicity_vector);
>>
>>   triangulation.add_periodicity(periodicity_vector);
>>
>>
>>   triangulation.refine_global (3);
>>
>>     }
>>
>>     int main (int argc, char *argv[])
>>       {
>>     Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
>>     Solid<3> solid_3d;
>>     solid_3d.make_grid();
>>       }
>> //////////////////////////////////////////////////////////////////////
>>
>> Any clue would be appreciated.
>>
>> Thanks and regards,
>> Hamed
>>
>> On Monday, May 15, 2017 at 8:44:24 AM UTC-5, Jean-Paul Pelteret wrote:
>>>
>>> Dear Hamad,
>>>
>>> Would you mind please posting a minimal example that demonstrates the 
>>> issue? Since both Daniel and I are surprised that this is the behaviour 
>>> that you're experiencing, I would say that this is an unexpected outcome.
>>>
>>> Regards,
>>> Jean-Paul
>>>
>>> On Monday, May 15, 2017 at 3:40:20 PM UTC+2, Hamed Babaei wrote:
>>>>
>>>> Dear Daniel,
>>>>
>>>> As far as I see, GridGenerator::subdivided_hyper_rectangle only calls 
>>>>> "Triangulation::create_triangulation" and hence creates a coarse 
>>>>> triangulation.
>>>>> Can you confirm either?
>>>>>
>>>> If  GridGenerator::subdivided_hyper_rectangle creates a coarse 
>>>> triangulation, a question arises that when it uses repetition argument 
>>>> which specifies number of elements in every direction. 
>>>> Besides, when I use GridGenerator::subdivided_hyper_rectangle with 
>>>> repetition argument, the code gets stuck at add_periodicity and never 
>>>> ends. 
>>>>
>>>> Thanks and regards,
>>>> Hamed  
>>>>
>>>

-- 
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.

Reply via email to