mtnlion.model module

Provides a class interface for defining FEM models.

class mtnlion.model.Model(minimum_rothes_order: int = 1)[source]

Bases: object

Abstract class for defining FEM models.

add_formula(*forms) → mtnlion.model.Model[source]

Add a formulae to the model :param forms: formulas to add

check() → None[source]

Perform high-level sanity checks to ensure the model is correctly defined.

Returns

None

domains

Retrieve a list of domains used in this model.

Returns

Tuple of sorted domain strings

exclude_formulas(formula_names: Iterable[str] = (), formula_types: Iterable[Type] = ())[source]

Exclude a formula definition from assembly.

This function will remove any object instances from the assembly list that match the given name or class definition.

Parameters
  • formula_names – Name of the formula(s) to remove

  • formula_types – Class of the formula(s) to remove

Returns

None

formula_by_name(name: str) → mtnlion.formula.Formula[source]

Retrieve a Formula object by name from the list of formulas.

Parameters

name – name of the formula

Returns

formula object

rename_parameter(old: str, new: str) → None[source]

Rename a given parameter defined in the model to a new name.

Parameters
  • old – Parameter to rename

  • new – New name

Returns

None

rename_variable(old: str, new: str) → None[source]

Rename a given variable defined in the model to a new name.

Parameters
  • old – Parameter to rename

  • new – New name

Returns

None

replace_formulas(*formulas) → mtnlion.model.Model[source]

Replace an existing formula with a new formula. The formulas are replaced by name.

Parameters

formulas – New formula

Returns

None

variable_by_name(name: str) → mtnlion.variable.Variable[source]

Retrieve a Variable object by name from the list of variables.

Parameters

name – name of the variable

Returns

variable object