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.

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
 iphase The 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
 index The index of the element
 auto Reaktoro::ChemicalSystem::element ( std::string name ) const -> const Element&

Return an element of the system.

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

Return a species of the system.

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

Return a species of the system.

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

Return a phase of the system.

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

Return a phase of the system.

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

Return the index of an element in the system.

Parameters
 name The 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
 name The name of the element
 auto Reaktoro::ChemicalSystem::indexSpecies ( std::string name ) const -> Index

Return the index of a species in the system.

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

Return the index of a species in the system.

Parameters
 name The 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
 names The 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
 names The 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
 name The 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
 name The name of the phase
 auto Reaktoro::ChemicalSystem::indexPhaseWithSpecies ( Index index ) const -> Index

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

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

Return the index of the first species in a phase.

Parameters
 iphase The 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
 names The names of the elements
 auto Reaktoro::ChemicalSystem::indicesElementsInSpecies ( Index index ) const -> Indices

Return the indices of the elements that compose a species.

Parameters
 index The 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
 indices The 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
 names The 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
 indices The 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
 names The 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
 indices The 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
 n The 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
 iphase The index of the phase n The 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
 ispecies The indices of the species n The 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
 ielement The index of the element n The 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
 ielement The index of the element iphase The index of the phase n The 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
 ielement The index of the element ispecies The indices of the species in the set n The 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
 T The temperature of the system (in units of K) P The 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
 T The temperature of the system (in units of K) P The pressure of the system (in units of Pa) n The molar amounts of the species (in units of mol)

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