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

Detailed Description

A class to represent a system and its attributes and properties.

See also
Species, Phase

#include <ChemicalSystem.hpp>

Public Member Functions

 ChemicalSystem ()
 Construct a default ChemicalSystem instance.
 
 ChemicalSystem (const std::vector< Phase > &phases)
 Construct a ChemicalSystem instance with given phases.
 
virtual ~ChemicalSystem ()
 Destroy this ChemicalSystem instance.
 
auto numElements () const -> unsigned
 Return the number of elements in the system.
 
auto numSpecies () const -> unsigned
 Return the number of species in the system.
 
auto numSpeciesInPhase (Index iphase) const -> unsigned
 Return the number of species in a phase of the system. More...
 
auto numPhases () const -> unsigned
 Return the number of phases in the system.
 
auto elements () const -> const std::vector< Element > &
 Return the list of elements in the system.
 
auto species () const -> const std::vector< Species > &
 Return the list of species in the system.
 
auto phases () const -> const std::vector< Phase > &
 Return the list of phases in the system.
 
auto formulaMatrix () const -> const Matrix &
 Return the formula matrix of the system The formula matrix is defined as the matrix whose entry (j, i) is given by the number of atoms of its j-th element in its i-th species. More...
 
auto element (Index index) const -> const Element &
 Return an element of the system. More...
 
auto element (std::string name) const -> const Element &
 Return an element of the system. More...
 
auto species (Index index) const -> const Species &
 Return a species of the system. More...
 
auto species (std::string name) const -> const Species &
 Return a species of the system. More...
 
auto phase (Index index) const -> const Phase &
 Return a phase of the system. More...
 
auto phase (std::string name) const -> const Phase &
 Return a phase of the system. More...
 
auto indexElement (std::string name) const -> Index
 Return the index of an element in the system. More...
 
auto indexElementWithError (std::string name) const -> Index
 Return the index of an element in the system. More...
 
auto indexSpecies (std::string name) const -> Index
 Return the index of a species in the system. More...
 
auto indexSpeciesWithError (std::string name) const -> Index
 Return the index of a species in the system. More...
 
auto indexSpeciesAny (const std::vector< std::string > &names) const -> Index
 Return the index of the first species in the system with any of the given names. More...
 
auto indexSpeciesAnyWithError (const std::vector< std::string > &names) const -> Index
 Return the index of the first species in the system with any of the given names. More...
 
auto indexPhase (std::string name) const -> Index
 Return the index of a phase in the system. More...
 
auto indexPhaseWithError (std::string name) const -> Index
 Return the index of a phase in the system. More...
 
auto indexPhaseWithSpecies (Index index) const -> Index
 Return the index of the phase that contains a given species. More...
 
auto indexFirstSpeciesInPhase (Index iphase) const -> unsigned
 Return the index of the first species in a phase. More...
 
auto indicesElements (const std::vector< std::string > &names) const -> Indices
 Return the indices of a set of elements in the system. More...
 
auto indicesElementsInSpecies (Index index) const -> Indices
 Return the indices of the elements that compose a species. More...
 
auto indicesElementsInSpecies (const Indices &indices) const -> Indices
 Return the indices of the elements that compose a set of species. More...
 
auto indicesSpecies (const std::vector< std::string > &names) const -> Indices
 Return the indices of a set of species in the system. More...
 
auto indicesSpeciesInPhases (const Indices &indices) const -> Indices
 Return the indices of the species in a given set of phases. More...
 
auto indicesPhases (const std::vector< std::string > &names) const -> Indices
 Return the indices of a set of phases in the system. More...
 
auto indicesPhasesWithSpecies (const Indices &indices) const -> Indices
 Return the index of the phase that contains a given species. More...
 
auto indicesFluidPhases () const -> Indices
 Return the indices of the fluid phases.
 
auto indicesFluidSpecies () const -> Indices
 Return the indices of the species in the fluid phases.
 
auto indicesSolidPhases () const -> Indices
 Return the indices of the solid phases.
 
auto indicesSolidSpecies () const -> Indices
 Return the indices of the species in the solid phases.
 
auto elementAmounts (const Vector &n) const -> Vector
 Calculate the molar amounts of the elements (in units of mol) More...
 
