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

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

#include <EquilibriumSpecs.hpp>

Public Member Functions

 EquilibriumSpecs (ChemicalSystem const &system)
 Construct an EquilibriumSpecs object.
 
auto temperature () -> void
 Specify that the temperature of the system is given at chemical equilibrium. More...
 
auto pressure () -> void
 Specify that the pressure of the system is given at chemical equilibrium. More...
 
auto volume () -> void
 Specify that the volume of the system is given at chemical equilibrium. More...
 
auto internalEnergy () -> void
 Specify that the internal energy of the system is given at chemical equilibrium. More...
 
auto enthalpy () -> void
 Specify that the enthalpy of the system is given at chemical equilibrium. More...
 
auto gibbsEnergy () -> void
 Specify that the Gibbs energy of the system is given at chemical equilibrium. More...
 
auto helmholtzEnergy () -> void
 Specify that the Helmholtz energy of the system is given at chemical equilibrium. More...
 
auto entropy () -> void
 Specify that the entropy of the system is given at chemical equilibrium. More...
 
auto charge () -> void
 Specify that the electric charge is given at chemical equilibrium.
 
auto elementAmount (StringOrIndex const &element) -> void
 Specify that the amount of an element is given at chemical equilibrium. More...
 
auto elementAmountInPhase (StringOrIndex const &element, StringOrIndex const &phase) -> void
 Specify that the amount of an element in a phase is given at chemical equilibrium. More...
 
auto elementMass (StringOrIndex const &element) -> void
 Specify that the mass of an element is given at chemical equilibrium. More...
 
auto elementMassInPhase (StringOrIndex const &element, StringOrIndex const &phase) -> void
 Specify that the mass of an element in a phase is given at chemical equilibrium. More...
 
auto phaseAmount (StringOrIndex const &phase) -> void
 Specify that the amount of a phase is given at chemical equilibrium. More...
 
auto phaseMass (StringOrIndex const &phase) -> void
 Specify that the mass of a phase is given at chemical equilibrium. More...
 
auto phaseVolume (StringOrIndex const &phase) -> void
 Specify that the volume of a phase is given at chemical equilibrium. More...
 
auto unknownTemperature () -> void
 Specify that the temperature of the system is unknown in the chemical equilibrium calculation. More...
 
auto unknownPressure () -> void
 Specify that the pressure of the system is unknown in the chemical equilibrium calculation. More...
 
auto chemicalPotential (String substance) -> void
 Specify that the chemical potential of a substance is given at chemical equilibrium. More...
 
auto lnActivity (Species const &species) -> void
 Specify that the ln activity of a species is given at chemical equilibrium. More...
 
auto lnActivity (String species) -> void
 Specify that the ln activity of a species is given at chemical equilibrium. More...
 
auto lgActivity (String species) -> void
 Specify that the lg activity of a species is given at chemical equilibrium. More...
 
auto activity (String species) -> void
 Specify that the activity of a species is given at chemical equilibrium. More...
 
auto fugacity (String gas) -> void
 Specify that the fugacity of a gaseous species is given at chemical equilibrium. More...
 
auto pH () -> void
 Specify that the pH is given at chemical equilibrium. More...
 
auto pMg () -> void
 Specify that pMg is given at chemical equilibrium. More...
 
auto pE () -> void
 Specify that pE is given at chemical equilibrium. More...
 
auto Eh () -> void
 Specify that Eh is given at chemical equilibrium. More...
 
auto openTo (ChemicalFormula const &substance) -> void
 Specify that the chemical system is open to a substance. More...
 
auto addUnknownTitrantAmount (ChemicalFormula const &substance) -> void
 Specify that the chemical system is open to a given chemical state. // TODO: Implement EquilibriumSpecs::auto openTo(ChemicalState const& state). More...
 
auto numInputs () const -> Index
 Return the number of introduced input variables.
 
auto numControlVariables () const -> Index
 Return the number of all introduced control variables.
 
auto numControlVariablesP () const -> Index
 Return the number of introduced p control variables.
 
