|
|
The software which is named "fossils" here is based on a much more general finite element code built with the help of the [Gmsh SDK](https://gmsh.info/). This code is able to solve any kind of linear statics problems. In practise, the code can be used through a python module named `cxxfem`.
|
|
|
The software which is named "fossils" here is based on a small-strain finite element code built with the help of the [Gmsh SDK](https://gmsh.info/). This code is able to solve a wide range of linear statics problems. In practise, the code can be used through a python module named `cxxfem`.
|
|
|
|
|
|
Two examples of mechanical problems are given in the `models/others` folder of the installed version of fossils. They correspond to:
|
|
|
Two examples of mechanical problems are given in the `models/others` folder of the installed version of fossils:
|
|
|
* [beam2d.py](https://gitlab.uliege.be/rboman/fossils/-/blob/master/cxxfem/tests/beam2d.py): bending of a beam (2D plane stress),
|
|
|
* [beam3d.py](https://gitlab.uliege.be/rboman/fossils/-/blob/master/cxxfem/tests/beam3d.py): combined bending and torsion of a beam (3D).
|
|
|
|
|
|
Let us have a look at [beam2d.py](https://gitlab.uliege.be/rboman/fossils/-/blob/master/cxxfem/tests/beam2d.py).
|
|
|
|
|
|
The file starts with a function named `build_square` which creates the problem geometry using a series Gmsh calls. The syntax is described in the Gmsh manual. It is also possible to load a `.geo` file from Gmsh.
|
|
|
The file starts with the importation of the `cxxfem` module as well as `gmsh` which is used for pre- and post-processing.
|
|
|
```
|
|
|
import cxxfem as fem
|
|
|
import gmsh
|
|
|
```
|
|
|
|
|
|
These two lines are folowed by a function named `build_square` which creates the problem geometry using a series Gmsh calls. The syntax is described in the Gmsh manual. It is also possible to load a `.geo` script from Gmsh (see [beam3d.py](https://gitlab.uliege.be/rboman/fossils/-/blob/master/cxxfem/tests/beam3d.py) which loads [parallelepiped.geo](https://gitlab.uliege.be/rboman/fossils/-/blob/master/cxxfem/tests/parallelepiped.geo)).
|
|
|
|
|
|

|
|
|
|
|
|
The result of this function is a rectangle with several geometrical entities named with explicit names ("top" is the top curve, "interior" is the interior surface of the beam, etc.). These names are also called "physical groups" in Gmsh. They are used to assign properties and boundary conditions to a list of geometrical entities.
|
|
|
|
|
|
Let us have a look at the `__main__` part of the script.
|
|
|
The function is followed by the `__main__` part of the script, which is called when the script is executed by python.
|
|
|
|
|
|
The first thing to do is to create a `Problem` object.
|
|
|
Every problem definition starts with the creation of a `Problem` object.
|
|
|
```
|
|
|
pbl = fem.Problem()
|
|
|
```
|
|
|
This is the main object which contains all the data related to the problem to be solved.
|
|
|
The object is stored in a python variable named `pbl`. The `fem.` prefix refers to the `cxxfem` module which was imported as `fem` at the beginning of the file.
|
|
|
This object is the main object containing the main data related to the finite element analysis.
|
|
|
|
|
|
Then, the `build_square` function is called with particular parameters (beam size and mesh size)
|
|
|
Then, the `build_square` function described ealier is called with particular parameters (the beam size and the mesh size)
|
|
|
```
|
|
|
build_square(0.0, 0.0, 10.0, 1.0, 80, 8, True, True)
|
|
|
```
|
|
|
The next step is to define a material. This is done by adding a `Medium` object to the `Problem`. The target physical group ("interior") is also given, as well as the values of the Young's modulus and the Poisson coefficient:
|
|
|
The next step is to define material properties. This is done by adding a `Medium` object to the `Problem`. The target physical group ("interior") is also given, as well as the values of the Young's modulus and the Poisson coefficient of the linear elastic model:
|
|
|
```
|
|
|
m = fem.Medium(pbl, "interior", 100.0, 0.3)
|
|
|
```
|
... | ... | |