Grid constructors

Tensor product simplex grids

ExtendableGrids.simplexgridFunction
function simplexgrid(coord::Array{Tc,2},
                     cellnodes::Array{Ti,2},
                     cellregions,
                     bfacenodes,
                     bfaceregions
                     ) where {Tc,Ti}

Create d-dimensional simplex grid from five arrays.

  •    coord: d ``\times`` n_points matrix of coordinates
  • cellnodes: d+1 $\times$ n_tri matrix of triangle - point incidence
  • cellregions: n_tri vector of cell region markers
  • bfacenodes: d $\times$ n_bf matrix of boundary facet - point incidences
  • bfaceregions: n_bf vector of boundary facet region markers

Coordinate type Tc index type Ti are detected from the first two parameters. cellregions, bfaceregions, bfacenodes are converted to have the same element type as cellnodes.

source
function simplexgrid(coord::Array{Tc,2},
                     cellnodes::Array{Ti,2},
                     cellregions,
                     bfacenodes,
                     bfaceregions,
                     bedgenodes,
                     bedgeregions
                     ) where {Tc,Ti}

Create simplex grid from coordinates, cell-nodes-adjancency, cell-region-numbers, boundary-face-nodes adjacency, boundary-face-region-numbers, boundary-edge-nodes, and boundary-edge-region-numbers arrays.

The index type Ti is detected from cellnodes, all other arrays besides coord are converted to this index type.

source
simplexgrid(X; bregions=[1,2],cellregion=1)

Constructor for 1D grid.

Construct 1D grid from an array of node cordinates. It creates two boundary regions with index 1 at the left end and index 2 at the right end by default.

The keyword arguments allow to overwrite the default region numbers.

Primal grid holding unknowns: marked by o, dual grid marking control volumes: marked by |.

 o-----o-----o-----o-----o-----o-----o-----o-----o
 |--|-----|-----|-----|-----|-----|-----|-----|--|
source
simplexgrid(X,Y; bregions=[1,2,3,4],cellregion=1)

Constructor for 2D grid from coordinate arrays.

Boundary region numbers count counterclockwise:

locationnumber
south1
east2
north3
west4

The keyword arguments allow to overwrite the default region numbers.

source
simplexgrid(X,Y,Z; bregions=[1,2,3,4,5,6],cellregion=1)

Constructor for 3D grid from coordinate arrays. Boundary region numbers:

locationnumber
south1
east2
north3
west4
bottom5
top6

The keyword arguments allow to overwrite the default region numbers.

source
simplexgrid(grid2d::ExtendableGrid, coordZ; bot_offset=0,cell_offset=0,top_offset=0, bface_offset=0)

Create tensor product of 2D grid and 1D coordinate array.

Cellregions and outer facet regions are taken over from 2D grid and added to cell_offset and bface_offset, respectively. Top an bottom facet regions are detected from the cell regions and added to bot_offset resp. top_offset.

source
simplexgrid(
    file::String;
    format
) -> Union{Nothing, ExtendableGrid}

Read grid from file. Currently for pdelib sg and Gmsh formats.

source
ExtendableGrids.glueFunction
c=glue(a,b)

Glue together two vectors a and b resulting in a vector c. They last element of a shall be equal (up to tol) to the first element of b. The result fulfills length(c)=length(a)+length(b)-1

source
glue(g1,g2;
     g1regions=1:num_bfaceregions(g1),
     g2regions=1:num_bfaceregions(g2),
     interface=0,
     warnonly = false,
     tol=1.0e-10,
     naive=false)

Merge two grids along their common boundary facets.

  • g1: First grid to be merged
  • g2: Second grid to be merged
  • g1regions: boundary regions to be used from grid1. Default: all.
  • g2regions: boundary regions to be used from grid2. Default: all.
  • interface: if nonzero, create interface region in new grid, otherwise, ignore
  • strict: Assume all bfaces form specfied regions shall be matched, throw error on failure
  • tol: Distance below which two points are seen as identical. Default: 1.0e-10
  • naive: use naive quadratic complexity matching (for checking backward compatibility). Default: false

Deprecated:

  • breg: old notation for interface
source

Various special grids

ExtendableGrids.grid_triangleMethod
grid_triangle(coords::AbstractArray{T,2}) where {T}

Generates a single triangle with the given coordinates, that should be a 2 x 3 array with the coordinates of the three vertices, e.g. coords = [0.0 0.0; 1.0 0.0; 0.0 1.0]'.

source
ExtendableGrids.grid_unitcubeMethod
grid_unitcube(EG::Type{<:Hexahedron3D}; scale = [1,1,1], shift = [0,0,0])

Unit cube as one cell with six boundary regions (bottom, front, right, back, left, top)

source
ExtendableGrids.grid_unitcubeMethod
grid_unitcube(::Type{Tetrahedron3D}; scale = [1,1,1], shift = [0,0,0])

Unit cube as six tets with six boundary regions (bottom, front, right, back, left, top)

source
ExtendableGrids.grid_unitsquareMethod
grid_unitsquare(EG::Type{<:Quadrilateral2D}; scale = [1,1], shift = [0,0])

Unit square as one cell with four boundary regions (bottom, right, top, left)

source
ExtendableGrids.grid_unitsquareMethod
grid_unitsquare(::Type{<:Triangle2D}; scale = [1,1], shift = [0,0])

Unit square as two triangles with four boundary regions (bottom, right, top, left)

source
ExtendableGrids.reference_domainFunction
    reference_domain(EG::Type{<:AbstractElementGeometry}, T::Type{<:Real} = Float64; scale = [1,1,1], shift = [0,0,0]) -> ExtendableGrid{T,Int32}

Generates an ExtendableGrid{T,Int32} for the reference domain of the specified Element Geometry. With scale and shift the coordinates can be manipulated.

source