auto numControlVariablesQ () const -> Index
 Return the number of introduced q control variables.
 
auto numTitrants () const -> Index
 Return the number of all introduced explicit and implicit titrants.
 
auto numTitrantsExplicit () const -> Index
 Return the number of all introduced explicit titrants.
 
auto numTitrantsImplicit () const -> Index
 Return the number of all introduced implicit titrants.
 
auto numEquationConstraints () const -> Index
 Return the number of all introduced equation constraints.
 
auto numReactivityConstraints () const -> Index
 Return the number of all introduced reactivity constraints.
 
auto numConstraints () const -> Index
 Return the number of all introduced equation, reactivity, and chemical potential constraints.
 
auto numConservativeComponents () const -> Index
 Return the number of the conservative components in the equilibrium problem specifications.
 
auto namesInputs () const -> Strings
 Return the names of the introduced input variables.
 
auto namesControlVariables () const -> Strings
 Return the names of all introduced control variables.
 
auto namesControlVariablesP () const -> Strings
 Return the names of introduced p control variables.
 
auto namesControlVariablesQ () const -> Strings
 Return the names of introduced q control variables.
 
auto namesTitrants () const -> Strings
 Return the names of all introduced explicit and implicit titrants.
 
auto namesTitrantsExplicit () const -> Strings
 Return the names of all introduced explicit titrants.
 
auto namesTitrantsImplicit () const -> Strings
 Return the names of all introduced implicit titrants.
 
auto namesConstraints () const -> Strings
 Return the names of all introduced equation and chemical potential constraints.
 
auto namesConservativeComponents () const -> Strings
 Return the names of the conservative components in the equilibrium problem specifications.
 
auto addControlVariableQ (ControlVariableQ const &qvar) -> void
 Add a q control variable in the specification of the chemical equilibrium problem.
 
auto addControlVariableP (ControlVariableP const &pvar) -> void
 Add a p control variable in the specification of the chemical equilibrium problem.
 
auto addConstraint (EquationConstraint const &constraint) -> void
 Add an equation constraint to be satisfied at chemical equilibrium.
 
auto addConstraints (EquationConstraints const &constraints) -> void
 Add a system of equation constraints to be satisfied at chemical equilibrium.
 
auto addReactivityConstraint (ReactivityConstraint const &constraint) -> void
 Add a reactivity constraint to be satisfied at chemical equilibrium.
 
auto addReactivityConstraints (ReactivityConstraints const &constraints) -> void
 Add a system of reactivity constraints to be satisfied at chemical equilibrium.
 
auto addInput (String const &var) -> Index
 Add a new input variable for the chemical equilibrium problem with name var.
 
auto system () const -> ChemicalSystem const &
 Return the chemical system associated with the equilibrium conditions.
 
auto inputs () const -> Strings const &
 Return the input variables in the chemical equilibrium specifications.
 
auto isTemperatureUnknown () const -> bool
 Return true if temperature is unknown in the chemical equilibrium specifications.
 
auto isPressureUnknown () const -> bool
 Return true if pressure is unknown in the chemical equilibrium specifications.
 
auto indexTemperatureAmongInputVariables () const -> Index
 Return the index of temperature in the vector of w input variables if it is an input, otherwise Index(-1) if unknown.
 
auto indexTemperatureAmongControlVariablesP () const -> Index
 Return the index of temperature in the vector of p control variables if it is unknown, otherwise Index(-1) if known.
 
auto indexPressureAmongInputVariables () const -> Index
 Return the index of pressure in the vector of w input variables if it is an input, otherwise Index(-1) if unknown.
 
auto indexPressureAmongControlVariablesP () const -> Index
 Return the index of pressure in the vector of p control variables if it is unknown, otherwise Index(-1) if known.
 
auto indexInputVariable (String const &name) const -> Index
 Return the index of a w input variable with given name if found, otherwise the number of w input variables.
 
auto indexControlVariableP (String const &name) const -> Index
 Return the index of a p control variable with given name if found, otherwise the number of p control variables.
 
