Skip to content
Snippets Groups Projects

A MultiMesh Wrapper for Dune Grids

The aim of this module is to allow to construct a vector of hierarchically nested grids indipendently refined and a GridView that allows to iterate through all grids simultaneously priving a multi-entity on each node of the combined leaf/level grid.

Installation

Building the module follows the standard Dune guideline, i.e. simply call

dunecontrol --current all

In the modules root directory. Required dependencies are the modules

  • dune-common
  • dune-grid

and optionally you may provide various grid modules that can be used with dune-multimesh, e.g.

  • dune-alugrid
  • dune-foamgrid
  • dune-uggrid (currently limited, due to a lack of multi grid support)

Getting started

In order to build a MultiMesh, simply wrap your host-grid type into a the MultiMesh class and set the number of grids to construct.

using HostGrid = ALUGrid<2, 2, simplex, conforming>;
MultiMesh<HostGrid> multimesh(2);

If the host-grid allows to pass arguments to its constructor, these can be appended to the MultiMesh constructor after the size argument, e.g.

using HostGrid = AlbertaGrid<3,3>;
MultiMesh<HostGrid> multimesh(2, filename);

Since grids are not copy-constructable, all grids in a MultiMesh are constructed from scratch from the same arguments or the same grid-factory, to guarantee that the coarse-grid level is the same in all grids. When using a GridFactory with MultiMesh, it is required to set the number of grids to create in the GridFactory constructor. This is different to other GridFactories. The default- constructor creates one grid only. (This is just to be conform the the GridFactory interface). In order to use, e.g., structured grid-factory builders, you have to pass the MultiMesh GridFactory:

using HostGrid = ALUGrid<2, 2, simplex, conforming>;
using Factory = StructuredGridBuilder<MultiMesh<HostGrid> >;
GridFactory<MultiMesh<HostGrid> > gridFactory(3); // create 3 grids
auto gridPtr = Factory::createSimplexGrid(gridFactory, lower, upper, num);

Since the dune-grid StructuredGridFactory does not allow to pass an own GridFactory object to fill, a modified StructuredGridFactory is provided in the utility folder, called StructuredGridBuilder.

Grid iteration

In order to iterate over the combined grid, the MultiMesh traverses all elements hierarchically, starting from the coarse-grid. If an entity reaches its leaf-level, it is conserved until the entities from the other grids also reach its leaf-level. Then a vector of entities is created and returned by the LeafIterator:

for (auto const& multiEntity : elements(grid.leafGridView())) {
  assert(multiEntity.size() == grid.size());
  for (auto const& entity : multiEntity)
    assert(entity.isLeaf());
}

TODO

The current implementation is very limited. Several things need to be implemented:

  • Parallelization, especially load-balance for more than one grid
  • Abstraction of the MultiEntity. Currently its just a vector of entities. It would be better to have an order relation, e.g. by grid-level, to allow for a fast access to the smallest and largest entity.
  • Provide Interpolation / hierarchic Geometry-Objects, like the geometryInFather for father-child relations.
  • Entities could be wrapped-up to provide a relation to the grid (-index) it belongs to.
  • Maybe provide Intersections between hierarchic entities