[Dune] GridFactory with UG collapses at 100000 nodes

Oliver Sander sander at mi.fu-berlin.de
Thu Mar 3 15:07:33 CET 2011


Hi Dominic!
This is a known but un-documented UG memory weirdness.  UG itself
switches from a fast, but memory-intensive implementation to a slower
one when your grid exceeds a certain size.  To work around this please 
reset the
macro NDELEM_BLK_MAX in the file gm.h of UG from 100 to something larger,
and recompile UG afterwards.

Best,
Oliver

Am 03.03.2011 14:55, schrieb Dominic Kempf:
> Hey Dune-Team!
>
> I am using the Dune::GridFactory with UG to create large cube grids. 
> But there seems to be a bug, that makes grid generation extremly slow 
> at exactly 100000 inserted nodes. I ran a loop that creates cube grids 
> on the unit square with increasing number of nodes. The result was 
> that until 99000 the grid was instantly created, as soon as I passed 
> the 100000, it takes around 10 seconds. Much larger grids are 
> impossible to create due to computing time. This doesnt seem to be a 
> memory issue, increasing UG's default heap size doesnt change a thing. 
> I can still get bigger grids by refinement in acceptable time, but 
> this brings some other issues with it for me.
>
> This is the example code I extracted, that makes the issue obvious:
>
>   typedef Dune::UGGrid<2> Grid;
>
>   for (double n=95000; n<103000; n += 1000)
>   {
>     int m = (int)sqrt(n);
>     Dune::GridFactory<Grid> factory;
>     for (int j = 0; j < m+1; j++)
>       for (int i = 0; i < m+1; i++)
>       {
>         //set vertex position
>         Dune::FieldVector<Grid::ctype,2> pos;
>         pos[0] = ((double)i)/m;
>         pos[1] = ((double)j)/m;
>         factory.insertVertex(pos);
>       }
>
>     //get geometry type
>     const Dune::GeometryType gt(Dune::GeometryType::cube,2);
>
>     //insert elements
>     for (unsigned int i=0; i<m;i++)
>       for (unsigned int j=0; j<m;j++)
>       {
>         //set node positions
>         std::vector<unsigned int> pos;
>         pos.push_back(i+j*(m+1));
>         pos.push_back(i+1+j*(m+1));
>         pos.push_back(i+(j+1)*(m+1));
>         pos.push_back(i+1+(j+1)*(m+1));
>         factory.insertElement(gt,pos);
>       }
>     Grid* grid = factory.createGrid();
>     std::cout << "Grid with " << grid->size(2) << " vertices created!\n";
>     delete grid;
>   }
>
>
>  I hope somebody could help!
> Thanks in advance!
> Dominic
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune





More information about the Dune mailing list