auto indexControlVariableQ (String const &name) const -> Index
 Return the index of a q control variable with given name if found, otherwise the number of q control variables.
 
auto controlVariablesQ () const -> Vec< ControlVariableQ > const &
 Return the q control variables in the chemical equilibrium specifications.
 
auto controlVariablesP () const -> Vec< ControlVariableP > const &
 Return the q control variables in the chemical equilibrium specifications.
 
auto titrants () const -> Vec< ChemicalFormula >
 Return the chemical formulas of the explicit and implicit titrant substances.
 
auto titrantsExplicit () const -> Vec< ChemicalFormula >
 Return the chemical formulas of the explicit titrant substances.
 
auto titrantsImplicit () const -> Vec< ChemicalFormula >
 Return the chemical formulas of the implicit titrant substances.
 
auto equationConstraintsSingle () const -> Vec< EquationConstraint > const &
 Return the specified single equation constraints to be satisfied at chemical equilibrium.
 
auto equationConstraintsSystem () const -> Vec< EquationConstraints > const &
 Return the specified systems of equation constraints to be satisfied at chemical equilibrium.
 
auto reactivityConstraintsSingle () const -> Vec< ReactivityConstraint > const &
 Return the specified single reactivity constraints to be satisfied at chemical equilibrium.
 
auto reactivityConstraintsSystem () const -> Vec< ReactivityConstraints > const &
 Return the specified systems of reactivity constraints to be satisfied at chemical equilibrium.
 
auto assembleEquationConstraints () const -> EquationConstraints
 Assemble the complete system of equation constraints to be satisfied at chemical equilibrium. More...
 
auto assembleReactivityConstraints () const -> ReactivityConstraints
 Assemble the complete system of reactivity constraints to be satisfied at chemical equilibrium. More...
 
auto assembleReactivityConstraintsMatrixKn () const -> MatrixXd
 Assemble the coefficient matrix Kn of the reactivity constraints with respect to n species amount variables.
 
auto assembleReactivityConstraintsMatrixKp () const -> MatrixXd
 Assemble the coefficient matrix Kp of the reactivity constraints with respect to p control variables.
 
auto assembleConservationMatrix () const -> MatrixXd
 Assemble the conservation matrix for the chemical species with respect to the conservative components. More...
 
auto assembleConservationMatrixN () const -> MatrixXd
 Assemble the conservation matrix for the n species amount variables with respect to the conservative components. More...
 
auto assembleConservationMatrixQ () const -> MatrixXd
 Assemble the conservation matrix for the q control variables with respect to the conservative components.
 
auto assembleConservationMatrixP () const -> MatrixXd
 Assemble the conservation matrix for the p control variables with respect to the conservative components.
 

Static Public Member Functions

static auto TP (ChemicalSystem const &system) -> EquilibriumSpecs
 Return specifications for a chemical equilbrium problem with given temperature (T) and pressure (P).
 
static auto HP (ChemicalSystem const &system) -> EquilibriumSpecs
 Return specifications for a chemical equilbrium problem with given enthalpy (H) and pressure (P).
 
static auto TV (ChemicalSystem const &system) -> EquilibriumSpecs
 Return specifications for a chemical equilbrium problem with given temperature (T) and volume (V).
 
static auto UV (ChemicalSystem const &system) -> EquilibriumSpecs
 Return specifications for a chemical equilbrium problem with given internal (U) energy and volume (V).
 
static auto SP (ChemicalSystem const &system) -> EquilibriumSpecs
 Return specifications for a chemical equilbrium problem with given entropy (S) and pressure (P).
 
static auto SV (ChemicalSystem const &system) -> EquilibriumSpecs
 Return specifications for a chemical equilbrium problem with given entropy (S) and volume (V).
 

Detailed Description

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

Explicit Titrants

The explicit titrants are the titrants introduced with method EquilibriumSpecs::openTo. In the code below, the names of the explicitly introduced titrants are shown:

