sandlerchemeq.chemeqsystem

Chemical equilibrium system solver

class ChemEqSystem[source]

Bases: object

Chemical equilibrium system solver using either explicit reactions with equilibrium constants or implicit Lagrange multiplier method.

Pstdst: Quantity = <Quantity(1.0, 'bar')>

Standard state pressure

T0: Quantity = <Quantity(298.15, 'kelvin')>

Standard state temperature

P: Quantity

System pressure

T: Quantity

System temperature

components: list[Component]

List of all components in the system

N0: ndarray

Initial moles of each component

__init__(P=<factory>, T=<factory>, components=<factory>, N0=<factory>, reactions=<factory>, N=<factory>, ys=<factory>)
Parameters:
Return type:

None

reactions: list[Reaction]

List of explicit reactions in the system

N: ndarray

Moles of each component at equilibrium

ys: ndarray

Mole fractions of each component at equilibrium

solve_implicit(Xinit=None, ideal=True, simplified=False)[source]

Implicit solution of M equations using equilibrium constants. Solutions are stored in attributes Xeq, N, and ys.

Parameters:
  • Xinit (list, optional) – Initial guess for extent of reaction (default is zeros)

  • ideal (bool, optional) – Whether to assume ideal behavior (default is True)

  • simplified (bool, optional) – Whether to use simplified van’t Hoff equation (default is False). Use False (full van’t Hoff with Cp correction) to match the Lagrange solver. True omits the heat-capacity correction and is provided for educational comparison only.

solve_lagrange(ideal=True, zInit=[])[source]

Implicit solution of chemical equilibrium system using Lagrange multipliers. Solutions are stored in attributes N and ys.

Parameters:
  • ideal (bool, optional) – Whether to assume ideal behavior (default is True) (NOT USED)

  • zInit (np.ndarray, optional) – Initial guess for mole numbers and Lagrange multipliers (default is [])

report()[source]

Generates a textual report of the chemical equilibrium system.

Returns:

Textual report of reactions and mole fractions at equilibrium

Return type:

str