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