using namespace Reaktoro;
EquilibriumSpecs specs(system); // for some ChemicalSystem object `system`
specs.openTo("H2S"); // a titrant named [H2S] will be introduced.
specs.openTo("CO2"); // a titrant named [CO2] will be introduced.
EquilibriumSpecs(ChemicalSystem const &system)
Construct an EquilibriumSpecs object.
auto system() const -> ChemicalSystem const &
Return the chemical system associated with the equilibrium conditions.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29

The amounts of these explicit titrants are unknown in the chemical equilibrium problem and computed together with the amounts of species.

Implicit Titrants

The implicit titrants are the titrants introduced with methods:

In the code below, the names of the implicitly introduced titrants are shown:

using namespace Reaktoro;
EquilibriumSpecs specs(system); // for some ChemicalSystem object `system`
specs.lnActivity("Ca+2"); // a titrant named [Ca+2] will be introduced.
specs.fugacity("O2"); // a titrant named [O2] will be introduced.
specs.pH(); // a titrant named [H+] will be introduced.
specs.pMg(); // a titrant named [Mg+2] will be introduced.
specs.pE(); // a titrant named [e-] will be introduced.
specs.Eh(); // a titrant named [e-] will be introduced.

The amounts of these implicit titrants are unknown in the chemical equilibrium problem and computed together with the amounts of species.

Control Variables

The control variables in a chemical equilibrium problem are unknowns introduced along with equilibrium constraints. These control variables can be:

  • temperature,
  • pressure, and
  • amounts of explicit and implicit titrants.

The number of these control variables depend whether temperature and/or pressure are unknown and if any titrant has been introduced, explicitly or implicitly. For example, if EquilibriumSpecs::temperature is not called, then temperature is unknown and computed in the chemical equilibrium calculation. The same applies for pressure in case EquilibriumSpecs::pressure is not called. Titrants are introduced either explicitly, with method EquilibriumSpecs::openTo, or implicitly, with methods:

The following example formulates a set of specifications for a chemical equilibrium problem in which temperature and the amount of titrant [CO2] are introduced control variables. Their values are not known in advance; they are computed as part of the chemical equilibrium calculation.

using namespace Reaktoro;
EquilibriumSpecs specs(system); // for some ChemicalSystem object `system`
specs.temperature(); // temperature is an input variable in the chemical equilibrium problem.
specs.pressure(); // pressure is an input variable in the chemical equilibrium problem.
specs.volume(); // volume is an input variable in the chemical equilibrium problem.
specs.openTo("CO2"); // a titrant named [CO2] is introduced, and its amount computed at the end of the equilibrium calculation.

Member Function Documentation

◆ temperature()

auto temperature ( ) -> void

Specify that the temperature of the system is given at chemical equilibrium.

This method introduces one input variable with name T. By calling this method, you are specifying that temperature is known in the equilibrium calculation (by default it is considered an unknown). Thus, it will not be considered as a control variable whose value needs to be computed as part of the equilibrium calculation.

See also
unknownTemperature

◆ pressure()

auto pressure ( ) -> void

Specify that the pressure of the system is given at chemical equilibrium.

This method introduces one input variable with name P. By calling this method, you are specifying that pressure is known in the equilibrium calculation (by default it is considered an unknown). Thus, it will not be considered as a control variable whose value needs to be computed as part of the equilibrium calculation.

See also
unknownPressure

◆ volume()

auto volume ( ) -> void

Specify that the volume of the system is given at chemical equilibrium.

This method introduces one input variable with name V. It also introduces an equation constraint with name volume to enforce a given volume value for the chemical system at equilibrium.

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints.

◆ internalEnergy()

auto internalEnergy ( ) -> void

Specify that the internal energy of the system is given at chemical equilibrium.

This method introduces one input variable with name U. It also introduces an equation constraint with name internalEnergy to enforce a given internal energy value for the chemical system at equilibrium.

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints.

◆ enthalpy()

auto enthalpy ( ) -> void

Specify that the enthalpy of the system is given at chemical equilibrium.

