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.
using ExtendableGrids
# create a 3D unit cube made of tetrahedra
unitcube = 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 indices
typeof(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 triangles
unitsquare = grid_unitsquare(Triangle2D)
nodecells = unitsquare[NodeCells] # the node index -> cell indices mapping
typeof(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, ...
using ExtendableGrids
unitsquare = 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 number
bfaceregions = 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, PythonPlot
gridplot(unitsquare, Plotter=PythonPlot) # this opens a window with a plotExample plots are shown in GridVisualize.jl.
- Tools to create tensor product grids
- Tools for grid modification
- 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
ExtendableGridobjects 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)
- Please look up the list of recent changes