Basic models

MultiNode

class simu.app.models.basic.MultiNode

Bases: AModel, ABC

This abstract model base defines a model with num_in inlets and num_out outlets.

The inlet ports are called in_01, in_02, in_03, etc. The outlet ports are called out_01, out_02, out_03, etc.

Subclasses still need to implement the define() method.

Using this base-class is a good practice to maintain a standard naming of inlet and outlet ports for models with generic character and indistinct ports, such as in mixers or splitters. Please do not do this for Models where ports have individual roles. In that case, individual naming, such as cold_in or gas_out are preferable.

Further, the ports defined in this class do not apply specific material specifications.

Parameters:
  • num_in – The number of inlet streams to consider

  • num_out – The number of outlet streams to consider

in_names() Iterator[str]

A generator to yield the names of all input ports

out_names() Iterator[str]

A generator to yield the names of all output ports

SpeciesBalance

class simu.app.models.basic.SpeciesBalance

Bases: MultiNode

This model balances all species flows between the given inlet and outlet streams.

The implementation handles streams with individual species sets. Naturally, each occurring species must then occur in at least one outlet and one inlet. Otherwise, its partial flow would be forced to zero, which is not accepted by most thermodynamic models (e.g. the ideal mix term \(\ln x_i\) would diverge to negative infinity).

For species \(i\) and port \(j\), the applied balance is

\[\sum_{j \in \mathrm{inlets}} \dot n_{i,j} = \sum_{j \in \mathrm{outlets}} \dot n_{i,j}\]
__init__(
num_in: int = 1,
num_out: int = 1,
tol_unit: str = 'kmol/h',
ignore: Container[str] = None,
)
Parameters:
  • num_in – The number of inlet streams to consider

  • num_out – The number of outlet streams to consider

  • tol_unit – The tolerance unit, representing a typical order of magnitude for the involved flows

  • ignore – For any species provided here, no balance equation will be defined.

ElementBalance

class simu.app.models.basic.ElementBalance

Bases: MultiNode

This model balances all element flows between the given inlet and outlet stream.

Note

For this model to work, the augmenter Elemental has to be applied to the underlying material.

The implementation balances all occurring elements in the inlet and outlet flows. As for SpeciesBalance, each occurring element must be present both in at least one inlet and one outlet.

With \(\nu_{ik}\) being the amount of element \(k\) in a molecule of species \(i\), the following balance equation is defined for each element \(k\):

\[\sum_{j \in \mathrm{inlets}}\sum_{i \in \mathrm{species}} \nu_{ik}\,\dot n_{i,j} = \sum_{j \in \mathrm{outlets}}\sum_{i \in \mathrm{species}} \nu_{ik}\,\dot n_{i,j}\]
__init__(
num_in: int = 1,
num_out: int = 1,
tol_unit: str = 'kmol/h',
ignore: Container[str] = None,
)
Parameters:
  • num_in – The number of inlet streams to consider

  • num_out – The number of outlet streams to consider

  • tol_unit – The tolerance unit, representing a typical order of magnitude for the involved flows

  • ignore – For any element provided here, no balance equation will be defined.

EnthalpyBalance

class simu.app.models.basic.EnthalpyBalance

Bases: MultiNode

This model balances the enthalpy for an adiabatic multi-node:

For ports denoted by index \(j\), the following (scalar) constraint is defined:

\[\sum_{j \in \mathrm{inlets}} \dot H_j = \sum_{j \in \mathrm{outlets}} \dot H_j\]
__init__(num_in: int = 1, num_out: int = 1, tol_unit='MW')
Parameters:
  • num_in – The number of inlet streams to consider

  • num_out – The number of outlet streams to consider

  • tol_unit – The tolerance unit, representing a typical order of magnitude for the involved enthalpy flows

PhaseEquilibrium

class simu.app.models.basic.PhaseEquilibrium

Bases: AModel

This model defines phase equilibrium between two streams by equalizing temperature, pressure, and chemical potential for all common species.

If the species sets of both phases differ, no constraints are defined for the non-common ones.

\[T_1 = T_2,\quad p_1 = p_2,\quad\text{and}\quad \mu_{1,i} = \mu_{2,i} \forall i\in \mathbb S_1 \cup \mathbb S_2\]

The model does not prescribe the nature of the phases, as long as they are independent. As such, the implementation is applicable for any combination of liquid, solid and vapour equilibrium.

This model can also be applied to describe equilibrium between two immiscible (liquid) phases. To do so, however, the material needs to be initialised properly, to avoid the solver to find the trivial solution \(x_i^{(1)} = x_i^{(2)}\) and as such giving a singular equation system.