A class used for defining an inverse equilibrium problem. More...
#include <EquilibriumInverseProblem.hpp>
Public Member Functions | |
EquilibriumInverseProblem (const ChemicalSystem &system) | |
Construct an EquilibriumInverseProblem instance. | |
EquilibriumInverseProblem (const EquilibriumInverseProblem &other) | |
Construct a copy of an EquilibriumInverseProblem instance. | |
virtual | ~EquilibriumInverseProblem () |
Destroy this EquilibriumInverseProblem instance. | |
auto | operator= (EquilibriumInverseProblem other) -> EquilibriumInverseProblem & |
Assign a copy of an EquilibriumInverseProblem instance. | |
auto | setPartition (const Partition &partition) -> EquilibriumInverseProblem & |
Set the partition of the chemical system. More... | |
auto | setTemperature (double val) -> EquilibriumInverseProblem & |
Set the temperature for the equilibrium calculation (in units of K). More... | |
auto | setTemperature (double val, std::string units) -> EquilibriumInverseProblem & |
Set the temperature for the equilibrium calculation. More... | |
auto | setPressure (double val) -> EquilibriumInverseProblem & |
Set the pressure for the equilibrium calculation (in units of Pa). More... | |
auto | setPressure (double val, std::string units) -> EquilibriumInverseProblem & |
Set the pressure for the equilibrium calculation. More... | |
auto | setElementInitialAmounts (VectorConstRef values) -> EquilibriumInverseProblem & |
Set the initial known molar amounts of the elements in the equilibrium partition. More... | |
auto | add (std::string name, double amount, std::string units) -> EquilibriumInverseProblem & |
Add a given amount of a compound or species to the initial equilibrium recipe. More... | |
auto | fixSpeciesAmount (std::string species, double value, std::string units) -> EquilibriumInverseProblem & |
Fix the molar amount of a species at equilibrium. More... | |
auto | fixSpeciesAmount (std::string species, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the molar amount of a species at equilibrium with given titrant. More... | |
auto | fixSpeciesMass (std::string species, double value, std::string units) -> EquilibriumInverseProblem & |
Fix the mass of a species at equilibrium. More... | |
auto | fixSpeciesMass (std::string species, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the mass of a species at equilibrium with given titrant. More... | |
auto | fixSpeciesActivity (std::string species, double value) -> EquilibriumInverseProblem & |
Fix the activity of a species at equilibrium. More... | |
auto | fixSpeciesActivity (std::string species, double value, std::string titrant) -> EquilibriumInverseProblem & |
Fix the activity of a species at equilibrium with given titrant. More... | |
auto | fixSpeciesActivity (std::string species, double value, std::string titrant1, std::string titrant2) -> EquilibriumInverseProblem & |
Fix the activity of a species at equilibrium with either one of the two given titrants. More... | |
auto | fixSpeciesFugacity (std::string species, double value, std::string units) -> EquilibriumInverseProblem & |
Fix the fugacity of a gaseous species. More... | |
auto | fixSpeciesFugacity (std::string species, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the fugacity of a gaseous species with given titrant. More... | |
auto | fixPhaseAmount (std::string phase, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the total molar amount of a phase at equilibrium with given titrant. More... | |
auto | fixPhaseMass (std::string phase, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the total mass of a phase at equilibrium with given titrant. More... | |
auto | fixPhaseVolume (std::string phase, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the volume of a phase at equilibrium with given titrant. More... | |
auto | fixPhaseSetVolume (const std::vector< std::string > &phases, double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the total volume of a set of phases at equilibrium with given titrant. More... | |
auto | pH (double value) -> EquilibriumInverseProblem & |
Fix the pH of the aqueous solution. More... | |
auto | pH (double value, std::string titrant) -> EquilibriumInverseProblem & |
Fix the pH of the aqueous solution with given titrant. More... | |
auto | pH (double value, std::string titrant1, std::string titrant2) -> EquilibriumInverseProblem & |
Fix the pH of the aqueous solution with either one of the two given titrants. More... | |
auto | pE (double value) -> EquilibriumInverseProblem & |
Fix the pe of the aqueous solution. More... | |
auto | pE (double value, std::string titrant) -> EquilibriumInverseProblem & |
Fix the pe of the aqueous solution with given half reaction. More... | |
auto | Eh (double value, std::string units) -> EquilibriumInverseProblem & |
Fix the Eh of the aqueous solution (in units of volts). More... | |
auto | Eh (double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the Eh of the aqueous solution with given half reaction. More... | |
auto | alkalinity (double value, std::string units, std::string titrant) -> EquilibriumInverseProblem & |
Fix the total alkalinity of the aqueous solution. More... | |
auto | system () const -> const ChemicalSystem & |
Return a reference to the ChemicalSystem instance used to create this EquilibriumProblem instance. | |
auto | partition () const -> const Partition & |
Return a reference to the Partition instance used to create this EquilibriumProblem instance. | |
auto | temperature () const -> double |
Return the temperature for the equilibrium calculation (in units of K) | |
auto | pressure () const -> double |
Return the pressure for the equilibrium calculation (in units of Pa) | |
auto | numConstraints () const -> Index |
Return the number of constraints used in the inverse equilibrium problem. | |
auto | numTitrants () const -> Index |
Return the number of titrants used in the inverse equilibrium problem. | |
auto | formulaMatrixTitrants () const -> Matrix |
Return the formula matrix of the titrants. More... | |
auto | elementInitialAmounts () const -> Vector |
Return the initial amounts of elements in the equilibrium partition. More... | |
auto | titrantInitialAmounts () const -> Vector |
Return the initial amounts of titrants as initial guess for the inverse equilibrium calculation. | |
auto | residualEquilibriumConstraints (VectorConstRef x, const ChemicalState &state) const -> ResidualEquilibriumConstraints |
Return the residuals of the equilibrium constraints and their partial derivatives. More... | |
auto | solve (ChemicalState &state) -> EquilibriumResult |
Solve the inverse equilibrium problem. More... | |
Detailed Description
A class used for defining an inverse equilibrium problem.
In an inverse equilibrium problem, not all elements have known molar amounts. Their amount constraints are replaced by other equilibrium constraints such as fixed species amount or activity, or the volume or total amount of a phase. Since the amounts of elements are not known a priori, an inverse equilibrium calculation tries to determine amounts of titrants that can control the specified equilibrium constraints. The amount of the titrants are unknown, and its addition or removal is done over the calculation so that the equilibrium state is driven towards a state where all given equilibrium constraints are satisfied.
Member Function Documentation
◆ setPartition()
auto setPartition | ( | const Partition & | partition | ) | -> EquilibriumInverseProblem& |
Set the partition of the chemical system.
Use this method to specify the equilibrium, kinetic, and inert species.
◆ setTemperature() [1/2]
auto setTemperature | ( | double | val | ) | -> EquilibriumInverseProblem& |
Set the temperature for the equilibrium calculation (in units of K).
By default, the temperature is 25 °C.
- Parameters
-
val The temperature value (in units of K).
◆ setTemperature() [2/2]
auto setTemperature | ( | double | val, |
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Set the temperature for the equilibrium calculation.
By default, the temperature is 25 °C.
- Parameters
-
val The temperature value. units The units of the temperature (K, degC, degF, degR, kelvin, celsius, fahrenheit, rankine).
◆ setPressure() [1/2]
auto setPressure | ( | double | val | ) | -> EquilibriumInverseProblem& |
Set the pressure for the equilibrium calculation (in units of Pa).
By default, the pressure is 1 bar.
- Parameters
-
val The pressure value (in units of Pa).
◆ setPressure() [2/2]
auto setPressure | ( | double | val, |
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Set the pressure for the equilibrium calculation.
By default, the pressure is 1 bar.
- Parameters
-
val The pressure value. units The units of the pressure (Pa, kPa, MPa, GPa, atm, mmHg, inHg, psi, kpsi, Mpsi, psf, bar, torr, inH2O, ftH2O, pascal).
◆ setElementInitialAmounts()
auto setElementInitialAmounts | ( | VectorConstRef | values | ) | -> EquilibriumInverseProblem& |
Set the initial known molar amounts of the elements in the equilibrium partition.
These are the amounts of the equilibrium elements before unknown amounts of titrants are added.
◆ add()
auto add | ( | std::string | name, |
double | amount, | ||
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Add a given amount of a compound or species to the initial equilibrium recipe.
- Parameters
-
name The name of the compound or species amount The amount of the compound or species units The units of the amount (must be convertible to either mol or kg)
◆ fixSpeciesAmount() [1/2]
auto fixSpeciesAmount | ( | std::string | species, |
double | value, | ||
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Fix the molar amount of a species at equilibrium.
- Parameters
-
species The name of the species for which its amount is given. value The value of the species amount (in units of mol). units The units of the species amount (must be convertible to mol)
◆ fixSpeciesAmount() [2/2]
auto fixSpeciesAmount | ( | std::string | species, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the molar amount of a species at equilibrium with given titrant.
- Parameters
-
species The name of the species for which its amount is given. value The value of the species amount. units The units of the species amount (must be convertible to mol) titrant The titrant that controls the species amount.
◆ fixSpeciesMass() [1/2]
auto fixSpeciesMass | ( | std::string | species, |
double | value, | ||
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Fix the mass of a species at equilibrium.
- Parameters
-
species The name of the species for which its amount is given. value The value of the species mass. units The units of the species mass (must be convertible to kg)
◆ fixSpeciesMass() [2/2]
auto fixSpeciesMass | ( | std::string | species, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the mass of a species at equilibrium with given titrant.
- Parameters
-
species The name of the species for which its amount is given. value The value of the species amount (in units of kg). units The units of the species mass (must be convertible to kg) titrant The titrant that controls the species mass.
◆ fixSpeciesActivity() [1/3]
auto fixSpeciesActivity | ( | std::string | species, |
double | value | ||
) | -> EquilibriumInverseProblem& |
Fix the activity of a species at equilibrium.
- Parameters
-
species The name of the species for which its activity is given. value The value of the species activity.
◆ fixSpeciesActivity() [2/3]
auto fixSpeciesActivity | ( | std::string | species, |
double | value, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the activity of a species at equilibrium with given titrant.
- Parameters
-
species The name of the species for which its activity is given. value The value of the species activity. titrant The titrant that controls the species activity.
◆ fixSpeciesActivity() [3/3]
auto fixSpeciesActivity | ( | std::string | species, |
double | value, | ||
std::string | titrant1, | ||
std::string | titrant2 | ||
) | -> EquilibriumInverseProblem& |
Fix the activity of a species at equilibrium with either one of the two given titrants.
- Parameters
-
species The name of the species for which its activity is given. value The value of the species activity. titrant1 The first titrant that might control the species activity. titrant2 The second titrant that might control the species activity.
◆ fixSpeciesFugacity() [1/2]
auto fixSpeciesFugacity | ( | std::string | species, |
double | value, | ||
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Fix the fugacity of a gaseous species.
- Parameters
-
species The name of the gaseous species. value The value of the species fugacity. units The units of the species fugacity (must be convertible to Pa).
◆ fixSpeciesFugacity() [2/2]
auto fixSpeciesFugacity | ( | std::string | species, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the fugacity of a gaseous species with given titrant.
- Parameters
-
species The name of the gaseous species. value The value of the species fugacity. units The units of the species fugacity (must be convertible to Pa). titrant The titrant that controls the fugacity value.
◆ fixPhaseAmount()
auto fixPhaseAmount | ( | std::string | phase, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the total molar amount of a phase at equilibrium with given titrant.
- Parameters
-
phase The name of the phase for which its total molar amount is given. value The value of the phase total amount units The units of the amount (must be convertible to mol) titrant The titrant that controls the phase amount.
◆ fixPhaseMass()
auto fixPhaseMass | ( | std::string | phase, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the total mass of a phase at equilibrium with given titrant.
- Parameters
-
phase The name of the phase for which its total mass is given. value The value of the phase mass units The units of the phase mass (must be convertible to kg) titrant The titrant that controls the phase mass.
◆ fixPhaseVolume()
auto fixPhaseVolume | ( | std::string | phase, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the volume of a phase at equilibrium with given titrant.
- Parameters
-
phase The name of the phase for which its volume is given. value The value of the phase volume units The units of the phase volume (must be convertible to m3) titrant The titrant that controls the phase volume.
◆ fixPhaseSetVolume()
auto fixPhaseSetVolume | ( | const std::vector< std::string > & | phases, |
double | value, | ||
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the total volume of a set of phases at equilibrium with given titrant.
- Parameters
-
phases The names of the phases composing the phase set. value The value of the total volume of the phase set (in units of m3) units The units of the total volume of the phase set (must be convertible to m3) titrant The titrant that controls the total volume of the phase set.
◆ pH() [1/3]
auto pH | ( | double | value | ) | -> EquilibriumInverseProblem& |
Fix the pH of the aqueous solution.
- Parameters
-
value The pH value of the aqueous solution.
◆ pH() [2/3]
auto pH | ( | double | value, |
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the pH of the aqueous solution with given titrant.
- Parameters
-
value The pH value of the aqueous solution. titrant The titrant that control the solution pH.
◆ pH() [3/3]
auto pH | ( | double | value, |
std::string | titrant1, | ||
std::string | titrant2 | ||
) | -> EquilibriumInverseProblem& |
Fix the pH of the aqueous solution with either one of the two given titrants.
- Parameters
-
value The pH value of the aqueous solution. titrant1 The first titrant that might control the solution pH. titrant2 The second titrant that might control the solution pH.
◆ pE() [1/2]
auto pE | ( | double | value | ) | -> EquilibriumInverseProblem& |
Fix the pe of the aqueous solution.
- Parameters
-
value The pe value of the aqueous solution.
◆ pE() [2/2]
auto pE | ( | double | value, |
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the pe of the aqueous solution with given half reaction.
- Parameters
-
value The pe value of the aqueous solution. titrant The titrant that control the solution pE.
◆ Eh() [1/2]
auto Eh | ( | double | value, |
std::string | units | ||
) | -> EquilibriumInverseProblem& |
Fix the Eh of the aqueous solution (in units of volts).
- Parameters
-
value The Eh value of the aqueous solution.
◆ Eh() [2/2]
auto Eh | ( | double | value, |
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the Eh of the aqueous solution with given half reaction.
- Parameters
-
value The Eh value of the aqueous solution. units The units of the Eh of the aqueous solution (must be convertible to V). titrant The titrant that control the solution Eh.
◆ alkalinity()
auto alkalinity | ( | double | value, |
std::string | units, | ||
std::string | titrant | ||
) | -> EquilibriumInverseProblem& |
Fix the total alkalinity of the aqueous solution.
- Parameters
-
value The value of the total alkalinity of the aqueous solution. units The units of the total alkalinity (must be convertible to eq/L). titrant The titrant that control the solution alkalinity.
◆ formulaMatrixTitrants()
auto formulaMatrixTitrants | ( | ) | const -> Matrix |
Return the formula matrix of the titrants.
The formula matrix of the titrants is defined as the matrix whose (j,i)th entry contains the stoichiometric coefficient of jth element in the ith titrant. Its dimension is E x T
, where T
is the number of titrants.
◆ elementInitialAmounts()
auto elementInitialAmounts | ( | ) | const -> Vector |
Return the initial amounts of elements in the equilibrium partition.
These are the values of element amounts in the equilibrium partition before unknown amounts of titrants are added.
◆ residualEquilibriumConstraints()
auto residualEquilibriumConstraints | ( | VectorConstRef | x, |
const ChemicalState & | state | ||
) | const -> ResidualEquilibriumConstraints |
Return the residuals of the equilibrium constraints and their partial derivatives.
- Parameters
-
x The amounts of the titrants (in units of mol) state The chemical state of the system
◆ solve()
auto solve | ( | ChemicalState & | state | ) | -> EquilibriumResult |
Solve the inverse equilibrium problem.
- Parameters
-
state The initial guess for the final chemical state solution.
The documentation for this class was generated from the following files:
- Reaktoro/Equilibrium/EquilibriumInverseProblem.hpp
- Reaktoro/Equilibrium/EquilibriumInverseProblem.cpp