Contents
On this page
FEM (P1) solver.
triellipt.fem.getunit(mesh, anchors=None, mode=None)
Creates a FEM computing unit.
Parameters
mesh : TriMesh
anchors : Iterable = None
(float, float) points to synchronize the mesh boundary.
mode : str = None
Returns
FEMUnit
triellipt.fem.getdtn(mesh, anchors, mode=None)
Creates a FEM-DtN unit.
Parameters
mesh : TriMesh
anchors : Iterable
(float, float) points to partition the mesh boundary.
mode : str = None
Returns
FEMDtN
Notes
FEM-DtN units are only supported for simply-connected meshes.
class triellipt.fem.FEMUnit(mesh=None, meta=None)
FEM computing unit.
Properties
Basic FEM operators as data-streams:
| Name | Description |
|---|---|
massmat |
Mass-matrix |
massdig |
Mass-matrix lumped |
diff_1y |
1st y-derivative (weak) |
diff_1x |
1st x-derivative (weak) |
grad_1y |
1st y-derivative (strong) |
grad_1x |
1st x-derivative (strong) |
diff_2y |
2nd y-derivative (weak) |
diff_2x |
2nd x-derivative (weak) |
diff_yx |
2nd yx-derivative (weak) |
diff_xy |
2nd xy-derivative (weak) |
General properties:
| Name | Description |
|---|---|
grad |
Gradient operator (a). |
geom |
Geometric properties (b). |
perm |
Mesh-to-unit permutation (c). |
base |
Basic edge-core partition. |
loops |
List of the mesh loops. |
partts |
Map of the unit partitions. |
Notes
TriGrad as returned by mesh_grad()MeshGeom as returned by mesh_geom()DataPerm object with the attributes:
mesh is the parent meshperm is the permutation from the parent meshFEMUnit.add_partition(self, partt_spec)
Adds new partition to the unit.
Parameters
partt_spec : dict
Returns
self
FEMUnit.get_partition(self, partt_name)
Fetches the unit partition.
Parameters
partt_name : str
Returns
FEMPartt
FEMUnit.del_partition(self, name) → None
Deletes the specified partition from the unit.
FEMUnit.getinterp(self, xnodes, ynodes)
Creates an interpolator on a mesh.
Parameters
xnodes : flat-float-array
ynodes : flat-float-array
Returns
TriInterp
Notes
TriInterp object has the following attributes:
xnodes contains interpolation x-nodesxnodes contains interpolation y-nodesTriInterp() takes nodes-data and returns interpolated one.
FEMUnit.massopr(self, is_lumped, add_constr)
Creates the mass operator from the base partition.
Parameters
is_lumped : bool
add_constr : bool
Returns
MatrixFEM
FEMUnit.average(self, data)
Converts node-based data to triangle-averaged values.
Parameters
data : float-flat-array
Returns
float-flat-array
class triellipt.fem.FEMDtN(unit=None)
FEM-DtN computing unit.
Properties
| Name | Description |
|---|---|
fem |
Parent FEM unit. |
dtn |
DtN partition. |
FEMDtN.dirich_sides(self) → list
Returns a list of Dirichlet sides.
FEMDtN.switch_side(self, key)
Switches the DtN state of the boundary part.
Parameters
key : int
Returns
self
class triellipt.fem.FEMPartt(unit, meta, edge)
FEM unit partition.
Properties
| Name | Description |
|---|---|
core |
Core section. |
edge |
Map of edge sections. |
meta |
Partition metadata. |
FEMPartt.new_vector(self)
Creates a new FEM vector.
Returns
VectorFEM
FEMPartt.new_matrix(self, operator, add_constr=False)
Creates a new FEM matrix.
Parameters
operator : flat-float-array
add_constr : bool = False
Returns
MatrixFEM
FEMPartt.get_nodes(self, key)
Retrieves the points of the partition section.
Parameters
key : int
Returns
two-row-float-array
Notes
This method is also available as nodes2d(key).
class triellipt.fem.MatrixFEM(partt=None, body=None, meta=None)
Global FEM matrix.
MatrixFEM.getblock(self, row_id, col_id)
Extracts a block of a matrix.
Parameters
row_id : int
col_id : int
Returns
csc-matrix
class triellipt.fem.VectorFEM(partt=None, body=None)
FEM vector.
VectorFEM.with_body(self, value)
Defines the vector body.
Parameters
value : scalar | flat-float-array
Returns
VectorFEM
VectorFEM.from_func(self, func)
Defines the vector via a function on the mesh nodes.
Parameters
func : Callable
(x, y) that returns the vector body.
Returns
VectorFEM
VectorFEM.constrained(self)
Constrains the vector on the parent mesh.
Returns
VectorFEM
VectorFEM.getsection(self, sec_id)
Returns a copy of the vector section.
Parameters
sec_id : int
Returns
flat-float-array
VectorFEM.setsection(self, sec_id, data) → None
Defines the vector section.
Parameters
sec_id : int
data : scalar | flat-float-array
triellipt.fem.mesh_grad(mesh)
Returns the mesh gradient operator.
Parameters
mesh : TriMesh
Returns
TriGrad
Notes
TriGrad operates on nodes-based dataTriGrad.diff_1x() returns x-grad over trianglesTriGrad.diff_1y() returns y-grad over trianglesTriGrad() returns xy-grad over trianglestriellipt.fem.mesh_geom(mesh)
Returns the mesh geometric properties.
Parameters
mesh : TriMesh
Returns
MeshGeom
Notes
MeshGeom object has the following attributes:
areas is a flat-array of triangle areassides is a 3col-table of triangle sidestriellipt.fem.mesh_metric(mesh)
Returns the mesh metric properties.
Parameters
mesh : TriMesh
Returns
MeshMetric
Notes
MeshMetric object has the following attributes:
bcoeffs is a 3col-table of b-coefficients.ccoeffs is a 3col-table of c-coefficients.jacobis is a flat-array of Jacobians.Copyright © 2023, Igor Semenov.