mtnlion.formulas.approximation module

Tools for approximating functions

class mtnlion.formulas.approximation.LagrangeMultiplier(domains: List[str], trial_name: str, lm_name: str = None)[source]

Bases: mtnlion.formula.Formula

This formula provides Lagrange Multiplier functionality for domain boundaries.

form(arguments: mtnlion.formula.Arguments, domain: str) → ufl.core.expr.Expr[source]

This method must be overloaded to define the form of the Formula.

Parameters
  • arguments – All arguments defined by overriding one or more of Formula.Variables, Formula.Formulas, Formula.Parameters, Formula.Lambdas, and Formula.TimeDiscretization

  • domain – The current domain in which the function is being evaluated

Returns

FFL form

class mtnlion.formulas.approximation.Legendre(num_functions: int)[source]

Bases: object

Generate Legendre matrices from Eqs. (3.30) and (3.31) in “Continuum-Scale Lithium-Ion Battery Cell Model in FEniCS”

K
static Kmn(row: int, col: int) → float[source]

Calculate the Kmn matrix entries

Parameters
  • row – row to calculate

  • col – column to calculate

M
static Mmn(row: int, col: int) → float[source]

Calculate the Mmn matrix entries

Parameters
  • row – row to calculate

  • col – column to calculate