Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
EquilibriumConditions Class Reference

The class used to define conditions to be satisfied at chemical equilibrium. More...

#include <EquilibriumConditions.hpp>

Public Member Functions

 EquilibriumConditions (ChemicalSystem const &system)
 Construct an EquilibriumSolver object with given chemical system.
 
 EquilibriumConditions (EquilibriumSpecs const &specs)
 Construct an EquilibriumConditions object with given equilibrium specifications.
 
auto temperature (real const &value, String const &unit="K") -> void
 Specify the temperature of the system at chemical equilibrium. More...
 
auto pressure (real const &value, String const &unit="Pa") -> void
 Specify the pressure of the system at chemical equilibrium. More...
 
auto volume (real const &value, String const &unit="m3") -> void
 Specify the volume of the system at chemical equilibrium. More...
 
auto internalEnergy (real const &value, String const &unit="J") -> void
 Specify the internal energy of the system at chemical equilibrium. More...
 
auto enthalpy (real const &value, String const &unit="J") -> void
 Specify the enthalpy of the system at chemical equilibrium. More...
 
auto gibbsEnergy (real const &value, String const &unit="J") -> void
 Specify the Gibbs energy of the system at chemical equilibrium. More...
 
auto helmholtzEnergy (real const &value, String const &unit="J") -> void
 Specify the Helmholtz energy of the system at chemical equilibrium. More...
 
auto entropy (real const &value, String const &unit="J/K") -> void
 Specify the entropy of the system at chemical equilibrium. More...
 
auto charge (real const &value, String const &unit="mol") -> void
 Specify the electric charge at chemical equilibrium. More...
 
auto elementAmount (StringOrIndex const &element, real const &value, String const &unit="mol") -> void
 Specify the amount of an element at chemical equilibrium. More...
 
auto elementAmountInPhase (StringOrIndex const &element, StringOrIndex const &phase, real const &value, String const &unit="mol") -> void
 Specify the amount of an element in a phase at chemical equilibrium. More...
 
auto elementMass (StringOrIndex const &element, real const &value, String const &unit="kg") -> void
 Specify the mass of an element at chemical equilibrium. More...
 
auto elementMassInPhase (StringOrIndex const &element, StringOrIndex const &phase, real const &value, String const &unit="kg") -> void
 Specify the mass of an element in a phase at chemical equilibrium. More...
 
auto phaseAmount (StringOrIndex const &phase, real const &value, String const &unit="mol") -> void
 Specify the amount of a phase at chemical equilibrium. More...
 
auto phaseMass (StringOrIndex const &phase, real const &value, String const &unit="kg") -> void
 Specify the mass of a phase at chemical equilibrium. More...
 
auto phaseVolume (StringOrIndex const &phase, real const &value, String const &unit="m3") -> void
 Specify the volume of a phase at chemical equilibrium. More...
 
auto chemicalPotential (String const &substance, real const &value, String const &unit="J/mol") -> void
 Specify the chemical potential of a substance at chemical equilibrium. More...
 
auto lnActivity (String const &species, real const &value) -> void
 Specify the ln activity of a species at chemical equilibrium. More...
 
auto lgActivity (String const &species, real const &value) -> void
 Specify the lg activity of a species at chemical equilibrium. More...
 
auto activity (String const &species, real const &value) -> void
 Specify the activity of a species at chemical equilibrium. More...
 
auto fugacity (String const &species, real const &value, String const &unit="bar") -> void
 Specify the fugacity of a gaseous species at chemical equilibrium. More...
 
auto pH (real const &value) -> void
 Specify the pH at chemical equilibrium. More...
 
auto pMg (real const &value) -> void
 Specify the pMg at chemical equilibrium. More...
 
auto pE (real const &value) -> void
 Specify the pE at chemical equilibrium. More...
 
auto Eh (real const &value, String const &unit="V") -> void
 Specify the Eh at chemical equilibrium. More...
 
auto setLowerBoundTemperature (double value, String const &unit="K") -> void
 Set the lower bound for temperature during the equilibrium calculation.
 
auto setUpperBoundTemperature (double value, String const &unit="K") -> void
 Set the upper bound for temperature during the equilibrium calculation.
 
auto setLowerBoundPressure (double value, String const &unit="Pa") -> void
 Set the lower bound for pressure during the equilibrium calculation.
 
auto setUpperBoundPressure (double value, String const &unit="Pa") -> void
 Set the upper bound for pressure during the equilibrium calculation.
 
auto setLowerBoundTitrant (String const &substance, double value, String const &unit="mol") -> void
 Set the lower bound for the amount of a titrant during the equilibrium calculation.
 
auto setUpperBoundTitrant (String const &substance, double value, String const &unit="mol") -> void
 Set the upper bound for the amount of a titrant during the equilibrium calculation.
 
auto setLowerBoundsControlVariablesP (ArrayXdConstRef const &values) -> void
 Set the values of the specified lower bounds for the p control variables.
 
auto setUpperBoundsControlVariablesP (ArrayXdConstRef const &values) -> void
 Set the values of the specified upper bounds for the p control variables.
 
auto lowerBoundsControlVariablesP () const -> ArrayXdConstRef
 Get the specified lower bounds for the p control variables.
 
auto upperBoundsControlVariablesP () const -> ArrayXdConstRef
 Get the specified upper bounds for the p control variables.
 
auto set (String const &input, real const &val) -> void
 Set the value of an input variable with given name. More...
 
auto setInputVariable (String const &name, real const &val) -> void
 Set the value of an input variable with given name. More...
 
auto setInputVariable (Index index, real const &val) -> void
 Set the value of an input variable with given index. More...
 
auto setInputVariables (ArrayXrConstRef const &values) -> void
 Set the input variables with given vector of input values.
 
auto inputNames () const -> Strings const &
 Get the names of the input variables associated with the equilibrium conditions.
 
auto inputValues () const -> ArrayXrConstRef
 Get the values of the input variables associated with the equilibrium conditions.
 
auto inputValuesGetOrCompute (ChemicalState const &state0) const -> ArrayXr
 Get the values of the input variables associated with the equilibrium conditions if specified, otherwise fetch them from given initial state.
 
auto inputValue (String const &name) const -> real const &
 Get the value of an input variable with given name. More...
 
auto setInitialComponentAmounts (VectorXdConstRef const &c0) -> void
 Set the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts. More...
 
auto setInitialComponentAmountsFromSpeciesAmounts (VectorXdConstRef const &n0) -> void
 Set the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts. More...
 
auto setInitialComponentAmountsFromState (ChemicalState const &state0) -> void
 Set the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts. More...
 
auto initialComponentAmounts () const -> ArrayXdConstRef
 Get the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts. More...
 
auto initialComponentAmountsGetOrCompute (VectorXdConstRef const &n0) const -> ArrayXd
 Get the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts if available, otherwise compute it. More...
 
auto initialComponentAmountsGetOrCompute (ChemicalState const &state0) const -> ArrayXd
 Get the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts if available, otherwise compute it. More...
 
auto system () const -> ChemicalSystem const &
 Get the chemical system associated with the equilibrium conditions.
 

Detailed Description

The class used to define conditions to be satisfied at chemical equilibrium.

Member Function Documentation

◆ temperature()

auto temperature ( real const &  value,
String const &  unit = "K" 
) -> void

Specify the temperature of the system at chemical equilibrium.

Parameters
valueThe temperature of the system
unitThe unit of the temperature value (must be convertible to K)

◆ pressure()

auto pressure ( real const &  value,
String const &  unit = "Pa" 
) -> void

Specify the pressure of the system at chemical equilibrium.

Parameters
valueThe pressure of the system
unitThe unit of the pressure value (must be convertible to Pa)

◆ volume()

auto volume ( real const &  value,
String const &  unit = "m3" 
) -> void

Specify the volume of the system at chemical equilibrium.

Parameters
valueThe volume of the system
unitThe unit of the volume value (must be convertible to m3)

◆ internalEnergy()

auto internalEnergy ( real const &  value,
String const &  unit = "J" 
) -> void

Specify the internal energy of the system at chemical equilibrium.

Parameters
valueThe internal energy of the system
unitThe unit of the internal energy value (must be convertible to J)

◆ enthalpy()

auto enthalpy ( real const &  value,
String const &  unit = "J" 
) -> void

Specify the enthalpy of the system at chemical equilibrium.

Parameters
valueThe enthalpy of the system
unitThe unit of the enthalpy value (must be convertible to J)

◆ gibbsEnergy()

auto gibbsEnergy ( real const &  value,
String const &  unit = "J" 
) -> void

Specify the Gibbs energy of the system at chemical equilibrium.

Parameters
valueThe Gibbs energy of the system
unitThe unit of the Gibbs energy value (must be convertible to J)

◆ helmholtzEnergy()

auto helmholtzEnergy ( real const &  value,
String const &  unit = "J" 
) -> void

Specify the Helmholtz energy of the system at chemical equilibrium.

Parameters
valueThe Helmholtz energy of the system
unitThe unit of the Helmholtz energy value (must be convertible to J)

◆ entropy()

auto entropy ( real const &  value,
String const &  unit = "J/K" 
) -> void

Specify the entropy of the system at chemical equilibrium.

Parameters
valueThe entropy of the system
unitThe unit of the entropy value (must be convertible to J/K)

◆ charge()

auto charge ( real const &  value,
String const &  unit = "mol" 
) -> void

Specify the electric charge at chemical equilibrium.

Parameters
valueThe electric charge amount in the system
unitThe unit of the electric charge value (must be convertible to mol)

◆ elementAmount()

auto elementAmount ( StringOrIndex const &  element,
real const &  value,
String const &  unit = "mol" 
) -> void

Specify the amount of an element at chemical equilibrium.

Parameters
elementThe name or index of the element in the system
valueThe amount of an element in the system
unitThe unit of the element amount value (must be convertible to mol)

◆ elementAmountInPhase()

auto elementAmountInPhase ( StringOrIndex const &  element,
StringOrIndex const &  phase,
real const &  value,
String const &  unit = "mol" 
) -> void

Specify the amount of an element in a phase at chemical equilibrium.

Parameters
elementThe name or index of the element in the system
phaseThe name or index of the phase in the system
valueThe amount of an element in a phase
unitThe unit of the element amount value (must be convertible to mol)

◆ elementMass()

auto elementMass ( StringOrIndex const &  element,
real const &  value,
String const &  unit = "kg" 
) -> void

Specify the mass of an element at chemical equilibrium.

Parameters
elementThe name or index of the element in the system
valueThe mass of an element in the system
unitThe unit of the element mass value (must be convertible to kg)

◆ elementMassInPhase()

auto elementMassInPhase ( StringOrIndex const &  element,
StringOrIndex const &  phase,
real const &  value,
String const &  unit = "kg" 
) -> void

Specify the mass of an element in a phase at chemical equilibrium.

Parameters
elementThe name or index of the element in the system
phaseThe name or index of the phase in the system
valueThe mass of an element in a phase
unitThe unit of the element mass value (must be convertible to kg)

◆ phaseAmount()

auto phaseAmount ( StringOrIndex const &  phase,
real const &  value,
String const &  unit = "mol" 
) -> void

Specify the amount of a phase at chemical equilibrium.

Parameters
phaseThe name or index of the phase in the system
valueThe amount of a phase in the system
unitThe unit of the phase amount value (must be convertible to mol)

◆ phaseMass()

auto phaseMass ( StringOrIndex const &  phase,
real const &  value,
String const &  unit = "kg" 
) -> void

Specify the mass of a phase at chemical equilibrium.

Parameters
phaseThe name or index of the phase in the system
valueThe mass of a phase in the system
unitThe unit of the phase mass value (must be convertible to kg)

◆ phaseVolume()

auto phaseVolume ( StringOrIndex const &  phase,
real const &  value,
String const &  unit = "m3" 
) -> void

Specify the volume of a phase at chemical equilibrium.

Parameters
phaseThe name or index of the phase in the system
valueThe volume of a phase in the system
unitThe unit of the phase volume value (must be convertible to m3)

◆ chemicalPotential()

auto chemicalPotential ( String const &  substance,
real const &  value,
String const &  unit = "J/mol" 
) -> void

Specify the chemical potential of a substance at chemical equilibrium.

Parameters
substanceThe chemical formula of the substance.
valueThe constrained chemical potential value.
unitThe unit for the constrained chemical potential value (must be convertible to J/mol).
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider a chemical potential constraint for the substance.

◆ lnActivity()

auto lnActivity ( String const &  species,
real const &  value 
) -> void

Specify the ln activity of a species at chemical equilibrium.

Parameters
speciesThe name of the chemical species.
valueThe constrained ln activity value.
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider an activity constraint for the species.

◆ lgActivity()

auto lgActivity ( String const &  species,
real const &  value 
) -> void

Specify the lg activity of a species at chemical equilibrium.

Parameters
speciesThe name of the chemical species.
valueThe constrained lg activity value.
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider an activity constraint for the species.

◆ activity()

auto activity ( String const &  species,
real const &  value 
) -> void

Specify the activity of a species at chemical equilibrium.

Parameters
speciesThe name of the chemical species.
valueThe constrained activity value.
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider an activity constraint for the species.

◆ fugacity()

auto fugacity ( String const &  species,
real const &  value,
String const &  unit = "bar" 
) -> void

Specify the fugacity of a gaseous species at chemical equilibrium.

