Skip to content

DefElement/simplefem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simplefem: a simple example finite element library.

DefElement verification

simplefem is a very simple finite element definition library, that is used as an example in the DefElement documentation.

Using simplefem

simplefem can be used to evaluate basis functions of Lagrange elements on triangles. To create a Lagrange element on a triangle, the function simplefem.lagrange_element can be used. For example, the following snippet creates a Lagrange element on a triangle that has 10 basis functions:

from simplefem import lagrange_element

e = lagrange_element(10)

A basis function of a simplefem element can be evaluated at a point using the evaluate method. For example, the following snippet gets the value of the basis function with index 2 of a Lagrange element with 10 basis functions at the point (0.3, 0.1):

from simplefem import lagrange_element
import numpy as np

e = lagrange_element(10)

value = e.evaluate(2, np.array([0.3, 0.1]))

Conventions

Reference cell

The reference cell used by simplefem is the triangle with vertices at (-1, 0), (1, 0), and (0, 1).

Point ordering

The basis functions in simplefem are all defined using point evaluations. These points are ordered lexicographically: for example, the points that define an element with ten points are arranged like this:

      9
     / \
    7   8
   /     \
  4   5   6
 /         \
0---1---2---3

Contributing

As simplefem is a small example library, it aims to only contain the features that are necessary for the DefElement documentation. We are therefore unlikely to accept any pull request that adds features to simplefem. If you feel like a feature is needed, please open an issue and we can discuss it before you work on it.

About

A simple example finite element library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages