Reaktoro
A unified framework for modeling chemically reactive systems
EquilibriumProblem Class Reference

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
valThe 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
valThe temperature value
unitsThe 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
valThe 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
valThe pressure value
unitsThe 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
bThe 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
amountThe 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
ielementThe index of the element
amountThe 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
elementThe name of the element
amountThe same mole amount for all elements (in units of mol)

◆ setElectricalCharge()

auto setElectricalCharge ( double  amount) -> EquilibriumProblem&

Set the mole amount of electrical charge.

Parameters
amountThe 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
nameThe name of the compound or species
amountThe amount of the compound or species
unitsThe 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, use add(2.0*state).
Parameters
stateThe 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
nameThe name of the compound (e.g., H2O, CaCO3)
amountThe amount of the compound
unitsThe 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
nameThe name of the species
amountThe amount of the species
unitsThe 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, use addState(2.0*state).
Parameters
stateThe ChemicalState instance with the mole amounts of the species
See also
setPartition

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