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

## Detailed Description

A type that defines an equilibrium problem.

#include <EquilibriumProblem.hpp>

## Public Member Functions

EquilibriumProblem (const ChemicalSystem &system)
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 (const Vector &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 -> const Vector &
Return the amounts of the elements for the equilibrium calculation (in units of mol)

## Member Function Documentation

 auto Reaktoro::EquilibriumProblem::setPartition ( const Partition & partition ) -> EquilibriumProblem&

Set the partition of the chemical system.

Use this method to specify the equilibrium, kinetic, and inert species.

 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::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).
 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::setElementAmounts ( const Vector & 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)
 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::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 the all elements (in units of mol)
 auto Reaktoro::EquilibriumProblem::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 the all elements (in units of mol)
 auto Reaktoro::EquilibriumProblem::setElectricalCharge ( double amount ) -> EquilibriumProblem&

Set the mole amount of electrical charge.

Parameters
 amount The mole amount of electrical charge (in units of mol)
 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::add ( const ChemicalState & state ) -> EquilibriumProblem&

Add the mole amounts of the equilibrium species in a ChemicalState instance to the equilibrium recipe.

This method only extract 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
 state The ChemicalState instance with the mole amounts of the species
setPartition
 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::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)
 auto Reaktoro::EquilibriumProblem::addState ( const ChemicalState & state ) -> EquilibriumProblem&

Add the mole amounts of the equilibrium species in a ChemicalState instance to the equilibrium recipe.

This method only extract 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
 state The ChemicalState instance with the mole amounts of the species