auto elementAmountsInPhase (Index iphase, const Vector &n) const -> Vector
 Calculate the molar amounts of the elements in a given phase (in units of mol) More...
 
auto elementAmountsInSpecies (const Indices &ispecies, const Vector &n) const -> Vector
 Calculate the molar amounts of the elements in a given set of species (in units of mol) More...
 
auto elementAmount (Index ielement, const Vector &n) const -> double
 Calculate the molar amount of an elements (in units of mol) More...
 
auto elementAmountInPhase (Index ielement, Index iphase, const Vector &n) const -> double
 Calculate the molar amounts of the elements in a given phase (in units of mol) More...
 
auto elementAmountInSpecies (Index ielement, const Indices &ispecies, const Vector &n) const -> double
 Calculate the molar amounts of the elements in a given set of species (in units of mol) More...
 
auto properties (double T, double P) const -> ThermoProperties
 Calculate the standard thermodynamic properties of the species. More...
 
auto properties (double T, double P, const Vector &n) const -> ChemicalProperties
 Calculate the thermodynamic and chemical properties of the chemical system. More...
 

Member Function Documentation

auto Reaktoro::ChemicalSystem::numSpeciesInPhase ( Index  iphase) const -> unsigned

Return the number of species in a phase of the system.

Parameters
iphaseThe index of the phase
auto Reaktoro::ChemicalSystem::formulaMatrix ( ) const -> const Matrix&

Return the formula matrix of the system The formula matrix is defined as the matrix whose entry (j, i) is given by the number of atoms of its j-th element in its i-th species.

auto Reaktoro::ChemicalSystem::element ( Index  index) const -> const Element&

Return an element of the system.

Parameters
indexThe index of the element
auto Reaktoro::ChemicalSystem::element ( std::string  name) const -> const Element&

Return an element of the system.

Parameters
nameThe name of the element
auto Reaktoro::ChemicalSystem::species ( Index  index) const -> const Species&

Return a species of the system.

Parameters
indexThe index of the species
auto Reaktoro::ChemicalSystem::species ( std::string  name) const -> const Species&

Return a species of the system.

Parameters
nameThe name of the species
auto Reaktoro::ChemicalSystem::phase ( Index  index) const -> const Phase&

Return a phase of the system.

Parameters
indexThe index of the phase
auto Reaktoro::ChemicalSystem::phase ( std::string  name) const -> const Phase&

Return a phase of the system.

Parameters
nameThe name of the phase
auto Reaktoro::ChemicalSystem::indexElement ( std::string  name) const -> Index

Return the index of an element in the system.

Parameters
nameThe name of the element
auto Reaktoro::ChemicalSystem::indexElementWithError ( std::string  name) const -> Index

Return the index of an element in the system.

system It throws an exception if the element does not exist

Parameters
nameThe name of the element
auto Reaktoro::ChemicalSystem::indexSpecies ( std::string  name) const -> Index

Return the index of a species in the system.

Parameters
nameThe name of the species
auto Reaktoro::ChemicalSystem::indexSpeciesWithError ( std::string  name) const -> Index

Return the index of a species in the system.

Parameters
nameThe name of the species
Returns
The index of the species if found, or a runtime exception otherwise.
auto Reaktoro::ChemicalSystem::indexSpeciesAny ( const std::vector< std::string > &  names) const -> Index

Return the index of the first species in the system with any of the given names.

Parameters
namesThe tentative names of the species in the system.
Returns
The index of the species if found, or the number of species otherwise.
auto Reaktoro::ChemicalSystem::indexSpeciesAnyWithError ( const std::vector< std::string > &  names) const -> Index

Return the index of the first species in the system with any of the given names.

Parameters
namesThe tentative names of the species in the system.
Returns
The index of the species if found, or a runtime exception otherwise.
auto Reaktoro::ChemicalSystem::indexPhase ( std::string  name) const -> Index

Return the index of a phase in the system.

Parameters
nameThe name of the phase
auto Reaktoro::ChemicalSystem::indexPhaseWithError ( std::string  name) const -> Index

Return the index of a phase in the system.

