Contents
On this page
This page guides you through the process of solving PDEs with triellipt.
In what follows, we assume the following import is used:
Pythonimport triellipt as tri
There are a couple of methods to create a mesh:
Refer to Meshing for more details.
The next step is to create a FEM computing unit:
Pythonunit = tri.fem.getunit(mesh)
For more details, refer to triellipt.fem.getunit().
Two solver modes are available:
The mesh is preprocessed when creating a unit:
Facts to know:
unit.mesh.unit.perm (a).(a) The permutation is the DataPerm object with the attributes:
mesh is the parent meshperm is the permutation from the parent meshFor more details, refer to triellipt.fem.FEMUnit.
After creating the FEM unit, you must partition the mesh boundary.
Two steps are needed:
partt_spec.Facts to know:
unit.partts.unit.base.Here is the basic structure of the partition spec:
Pythonpartt_spec = {
'name': 'new-domain',
'anchors': [
(0, 0), (0, 1), ...
],
'dirichlet-sides': [1, 2, ...]
}
The keys are:
| Key | Description |
|---|---|
"name" |
Name of the partition. |
"anchors" |
Points that define how the mesh boundary is split. |
"dirichlet-sides" |
Section numbers where Dirichlet BCs are applied. |
The numbering convention is as follows:
The core section includes all mesh nodes except those on Dirichlet sides.
Boundary partitioning can be automated using triellipt.fem.FEMDtN.
This option is only available for simply-connected meshes. The anchor points are still used to split the boundary, but they are kept separately as corners in the partition.
The section numerng is as follows:
See also triellipt.fem.getdtn().
FEM matrices are generated from a partition of the FEM unit — see triellipt.fem.FEMPartt.new_matrix().
Two steps are needed:
(a) Applies only to non-conformal meshes.
The matrix is then generated as follows:
Pythonmatrix = unit.partts['new-domain'].new_matrix(operator, add_constr=True/False)
A general FEM operator is a linear combination of basic FEM operators.
Basic operators
Basic FEM operators are available as properties of triellipt.fem.FEMUnit.
All basic operators are flat arrays representing a special data structure — matrix data stream.
Here is an example of constructing a Laplace operator:
Pythonoperator = unit.diff_2x + unit.diff_2y
Coefficients
Operators can be scaled by coefficients defined on a matrix data stream.
To support this, the FEM unit exposes three properties — unit.ij_r, unit.ij_c and unit.ij_t —
to specify the row, column, and triangle indices for each matrix value.
Assume we define a triangle-based coefficient as
Pythoncoeff = some_func(*unit.mesh.centrs2d)
where
some_func(x, y) represents a certain 2D field.unit.mesh.centrs2d provides the centroids of triangles.Then the scaled Laplace operator can be defined as
Pythonoperator = coeff[unit.ij_t] * (unit.diff_2x + unit.diff_2y)
(row_id, col_id).For more details, refer to triellipt.fem.MatrixFEM.
FEM vectors are generated from a partition of the FEM unit — see triellipt.fem.FEMPartt.new_vector().
For more details, refer to triellipt.fem.VectorFEM.
Copyright © 2023, Igor Semenov.