This method introduces one input variable with name H. It also introduces an equation constraint with name enthalpy to enforce a given enthalpy value for the chemical system at equilibrium.

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints.

◆ gibbsEnergy()

auto gibbsEnergy ( ) -> void

Specify that the Gibbs energy of the system is given at chemical equilibrium.

This method introduces one input variable with name G. It also introduces an equation constraint with name gibbsEnergy to enforce a given Gibbs energy value for the chemical system at equilibrium.

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints.

◆ helmholtzEnergy()

auto helmholtzEnergy ( ) -> void

Specify that the Helmholtz energy of the system is given at chemical equilibrium.

This method introduces one input variable with name A. It also introduces an equation constraint with name helmholtzEnergy to enforce a given Helmholtz energy value for the chemical system at equilibrium.

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints.

◆ entropy()

auto entropy ( ) -> void

Specify that the entropy of the system is given at chemical equilibrium.

This method introduces one input variable with name S. It also introduces an equation constraint with name entropy to enforce a given entropy value for the chemical system at equilibrium.

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints.

◆ elementAmount()

auto elementAmount ( StringOrIndex const &  element) -> void

Specify that the amount of an element is given at chemical equilibrium.

Parameters
elementThe name or index of the element in the chemical system.

◆ elementAmountInPhase()

auto elementAmountInPhase ( StringOrIndex const &  element,
StringOrIndex const &  phase 
) -> void

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

Parameters
elementThe name or index of the element in the chemical system.
phaseThe name or index of the phase in the chemical system.

◆ elementMass()

auto elementMass ( StringOrIndex const &  element) -> void

Specify that the mass of an element is given at chemical equilibrium.

Parameters
elementThe name or index of the element in the chemical system.

◆ elementMassInPhase()

auto elementMassInPhase ( StringOrIndex const &  element,
StringOrIndex const &  phase 
) -> void

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

Parameters
elementThe name or index of the element in the chemical system.
phaseThe name or index of the phase in the chemical system.

◆ phaseAmount()

auto phaseAmount ( StringOrIndex const &  phase) -> void

Specify that the amount of a phase is given at chemical equilibrium.

Parameters
phaseThe name or index of the phase in the chemical system.

◆ phaseMass()

auto phaseMass ( StringOrIndex const &  phase) -> void

Specify that the mass of a phase is given at chemical equilibrium.

Parameters
phaseThe name or index of the phase in the chemical system.

◆ phaseVolume()

auto phaseVolume ( StringOrIndex const &  phase) -> void

Specify that the volume of a phase is given at chemical equilibrium.

Parameters
phaseThe name or index of the phase in the chemical system.

◆ unknownTemperature()

auto unknownTemperature ( ) -> void

Specify that the temperature of the system is unknown in the chemical equilibrium calculation.

This method introduces one p control variable with name T. By calling this method, you are specifying that temperature is unknown and to be computed as part of the chemical equilibrium calculation.

◆ unknownPressure()

auto unknownPressure ( ) -> void

Specify that the pressure of the system is unknown in the chemical equilibrium calculation.

This method introduces one p control variable with name P. By calling this method, you are specifying that pressure is unknown and to be computed as part of the chemical equilibrium calculation.

◆ chemicalPotential()

auto chemicalPotential ( String  substance) -> void

Specify that the chemical potential of a substance is given at chemical equilibrium.

This method introduces one input variable with name u[substance] (e.g., u[H2O] if substance is "H2O"). It also introduces a chemical potential constraint with same name to enforce a given chemical potential value for the substance at chemical equilibrium. This method also indicates that the chemical system is open to substance (e.g., the system is open to mass in/out of H2O). Thus an implicit titrant is introduced with name [substance] (e.g., [H2O]).

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
substanceThe chemical formula of the substance (e.g., H2O, CO2, H+, Mg+2).

◆ lnActivity() [1/2]

auto lnActivity ( Species const &  species) -> void

Specify that the ln activity of a species is given at chemical equilibrium.

