Assemblers

FEMpy.Assemblers.assemble_matrix(coeff_funct, mesh, trial_basis, test_basis, derivative_order_trial, derivative_order_test)[source]

Construct the finite element stiffness matrix. Meant to be used in a FEMpy.Solvers solve method.

Parameters:
  • coeff_funct (function) – Function name of the coefficient function c(x(,y,…)) in a Poisson equation.
  • mesh ({FEMpy.Mesh.Interval1D, FEMpy.Mesh.TriangularMesh2D}) – A Mesh class defining the mesh and associated information matrices.
  • trial_basis, test_basis ({:class: FEMpy.FEBasis.IntervalBasis1D, :class: FEMpy.FEBasis.TriangularBasis2D}) – A :class: FEBasis class defining the finite element basis functions for the trial and test bases.
  • derivative_order_trial, derivative_order_test (int or tuple of int) – The derivative order to be applied to the finite element basis functions. If basis function is one-dimensional, this should be specified as an int. Otherwise, the derivative order should be specified as a tuple with the orders corresponding to the coordinate axes in the basis functions. e.g., (`x_order`, `y_order`,...).
Returns:

The finite element stiffness matrix as a row-based linked list sparse matrix.

Return type:

sparse matrix

FEMpy.Assemblers.assemble_vector(source_funct, mesh, test_basis, derivative_order_test)[source]

Constructs the finite element load vector. Meant to be used in a FEMpy.Solvers solve method.

Parameters:
  • source_funct (function) – The nonhomogeneous source function f(x(,y,…)) of the Poisson equation.
  • mesh ({FEMpy.Mesh.Interval1D, FEMpy.Mesh.TriangularMesh2D}) – A Mesh class defining the mesh and associated information matrices.
  • test_basis ({:class: FEMpy.FEBasis.IntervalBasis1D, :class: FEMpy.FEBasis.TriangularBasis2D}) – A :class: FEBasis class defining the finite element basis functions for the test basis.
  • derivative_order_test (int or tuple of int) – The derivative order to be applied to the finite element basis function. If basis function is one-dimensional, this should be specified as an int. Otherwise, the derivative order should be specified as a tuple with the orders corresponding to the coordinate axes in the basis functions. e.g., (`x_order`, `y_order`,...).
Returns:

The finite element load vector.

Return type:

ndarray