system It throws an exception if the phase does not exist

Parameters
nameThe name of the phase
auto Reaktoro::ChemicalSystem::indexPhaseWithSpecies ( Index  index) const -> Index

Return the index of the phase that contains a given species.

Parameters
indexThe index of the species
auto Reaktoro::ChemicalSystem::indexFirstSpeciesInPhase ( Index  iphase) const -> unsigned

Return the index of the first species in a phase.

Parameters
iphaseThe index of the phase
auto Reaktoro::ChemicalSystem::indicesElements ( const std::vector< std::string > &  names) const -> Indices

Return the indices of a set of elements in the system.

Parameters
namesThe names of the elements
auto Reaktoro::ChemicalSystem::indicesElementsInSpecies ( Index  index) const -> Indices

Return the indices of the elements that compose a species.

Parameters
indexThe index of the species
auto Reaktoro::ChemicalSystem::indicesElementsInSpecies ( const Indices indices) const -> Indices

Return the indices of the elements that compose a set of species.

Parameters
indicesThe indices of the species
auto Reaktoro::ChemicalSystem::indicesSpecies ( const std::vector< std::string > &  names) const -> Indices

Return the indices of a set of species in the system.

Parameters
namesThe names of the species
auto Reaktoro::ChemicalSystem::indicesSpeciesInPhases ( const Indices indices) const -> Indices

Return the indices of the species in a given set of phases.

Parameters
indicesThe indices of the phases
auto Reaktoro::ChemicalSystem::indicesPhases ( const std::vector< std::string > &  names) const -> Indices

Return the indices of a set of phases in the system.

Parameters
namesThe names of the phases
auto Reaktoro::ChemicalSystem::indicesPhasesWithSpecies ( const Indices indices) const -> Indices

Return the index of the phase that contains a given species.

Parameters
indicesThe indices of the species
auto Reaktoro::ChemicalSystem::elementAmounts ( const Vector n) const -> Vector

Calculate the molar amounts of the elements (in units of mol)

Parameters
nThe molar amounts of the species (in units of mol)
auto Reaktoro::ChemicalSystem::elementAmountsInPhase ( Index  iphase,
const Vector n 
) const -> Vector

Calculate the molar amounts of the elements in a given phase (in units of mol)

Parameters
iphaseThe index of the phase
nThe molar amounts of the species (in units of mol)
auto Reaktoro::ChemicalSystem::elementAmountsInSpecies ( const Indices ispecies,
const Vector n 
) const -> Vector

Calculate the molar amounts of the elements in a given set of species (in units of mol)

Parameters
ispeciesThe indices of the species
nThe molar amounts of the species (in units of mol)
auto Reaktoro::ChemicalSystem::elementAmount ( Index  ielement,
const Vector n 
) const -> double

Calculate the molar amount of an elements (in units of mol)

Parameters
ielementThe index of the element
nThe molar amounts of the species (in units of mol)
auto Reaktoro::ChemicalSystem::elementAmountInPhase ( Index  ielement,
Index  iphase,
const Vector n 
) const -> double

Calculate the molar amounts of the elements in a given phase (in units of mol)

Parameters
ielementThe index of the element
iphaseThe index of the phase
nThe molar amounts of the species (in units of mol)
auto Reaktoro::ChemicalSystem::elementAmountInSpecies ( Index  ielement,
const Indices ispecies,
const Vector n 
) const -> double

Calculate the molar amounts of the elements in a given set of species (in units of mol)

Parameters
ielementThe index of the element
ispeciesThe indices of the species in the set
nThe molar amounts of the species (in units of mol)
auto Reaktoro::ChemicalSystem::properties ( double  T,
double  P 
) const -> ThermoProperties

Calculate the standard thermodynamic properties of the species.

Parameters
TThe temperature of the system (in units of K)
PThe pressure of the system (in units of Pa)
auto Reaktoro::ChemicalSystem::properties ( double  T,
double  P,
const Vector n 
) const -> ChemicalProperties

Calculate the thermodynamic and chemical properties of the chemical system.

Parameters
TThe temperature of the system (in units of K)
PThe pressure of the system (in units of Pa)
nThe molar amounts of the species (in units of mol)

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