The class used to define chemical equilibrium problems. More...
#include <EquilibriumProblem.hpp>
Public Member Functions | |
EquilibriumProblem (const ChemicalSystem &system) | |
Construct an EquilibriumProblem object with given chemical system. | |
EquilibriumProblem (const EquilibriumSpecs &specs) | |
Construct an EquilibriumProblem object with given specifications. | |
auto | startWithTemperature (real value) -> void |
Specify an initial temperature condition for the chemical system (in K). More... | |
auto | startWithTemperature (real value, Chars unit) -> void |
Specify an initial temperature condition for the chemical system. More... | |
auto | startWithPressure (real value) -> void |
Specify an initial pressure condition for the chemical system. More... | |
auto | startWithPressure (real value, Chars unit) -> void |
Specify an initial pressure condition for the chemical system. More... | |
auto | startWithSpeciesAmounts (ArrayXrConstRef n) -> void |
Specify an initial condition for the species amounts. More... | |
auto | startWith (String species, real value, Chars unit) -> void |
auto | startWith (Index ispecies, real value, Chars unit) -> void |
Specify an initial condition for the abundance of a chemical species. More... | |
auto | startWithState (const ChemicalState &state) -> void |
Specify an initial condition for temperature, pressure, and species amounts with a given chemical state. More... | |
auto | startWithComponentAmounts (ArrayXrConstRef b) -> void |
Specify the initial condition for the amounts of the conservative components. More... | |
auto | initialTemperature () const -> real |
Return the initial temperature of the system in the equilibrium calculation (in K). | |
auto | initialPressure () const -> real |
Return the initial pressure of the system in the equilibrium calculation (in Pa). | |
auto | initialSpeciesAmounts () const -> ArrayXrConstRef |
Return the initial amounts of the species in the equilibrium calculation (in mol). | |
auto | initialComponentAmounts () const -> ArrayXr |
Return the initial amounts of the conservative components in the equilibrium calculation (in mol). | |
auto | system () const -> ChemicalSystem const & |
Get the chemical system associated with the equilibrium conditions. | |
![]() | |
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. | |
![]() | |
EquilibriumRestrictions (ChemicalSystem const &system) | |
Construct an EquilibriumRestrictions object. | |
auto | cannotReact (Index ispecies) -> void |
Prevent the amount of a species from changing during the chemical equilibrium calculation. More... | |
auto | cannotReact (String species) -> void |
Prevent the amount of a species from changing during the chemical equilibrium calculation. More... | |
auto | cannotIncrease (Index ispecies) -> void |
Prevent the amount of a species from increasing during the chemical equilibrium calculation. More... | |
auto | cannotIncrease (String species) -> void |
Prevent the amount of a species from increasing during the chemical equilibrium calculation. More... | |
auto | cannotIncreaseAbove (Index ispecies, double value, Chars unit="mol") -> void |
Prevent the amount/mass of a species from increasing above a value during the chemical equilibrium calculation. More... | |
auto | cannotIncreaseAbove (String species, double value, Chars unit="mol") -> void |
Prevent the amount/mass of a species from increasing above a value during the chemical equilibrium calculation. More... | |
auto | cannotDecrease (Index ispecies) -> void |
Prevent the amount of a species from decreasing during the chemical equilibrium calculation. More... | |
auto | cannotDecrease (String species) -> void |
Prevent the amount of a species from decreasing during the chemical equilibrium calculation. More... | |
auto | cannotDecreaseBelow (Index ispecies, double value, Chars unit="mol") -> void |
Prevent the amount/mass of a species from decreasing below a value during the chemical equilibrium calculation. More... | |
auto | cannotDecreaseBelow (String species, double value, Chars unit="mol") -> void |
Prevent the amount/mass of a species from decreasing below a value during the chemical equilibrium calculation. More... | |
auto | canReactFreely (Index ispecies) -> void |
Remove any previously set increase/decrease restriction on the amount of a species. More... | |
auto | canReactFreely (String species) -> void |
Remove any previously set increase/decrease restriction on the amount of a species. More... | |
auto | canIncreaseFreely (Index ispecies) -> void |
Remove any previously set increase restriction on the amount of a species. More... | |
auto | canIncreaseFreely (String species) -> void |
Remove any previously set increase restriction on the amount of a species. More... | |
auto | canDecreaseFreely (Index ispecies) -> void |
Remove any previously set decrease restriction on the amount of a species. More... | |
auto | canDecreaseFreely (String species) -> void |
Remove any previously set decrease restriction on the amount of a species. More... | |
auto | system () const -> ChemicalSystem const & |
Return the chemical system associated with the equilibrium conditions. | |
auto | speciesCannotIncrease () const -> Set< Index > const & |
Return the indices of the species whose amounts cannot increase. | |
auto | speciesCannotDecrease () const -> Set< Index > const & |
Return the indices of the species whose amounts cannot decrease. | |
auto | speciesCannotIncreaseAbove () const -> Map< Index, double > const & |
Return the indices of the species whose amounts cannot increase above a given value. | |
auto | speciesCannotDecreaseBelow () const -> Map< Index, double > const & |
Return the indices of the species whose amounts cannot decrease below a given value. | |
Detailed Description
The class used to define chemical equilibrium problems.
Member Function Documentation
◆ startWithTemperature() [1/2]
auto startWithTemperature | ( | real | value | ) | -> void |
Specify an initial temperature condition for the chemical system (in K).
- Parameters
-
value The initial temperature of the system.
◆ startWithTemperature() [2/2]
Specify an initial temperature condition for the chemical system.
- Parameters
-
value The initial temperature of the system. unit The temperature unit (must be convertible to K).
◆ startWithPressure() [1/2]
auto startWithPressure | ( | real | value | ) | -> void |
Specify an initial pressure condition for the chemical system.
- Parameters
-
value The initial pressure of the system.
◆ startWithPressure() [2/2]
Specify an initial pressure condition for the chemical system.
- Parameters
-
value The initial pressure of the system. unit The pressure unit (must be convertible to Pa).
◆ startWithSpeciesAmounts()
auto startWithSpeciesAmounts | ( | ArrayXrConstRef | n | ) | -> void |
Specify an initial condition for the species amounts.
- Parameters
-
n The array with the initial amounts of the species (in mol).
◆ startWith() [1/2]
- Parameters
-
species The name of the species in the chemical system. value The amount or mass value of the species. unit The amount or mass unit (must be convertible to mol or kg).
- Warning
- An error is thrown if the chemical system has no species with name
species
.
◆ startWith() [2/2]
Specify an initial condition for the abundance of a chemical species.
- Parameters
-
ispecies The index of the species in the chemical system. value The amount or mass value of the species. unit The amount or mass unit (must be convertible to mol or kg).
◆ startWithState()
auto startWithState | ( | const ChemicalState & | state | ) | -> void |
Specify an initial condition for temperature, pressure, and species amounts with a given chemical state.
- Note
- This method overwrites all previous
startWith
,startWithTemperature
, -
startWithPressure
, andstartWithSpeciesAmounts
method calls.
- Parameters
-
state The chemical state representing the initial conditions of the system.
◆ startWithComponentAmounts()
auto startWithComponentAmounts | ( | ArrayXrConstRef | b | ) | -> void |
Specify the initial condition for the amounts of the conservative components.
These component amounts are conserved at chemical equilibrium only if the system is closed. If the system is open to one or more substances, these given initial component amounts will differ from those computed at chemical equilibrium. The difference correspond to how much each titrant (i.e., the substance for which the system is open to) entered or leaved the system.
- Note
- This method has higher priority than the other methods that specify initial conditions for the abundance of chemical species:
- EquilibriumProblem::startWith
- EquilibriumProblem::startWithSpeciesAmounts
- EquilibriumProblem::startWithState
By using this method, the chemical equilibrium calculation will use the specified component amounts instead of computing them from the initial condition for the species amounts. In this case, the provided conditions for species amounts will be solely used as initial guess for the equilibrium computation. The provided species amounts may not be consistent with the given component amounts here (i.e., there is mass imbalance between initial condition for species amounts and the amounts of the components that constitute the species). At the end of a successfull calculation, this imbalance is resolved, and the species amounts are consistent with the component amounts in terms of mass conservation. This is true provided the chemical system is not open to other substances, in which case, mass conservation also considers these substances as well.
- Parameters
-
b The array with the initial amounts of the components (in mol)
The documentation for this class was generated from the following file:
- Reaktoro/Equilibrium/EquilibriumProblem.hpp