Geometry, meshes, and numerical integration for finite element analyses
Contents
- Introduction
- Installation
- Examples
- Roadmap
- Appendix A - Shapes and local numbering of nodes
- Appendix B - Geometry versus space dimensions
Introduction
This crate contains structures and functions for geometry computations, generate meshes, and perform numerical integration for finite element analyses (FEM/FEA).
Documentation
Installation
At this moment, Gemlab works on Linux (Debian/Ubuntu; and maybe Arch).
TL;DR (Debian/Ubuntu/Linux)
First:
Then:
Details
This crates depends on russell_lab and, hence, needs some external libraries. See the installation of required dependencies on russell_lab.
Setting Cargo.toml
👆 Check the crate version and update your Cargo.toml accordingly:
[]
= "*"
Examples
MSH file format
The MSH file format contains three mandatory sections and two optional sections. The MSH file is a plain text file where comments are marked with # and empty lines are allowed. The mandatory sections are header, points, and cells. We use "cells" here to refer to 2D polygons or 3D polyhedra (aka Elements in the Finite Element Method). The header section specifies the space dimension (2 or 3), the number of points, the number of cells, and the optional number of marked edges and faces. The optional sections specify the marked edges and faces. An example of MSH file is shown below:
#
# 8-------------11
# /. /|
# {-5}/ . {-5}/ |
# / . {-9} / |{123}
# / . / | id = 1
# 2.0 9-------------10 | marker = 2
# | . | |
# | 4---------|----7*
# | /. | /|
# | / . | / |
# | / . | / |{-4}
# |/ . |/ |
# 1.0 5--------------6 | id = 0
# | . |{-8}| marker = 1
# | 0---------|----3 0.0
# | / | /
# | / | /
# | / | /
# |/ |/
# 0.0 1*-------------2* 1.0
# 0.0 1.0
#
# header
# ndim npoint ncell nmarked_edge nmarked_face
3 12 2 4 2
# points
# id marker x y z
0 0 0.0 0.0 0.0
1 -1 1.0 0.0 0.0
2 -1 1.0 1.0 0.0
3 0 0.0 1.0 0.0
4 0 0.0 0.0 1.0
5 0 1.0 0.0 1.0
6 0 1.0 1.0 1.0
7 -1 0.0 1.0 1.0
8 0 0.0 0.0 2.0
9 0 1.0 0.0 2.0
10 0 1.0 1.0 2.0
11 0 0.0 1.0 2.0
# cells
# id marker kind points
0 1 hex8 0 1 2 3 4 5 6 7
1 2 hex8 4 5 6 7 8 9 10 11
# marked edges
# marker p1 p2
123 7 11
-5 11 10
-4 7 3
-5 8 9
# marked faces
# marker p1 p2 p3 {p4}
-8 3 2 7 6
-9 8 10 9 11
Numerical integration
use Gauss;
use ;
use Scratchpad;
use StrError;
use HashSet;
Roadmap
- Implement read/write mesh functions
- Add tests for the numerical integrations
- Implement triangle and tetrahedron generators
- Implement drawing functions
Appendix A - Shapes and local numbering of nodes
Lines (Lin)
Triangles (Tri)
Quadrilaterals (Qua)
Tetrahedra (Tet)
Hexahedra (Hex)
Appendix B - Geometry versus space dimensions
The following table shows what combinations of geometry-number-of-dimensions (geo_ndim) and
space-number-of-dimensions (space_ndim) are possible. There are three cases:
- Case
CABLE--geo_ndim = 1andspace_ndim = 2 or 3; e.g., line in 2D or 3D (cables and rods) - Case
SHELL--geo_ndim = 2andspace_ndim = 3; e.g. Tri or Qua in 3D (shells and surfaces) - Case
SOLID--geo_ndim = space_ndim; e.g., Tri and Qua in 2D or Tet and Hex in 3D
geo_ndim |
space_ndim = 2 |
space_ndim = 3 |
|---|---|---|
| 1 | CABLE |
CABLE |
| 2 | SOLID |
SHELL |
| 3 | impossible | SOLID |