This method introduces one input variable with name lnActivity[speciesName] (e.g., lnActivity[CO2(aq)] if species is a Species object with name "CO2(aq)"). It also introduces a chemical potential constraint with same name that is equivalent to enforcing a given value for the natural log activity of the species at chemical equilibrium. This method also indicates that the chemical system is open to the underlying substance of the species, not the species itself. For example, the system is open to mass in/out of CO2 if the Species object species is CO2(aq), CO2(g) or CO2(l)). Thus an implicit titrant is introduced with name [substance] (e.g., [CO2]).

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
speciesThe chemical species as an Species object.

◆ lnActivity() [2/2]

auto lnActivity ( String  species) -> void

Specify that the ln activity of a species is given at chemical equilibrium.

For more details, check the documentation of EquilibriumSpecs::lnActivity(Species const&).

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
speciesThe name of the chemical species as found in the database in use.
Note
The chemical species does not need to be in the chemical system; only in the database.
Warning
An error will be thrown if the database does not contain a species with given name.

◆ lgActivity()

auto lgActivity ( String  species) -> void

Specify that the lg activity of a species is given at chemical equilibrium.

For more details, check the documentation of EquilibriumSpecs::lnActivity(Species const&).

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
speciesThe name of the chemical species as found in the database in use.
Note
The chemical species does not need to be in the chemical system; only in the database.
Warning
An error will be thrown if the database does not contain a species with given name.

◆ activity()

auto activity ( String  species) -> void

Specify that the activity of a species is given at chemical equilibrium.

For more details, check the documentation of EquilibriumSpecs::lnActivity(Species const&).

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
speciesThe name of the chemical species as found in the database in use.
Note
The chemical species does not need to be in the chemical system; only in the database.
Warning
An error will be thrown if the database does not contain a species with given name.

◆ fugacity()

auto fugacity ( String  gas) -> void

Specify that the fugacity of a gaseous species is given at chemical equilibrium.

This method introduces one input variable with name f[gas] (e.g., f[O2] if gas is "O2"). It also introduces a chemical potential constraint with same name that is equivalent to enforcing a given value for the fugacity of the gas at chemical equilibrium. This method also indicates that the chemical system is open to gas (e.g., the system is open to mass in/out of O2). Thus an implicit titrant is introduced with name [substance] (e.g., [O2]).

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
gasThe name of the gaseous species as found in the database in use.
Note
The gaseous species does not need to be in the chemical system; only in the database.
Warning
An error will be thrown if the database does not contain a gaseous species with given name.

◆ pH()

auto pH ( ) -> void

Specify that the pH is given at chemical equilibrium.

This method introduces one input variable with name pH. It also introduces a chemical potential constraint with same name that is equivalent to enforcing a given value for pH at chemical equilibrium. This method also indicates that the chemical system is open to mass in/out of H+. Thus an implicit titrant is introduced with name [H+]. The code below demonstrate the use of this method and its effect on the list of input variables, titrants and control variables.

using namespace Reaktoro;
EquilibriumSpecs specs(system); // for some ChemicalSystem object `system`
specs.enthalpy(); // introduces input variable `H` and constraint `enthalpy`
specs.pressure(); // introduces input variable `P`
specs.pH(); // introduces input variable `pH`, constraint `pH`, and titrant `[H+]`
print(specs.namesInputs()); // H, P, pH
print(specs.namesTitrants()); // [H+]
print(specs.namesControlVariables()); // T, n[H+]
print(specs.namesContraints()); // enthalpy, pH
See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Warning
An error will be thrown if the system does not contain an aqueous species with formula H+.

◆ pMg()

auto pMg ( ) -> void

Specify that pMg is given at chemical equilibrium.

This method introduces one input variable with name pMg. It also introduces a chemical potential constraint with same name that is equivalent to enforcing a given value for pMg at chemical equilibrium. This method also indicates that the chemical system is open to mass in/out of Mg2+. Thus an implicit titrant is introduced with name [Mg+2].

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Warning
An error will be thrown if the system does not contain an aqueous species with formula Mg+2.