Parameters
speciesThe name of the gaseous species.
valueThe constrained fugacity value.
unitThe unit for the constrained fugacity value (must be convertible to Pa; default is bar).
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider a fugacity constraint for the gas.

◆ pH()

auto pH ( real const &  value) -> void

Specify the pH at chemical equilibrium.

Parameters
valueThe constrained value for pH.
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider a pH constraint.

◆ pMg()

auto pMg ( real const &  value) -> void

Specify the pMg at chemical equilibrium.

Parameters
valueThe constrained value for pMg.
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider a pMg constraint.

◆ pE()

auto pE ( real const &  value) -> void

Specify the pE at chemical equilibrium.

Parameters
valueThe constrained value for pE.
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider a pE constraint.

◆ Eh()

auto Eh ( real const &  value,
String const &  unit = "V" 
) -> void

Specify the Eh at chemical equilibrium.

Parameters
valueThe constrained value for Eh.
unitThe unit of the constrained value for Eh (must be convertible to V).
Warning
An error is thrown if the specifications for the chemical equilibrium calculation
do not consider an Eh constraint.

◆ set()

auto set ( String const &  input,
real const &  val 
) -> void

Set the value of an input variable with given name.

Parameters
nameThe unique name of the input variable.
valueThe new value of the input variable.
Warning
An error is thrown if there are no input variable with given name.

◆ setInputVariable() [1/2]

auto setInputVariable ( String const &  name,
real const &  val 
) -> void

Set the value of an input variable with given name.

Parameters
nameThe unique name of the input variable.
valueThe new value of the input variable.
Warning
An error is thrown if there are no input variable with given name.

◆ setInputVariable() [2/2]

auto setInputVariable ( Index  index,
real const &  val 
) -> void

Set the value of an input variable with given index.

Parameters
indexThe index of the input variable.
valueThe new value of the input variable.
Warning
An error is thrown if given index is out of bounds.

◆ inputValue()

auto inputValue ( String const &  name) const -> real const &

Get the value of an input variable with given name.

Parameters
nameThe unique name of the input variable

◆ setInitialComponentAmounts()

auto setInitialComponentAmounts ( VectorXdConstRef const &  c0) -> void

Set the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts.

Parameters
c0The initial amounts of the conservative components \(c^\circ\).

◆ setInitialComponentAmountsFromSpeciesAmounts()

auto setInitialComponentAmountsFromSpeciesAmounts ( VectorXdConstRef const &  n0) -> void

Set the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts.

This method sets the initial amounts of the conservative components \(c^\circ\) using \(c^\circ=Cn^\circ\) where \(C\) is the conservation matrix of the species with respect to the conservative components and \(n^\circ\) is the given initial amounts of the species.

Parameters
n0The initial amounts of the species \(n^\circ\).

◆ setInitialComponentAmountsFromState()

auto setInitialComponentAmountsFromState ( ChemicalState const &  state0) -> void

Set the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts.

This method sets the initial amounts of the conservative components \(c^\circ\) using \(c^\circ=Cn^\circ\) where \(C\) is the conservation matrix of the species with respect to the conservative components and \(n^\circ\) is the initial amounts of the species given in a initial chemical state of the system.

Parameters
state0The initial state of the system.

◆ initialComponentAmounts()

auto initialComponentAmounts ( ) const -> ArrayXdConstRef

Get the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts.

The amounts of conservative components can be set directly using setInitialComponentAmounts or indirectly using setInitialComponentAmountsFromSpeciesAmounts and setInitialComponentAmountsFromState. If none of these methods have been called, and empty array is returned by this method.

◆ initialComponentAmountsGetOrCompute() [1/2]

auto initialComponentAmountsGetOrCompute ( VectorXdConstRef const &  n0) const -> ArrayXd

Get the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts if available, otherwise compute it.

If neither setInitialSpeciesAmounts nor setInitialComponentAmounts have been used before to set the initial amounts of the conservative components \(c^\circ\), then this vector is computed using a given vector \(n^\circ\) with the initial amounts of species. Otherwise, the existing values for \(c^\circ\) is returned instead.

Parameters
n0The initial amounts of the species \(n^\circ\) used to compute \(c^\circ\) in case it has not been set before.

◆ initialComponentAmountsGetOrCompute() [2/2]

auto initialComponentAmountsGetOrCompute ( ChemicalState const &  state0) const -> ArrayXd

Get the initial amounts of the conservative components \(c^\circ\) before the chemical system reacts if available, otherwise compute it.

Parameters
state0The initial state of the system from which the initial amounts of the species \(n^\circ\) are collected if needed.

The documentation for this class was generated from the following file: