|
1 | | -# simplefem |
2 | | -A simple example finite element library. |
| 1 | +# simplefem: a simple example finite element library. |
| 2 | + |
| 3 | +simplefem is a very simple finite element definition library, that is used as an example |
| 4 | +in the DefElement documentation. |
| 5 | + |
| 6 | +## Using simplefem |
| 7 | + |
| 8 | +simplefem can be used to tabulate basis functions of Lagrange elements on triangles. To |
| 9 | +create a Lagrange element on a triangle, the function `simplefem.lagrange_element` can |
| 10 | +be used. For example, the following snippet creates a degree 3 Lagrange element on a |
| 11 | +triangle: |
| 12 | + |
| 13 | +```python |
| 14 | +from simplefem import lagrange_element |
| 15 | + |
| 16 | +e = lagrange_element(3) |
| 17 | +``` |
| 18 | + |
| 19 | +A simplefem element can be tabulated at a set of points using the `tabulate` method. For |
| 20 | +example, the following snippet gets the values of the basis functions of a degree 3 |
| 21 | +Lagrage element at the points (0.3, 0.1) and (1, 0): |
| 22 | + |
| 23 | +```python |
| 24 | +from simplefem import lagrange_element |
| 25 | +import numpy as np |
| 26 | + |
| 27 | +e = lagrange_element(3) |
| 28 | + |
| 29 | +points = np.array([[0.3, 0.1], [1, 0]]) |
| 30 | +values = e.tabulate(points) |
| 31 | +``` |
| 32 | + |
| 33 | +## Conventions |
| 34 | +### Reference cell |
| 35 | +The reference cell used by simplefem is the triangle with vertices at (0, 0), (1, 0), |
| 36 | +and (0, 1). |
| 37 | + |
| 38 | +### Point ordering |
| 39 | +The basis functions in simplefem are all defined using point evaluations. These points |
| 40 | +are ordered lexicographically: for example, the points that define a degree 3 element |
| 41 | +are arranged like this: |
| 42 | + |
| 43 | +``` |
| 44 | +9 |
| 45 | +|\ |
| 46 | +7 8 |
| 47 | +| \ |
| 48 | +4 5 6 |
| 49 | +| \ |
| 50 | +0-1-2-3 |
| 51 | +``` |
| 52 | + |
| 53 | + |
| 54 | +## Contributing |
| 55 | +As simplefem is a small example library, it aims to only contain the features that |
| 56 | +are necessary for the DefElement documentation. We are therefore unlikely to accept |
| 57 | +any pull request that adds features to simplefem. If you feel like a feature is |
| 58 | +needed, please open an issue and we can discuss it before you work on it. |
0 commit comments