# tdegeus/GooseFEM

Fetching contributors…
Cannot retrieve contributors at this time
324 lines (210 sloc) 9.16 KB

# GooseFEM::Mesh

## Generic methods

### GooseFEM::Mesh::dofs

GooseFEM::MatS GooseFEM::Mesh::dofs(size_t nnode, size_t ndim)

Get a sequential list of DOF-numbers for each vector-component of each node. For example for 3 nodes in 2 dimensions the output is

\begin{bmatrix}
0 & 1 \\
2 & 3 \\
4 & 5
\end{bmatrix}


### GooseFEM::Mesh::renumber

GooseFEM::MatS GooseFEM::Mesh::renumber(const GooseFEM::MatS &dofs)

Renumber (DOF) indices to lowest possible indices. For example:

\begin{bmatrix}
0 & 1 \\
5 & 4
\end{bmatrix}


is renumbered to

\begin{bmatrix}
0 & 1 \\
3 & 2
\end{bmatrix}


Or, in pseudo-code, the result of this function is that:

dofs = renumber(dofs)

sort(unique(dofs[:])) == range(max(dofs+1))

Tip

A generic interface using iterator is available if you do not which to use the default Eigen interface.

### GooseFEM::Mesh::reorder

GooseFEM::MatS GooseFEM::Mesh::reorder(const GooseFEM::MatS &dofs, const ColS &idx, std::string location="end")

Reorder (DOF) indices such to the lowest possible indices, such that some items are at the beginning or the end. For example:

\mathrm{dofs} =
\begin{bmatrix}
0 & 1 \\
2 & 3 \\
4 & 5
\end{bmatrix}


with

\mathrm{idx} =
\begin{bmatrix}
0 & 1
\end{bmatrix}


Implies that dofs is renumbered such that 0 becomes the one-before-last index (0 \rightarrow 4), and the 1 becomes the last index (1 \rightarrow 5). The remaining items are renumbered to the lowest index while keeping the same order. The result:

\begin{bmatrix}
4 & 5 \\
0 & 1 \\
2 & 3
\end{bmatrix}


Tip

A generic interface using iterator is available if you do not which to use the default Eigen interface.

### GooseFEM::Mesh::elem2node

GooseFEM::SpMatS GooseFEM::Mesh::elem2node(const GooseFEM::MatS &conn)

Return a sparse matrix which contains the element numbers (columns) that are connected to each node (rows).

Warning

One should not confuse the element 0 when this matrix is converted to a dense matrix. When this is done all the 'missing' items are filled in as zero, which does have a meaning here.

## Predefined meshes

### GooseFEM::Mesh::Tri3

#### GooseFEM::Mesh::Tri3::Regular

No description yet, please consult the code.

#### Naming convention

GooseFEM::Mesh::Quad4::Regular(size_t nelx, size_t nely, double h=1.);

Regular mesh of linear quadrilaterals in two-dimensions. The element edges are all of the same size h (by default equal to one), optional scaling can be applied afterwards. For example the mesh shown below that consists of 21 x 11 elements. In that image the element numbers are indicated with a color, and likewise for the boundary nodes.

Methods:

// A matrix with on each row a nodal coordinate:
// [ x , y ]

// A matrix with the connectivity, with on each row to the nodes of each element

// A list of boundary nodes

// A matrix with periodic node pairs on each row:
// [ independent nodes, dependent nodes ]

// The node at the origin

// A matrix with DOF-numbers: two per node in sequential order

// A matrix with DOF-numbers: two per node in sequential order
// All the periodic repetitions are eliminated from the system
MatS = GooseFEM::Mesh::Quad4::Regular.dofsPeriodic();

Regular mesh with a fine layer of quadrilateral elements, and coarser elements above and below.

Note

The coarsening depends strongly on the desired number of elements in horizontal elements. The becomes clear from the following example:

mesh = GooseFEM::Mesh::Quad4::FineLayer(6*9  ,51); // left   image :  546 elements
mesh = GooseFEM::Mesh::Quad4::FineLayer(6*9+3,51); // middle image :  703 elements
mesh = GooseFEM::Mesh::Quad4::FineLayer(6*9+1,51); // right  image : 2915 elements

Methods:

// A matrix with on each row a nodal coordinate:
// [ x , y ]

// A matrix with the connectivity, with on each row to the nodes of each element

// A list of boundary nodes

// A matrix with periodic node pairs on each row:
// [ independent nodes, dependent nodes ]

// The node at the origin

// A matrix with DOF-numbers: two per node in sequential order

// A matrix with DOF-numbers: two per node in sequential order
// All the periodic repetitions are eliminated from the system

// A list with the element numbers of the fine elements in the center of the mesh
// (highlighted in the plot below)

:width: 500px
:align: center

### GooseFEM::Mesh::Hex8

#### Naming convention

The following naming convention is used:

• Front: all nodes whose coordinates 0 \leq x \leq L_x, 0 \leq y \leq L_y, z = 0.
• Back: all nodes whose coordinates 0 \leq x \leq L_x, 0 \leq y \leq L_y, z = L_z.
• Bottom: all nodes whose coordinates 0 \leq x \leq L_x, 0 \leq z \leq L_z, y = 0.
• Top: all nodes whose coordinates 0 \leq x \leq L_x, 0 \leq z \leq L_z, y = L_y.
• Left: all nodes whose coordinates 0 \leq y \leq L_y, 0 \leq z \leq L_z, x = 0.
• Right: all nodes whose coordinates 0 \leq y \leq L_y, 0 \leq z \leq L_z, x = L_x.

The edges and corners follow from the intersections, i.e.

• FrontBottomEdge: all nodes whose coordinates 0 \leq x \leq L_x, y = 0, z = 0.
• ...
• FrontBottomLeftCorner: the node whose coordinate x = 0, y = 0, z = 0.
• ...

Regular mesh.

#### GooseFEM::Mesh::Hex8::FineLayer

Mesh with a middle plane that is fine the middle, and becomes course away from this plane.

## Type specific methods

### GooseFEM::Mesh::Tri3

#### GooseFEM::Mesh::Tri3::getOrientation

No description yet, please consult the code.

#### GooseFEM::Mesh::Tri3::setOrientation

No description yet, please consult the code.

#### GooseFEM::Mesh::Tri3::retriangulate

No description yet, please consult the code.

#### GooseFEM::Mesh::Tri3::TriUpdate

No description yet, please consult the code.

#### GooseFEM::Mesh::Tri3::Edge

No description yet, please consult the code.