◆ pE()

auto pE ( ) -> void

Specify that pE is given at chemical equilibrium.

This method introduces one input variable with name pE. It also introduces a chemical potential constraint with same name that is equivalent to enforcing a given value for pE at chemical equilibrium. This method also indicates that the chemical system is open to mass in/out of e- (the electron substance). Thus an implicit titrant is introduced with name [e-].

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables

◆ Eh()

auto Eh ( ) -> void

Specify that Eh is given at chemical equilibrium.

This method introduces one input variable with name Eh. It also introduces a chemical potential constraint with same name that is equivalent to enforcing a given value for Eh at chemical equilibrium. This method also indicates that the chemical system is open to mass in/out of e- (the electron substance). Thus an implicit titrant is introduced with name [e-].

See also
EquilibriumSpecs::namesInputs, EquilibriumSpecs::namesConstraints, EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables

◆ openTo()

auto openTo ( ChemicalFormula const &  substance) -> void

Specify that the chemical system is open to a substance.

Use this method to specify that the system is titrated with an unknown amount of a substance to be able to attain chemical equilibrium with given conditions. Its use introduces an explicit titrant with name [substance] (e.g., H2S is substance is "H2S"). The amount of this titrant is an unknown control variable which is computed in the chemical equilibrium calculation.

The code below demonstrate the use of this method and its effect on the list of titrants and control variables.

using namespace Reaktoro;
EquilibriumSpecs specs(system); // for some ChemicalSystem object `system`
specs.volume();
specs.pressure();
specs.openTo("H2S");
specs.openTo("CO2");
print(specs.namesTitrants()); // [H2S], [CO2]
print(specs.namesControlVariables()); // T, [H2S], [CO2]
Note
The code above is for demonstration purposes only. The given specifications do not produce a valid chemical equilibrium problem!
See also
EquilibriumSpecs::namesTitrants, EquilibriumSpecs::namesControlVariables
Parameters
substanceThe chemical formula of the substance.

◆ addUnknownTitrantAmount()

auto addUnknownTitrantAmount ( ChemicalFormula const &  substance) -> void

Specify that the chemical system is open to a given chemical state. // TODO: Implement EquilibriumSpecs::auto openTo(ChemicalState const& state).

Specify that the chemical system is open to a given material. // TODO: Implement EquilibriumSpecs::auto openTo(Material const& material). Specify that the chemical system is open to a titrant substance and its amount is unknown.

◆ assembleEquationConstraints()

auto assembleEquationConstraints ( ) const -> EquationConstraints

Assemble the complete system of equation constraints to be satisfied at chemical equilibrium.

This method assembles a system of equation constraints that considers first the evaluation of the provided single equations via addConstraint and then the provided systems of equations via method addConstraints.

◆ assembleReactivityConstraints()

auto assembleReactivityConstraints ( ) const -> ReactivityConstraints

Assemble the complete system of reactivity constraints to be satisfied at chemical equilibrium.

This method assembles a system of reactivity constraints that considers first the evaluation of the provided single constraints via addReactivityConstraint and then the provided systems of constraints via method addReactivityConstraints.

◆ assembleConservationMatrix()

auto assembleConservationMatrix ( ) const -> MatrixXd

Assemble the conservation matrix for the chemical species with respect to the conservative components.

This method is equivalent to assembleConservationMatrixN

◆ assembleConservationMatrixN()

auto assembleConservationMatrixN ( ) const -> MatrixXd

Assemble the conservation matrix for the n species amount variables with respect to the conservative components.

This conservative matrix of the chemical equilibrium problem is a matrix whose upper rows contains the formula matrix of the species with respect to elements and electric charge, and the lower rows contains the coefficients of the reactivity constraints (e.g., the stoichiometric matrix of the restricted reactions in the equilibrium computation). This matrix is used to compute the amounts of the conservative components in the chemical equilibrium problem, which are elements, electric charge, and the extend of the restricted reactions.


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