ExtendableGrids — Module
ExtendableGrids

Extendable grid data container for numerical simulations

Build status code style: runic

Provide container structure ExtendableGrid with type stable content access and lazy content creation holding data for discretization grids for finite element and finite volume methods. Used by VoronoiFVM and ExtendableFEM, a package for novel, gradient robust finite element methods.

Showcase

Create a grid and discover basic adjacencies

using ExtendableGrids# create a 3D unit cube made of tetrahedraunitcube = grid_unitcube(Tetrahedron3D)@show num_cells(unitcube) # = 6 (the unit cube consists of 6 tetrahedra)@show num_nodes(unitcube) # = 8 (the unit cube has 8 corners)cellnodes = unitcube[CellNodes]  # this is the mapping cell index -> node indicestypeof(cellnodes) <: Matrix # true: each cell (tetrahedron!) has 4 nodes:                            # store mapping as a matrix!@show cellnodes[: , 2] # = [1,3,4,7], the nodes of the second cell# create a 2D unit square made of trianglesunitsquare = grid_unitsquare(Triangle2D)nodecells = unitsquare[NodeCells] # the node index -> cell indices mappingtypeof(cellnodes) <: Matrix # false!                            # each node has a different number of adjacent cells:                            # stored as `VariableTargetAdjacency`@show nodecells[: , 2] # = [1,2]@show nodecells[: , 5] # = [1,2,3,4] # (center node)

Other adjacency mappings are constructed by combining grid components, see Notations. For example FaceCells, BFaceNodes, NodeEdges, ...

Grid data and plotting

using ExtendableGridsunitsquare = grid_unitsquare(Triangle2D)coords = unitsquare[Coordinates] # matrix of all node coordinates@show coords[: , 5]              # = [ 0.5, 0.5 ] (center node)regions = unitsquare[CellRegions] # mapping cell index -> region number@show all( ==(1), regions)        # in this grid, all cell regions are = 1 # mapping boundary face index -> boundary region numberbfaceregions = unitsquare[BFaceRegions]@show bfaceregions # = [1,2,3,4], the four boundary regions are labeled by 1,2,3,4# Plotting is done via GridVisualize.jl and a Plotter (PythonPlot.jl,# GLMakie.jl, Plutovista.jl, ...)using GridVisualize, PythonPlotgridplot(unitsquare, Plotter=PythonPlot) # this opens a window with a plot

Example plots are shown in GridVisualize.jl.

Additional functionality:

  • Tools to create tensor product grids
  • Tools for grid modification

Companion packages:

  • Gmsh.jl extension. Please be aware about the fact that, while this package and Gmsh.jl are MIT licensed, the underlying binary code of Gmsh is distributed under the GPLv2 license.
  • Visualization of these grids and of functions on them is available in GridVisualize.jl.
  • SimplexGridFactory contains an API which allows to create ExtendableGrid objects with Triangulate.jl which wraps the Triangle mesh generator by J. Shewchuk and TetGen.jl which wraps the TetGen mesh generator by H. Si.
  • Triangulate.jl and TetGen.jl extensions
  • Metis.jl extension and partitioning for multithreading (under development)

Recent changes

  • Please look up the list of recent changes
source