A type that defines an equilibrium problem. More...
#include <EquilibriumProblem.hpp>
Public Member Functions | |
EquilibriumProblem (const ChemicalSystem &system) | |
Construct an EquilibriumProblem instance. | |
EquilibriumProblem (const Partition &partition) | |
Construct an EquilibriumProblem instance. | |
EquilibriumProblem (const EquilibriumProblem &other) | |
Construct a copy of a EquilibriumProblem instance. | |
virtual | ~EquilibriumProblem () |
Destroy this EquilibriumProblem instance. | |
auto | operator= (EquilibriumProblem other) -> EquilibriumProblem & |
Assign an EquilibriumProblem instance to this. | |
auto | setPartition (const Partition &partition) -> EquilibriumProblem & |
Set the partition of the chemical system. More... | |
auto | setTemperature (double val) -> EquilibriumProblem & |
Set the temperature for the equilibrium calculation. More... | |
auto | setTemperature (double val, std::string units) -> EquilibriumProblem & |
Set the temperature for the equilibrium calculation with given units. More... | |
auto | setPressure (double val) -> EquilibriumProblem & |
Set the pressure for the equilibrium calculation. More... | |
auto | setPressure (double val, std::string units) -> EquilibriumProblem & |
Set the pressure for the equilibrium calculation. More... | |
auto | setElementAmounts (VectorConstRef b) -> EquilibriumProblem & |
Set the mole amounts of each element for the equilibrium calculation. More... | |
auto | setElementAmounts (double amount) -> EquilibriumProblem & |
Set the mole amounts of each element for the equilibrium calculation. More... | |
auto | setElementAmount (Index ielement, double amount) -> EquilibriumProblem & |
Set the mole amount of an element for the equilibrium calculation (in units of mol) More... | |
auto | setElementAmount (std::string element, double amount) -> EquilibriumProblem & |
Set the mole amount of an element for the equilibrium calculation (in units of mol) More... | |
auto | setElectricalCharge (double amount) -> EquilibriumProblem & |
Set the mole amount of electrical charge. More... | |
auto | add (std::string name, double amount, std::string units) -> EquilibriumProblem & |
Add a given amount of a compound or species to the equilibrium recipe. More... | |
auto | add (const ChemicalState &state) -> EquilibriumProblem & |
Add the mole amounts of the equilibrium species in a ChemicalState instance to the equilibrium recipe. More... | |
auto | addCompound (std::string name, double amount, std::string unit) -> EquilibriumProblem & |
Add a given amount of a compound to the equilibrium recipe. More... | |
auto | addSpecies (std::string name, double amount, std::string unit) -> EquilibriumProblem & |
Add a given amount of a species to the equilibrium recipe The species must be present in the chemical system. More... | |
auto | addState (const ChemicalState &state) -> EquilibriumProblem & |
Add the mole amounts of the equilibrium species in a ChemicalState instance to the equilibrium recipe. 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 | elementAmounts () const -> VectorConstRef |
Return the amounts of the elements for the equilibrium calculation (in units of mol) | |
Detailed Description
A type that defines an equilibrium problem.
Member Function Documentation
◆ setPartition()
auto setPartition | ( | const Partition & | partition | ) | -> EquilibriumProblem& |
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 | ) | -> EquilibriumProblem& |
Set the temperature for the equilibrium calculation.
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 | ||
) | -> EquilibriumProblem& |
Set the temperature for the equilibrium calculation with given units.
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 | ) | -> EquilibriumProblem& |
Set the pressure for the equilibrium calculation.
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 | ||
) | -> EquilibriumProblem& |
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)
◆ setElementAmounts() [1/2]
auto setElementAmounts | ( | VectorConstRef | b | ) | -> EquilibriumProblem& |
Set the mole amounts of each element for the equilibrium calculation.
- Parameters
-
b The vector of mole amounts of each element (in units of mol)
◆ setElementAmounts() [2/2]
auto setElementAmounts | ( | double | amount | ) | -> EquilibriumProblem& |
Set the mole amounts of each element for the equilibrium calculation.
- Parameters
-
amount The mole amount for all elements (in units of mol)
◆ setElementAmount() [1/2]
auto setElementAmount | ( | Index | ielement, |
double | amount | ||
) | -> EquilibriumProblem& |
Set the mole amount of an element for the equilibrium calculation (in units of mol)
- Parameters
-
ielement The index of the element amount The same mole amount for all elements (in units of mol)
◆ setElementAmount() [2/2]
auto setElementAmount | ( | std::string | element, |
double | amount | ||
) | -> EquilibriumProblem& |
Set the mole amount of an element for the equilibrium calculation (in units of mol)
- Parameters
-
element The name of the element amount The same mole amount for all elements (in units of mol)
◆ setElectricalCharge()
auto setElectricalCharge | ( | double | amount | ) | -> EquilibriumProblem& |
Set the mole amount of electrical charge.
- Parameters
-
amount The mole amount of electrical charge (in units of mol)
◆ add() [1/2]
auto add | ( | std::string | name, |
double | amount, | ||
std::string | units | ||
) | -> EquilibriumProblem& |
Add a given amount of a compound or species to the equilibrium recipe.
This method will first check if the given compound is present in the chemical system. If true, then addSpecies
will be called. Otherwise, addCompound
will be called.
- 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)
◆ add() [2/2]
auto add | ( | const ChemicalState & | state | ) | -> EquilibriumProblem& |
Add the mole amounts of the equilibrium species in a ChemicalState instance to the equilibrium recipe.
This method only extracts the mole amounts of equilibrium species in the given chemical state. If not all species in the system is under equilibrium assumption for this equilibrium calculation, ensure you set the partition of the chemical system before calling this method.
- Note
- If a multiplication factor is needed, for example
2.0
, useadd(2.0*state)
.
- Parameters
-
state The ChemicalState instance with the mole amounts of the species
- See also
- setPartition
◆ addCompound()
auto addCompound | ( | std::string | name, |
double | amount, | ||
std::string | unit | ||
) | -> EquilibriumProblem& |
Add a given amount of a compound to the equilibrium recipe.
The compound must not have a chemical element that is not present in the chemical system.
- Parameters
-
name The name of the compound (e.g., H2O, CaCO3) amount The amount of the compound units The units of the amount (must be convertible to either mol or kg)
◆ addSpecies()
auto addSpecies | ( | std::string | name, |
double | amount, | ||
std::string | unit | ||
) | -> EquilibriumProblem& |
Add a given amount of a species to the equilibrium recipe The species must be present in the chemical system.
- Parameters
-
name The name of the species amount The amount of the species units The units of the amount (must be convertible to either mol or kg)
◆ addState()
auto addState | ( | const ChemicalState & | state | ) | -> EquilibriumProblem& |
Add the mole amounts of the equilibrium species in a ChemicalState instance to the equilibrium recipe.
This method only extracts the mole amounts of equilibrium species in the given chemical state. If not all species in the system is under equilibrium assumption for this equilibrium calculation, ensure you set the partition of the chemical system before calling this method.
- Note
- If a multiplication factor is needed, for example
2.0
, useaddState(2.0*state)
.
- Parameters
-
state The ChemicalState instance with the mole amounts of the species
- See also
- setPartition
The documentation for this class was generated from the following files:
- Reaktoro/Equilibrium/EquilibriumProblem.hpp
- Reaktoro/Equilibrium/EquilibriumProblem.cpp