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

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

#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.

ChemicalSystem (const std::vector< Phase > &phases, const ThermoModel &thermo_model, const ChemicalModel &chemical_model)
Construct a ChemicalSystem instance with given phases and thermodynamic and chemical models.

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 thermoModel () const -> const ThermoModel &
Return the thermodynamic model of the system.

auto chemicalModel () const -> const ChemicalModel &
Return the chemical model of the system.

auto formulaMatrix () const -> MatrixConstRef
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 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 (VectorConstRef n) const -> Vector
Calculate the molar amounts of the elements (in units of mol) More...

auto elementAmountsInPhase (Index iphase, VectorConstRef n) const -> Vector
Calculate the molar amounts of the elements in a given phase (in units of mol) More...

auto elementAmountsInSpecies (const Indices &ispecies, VectorConstRef 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, VectorConstRef n) const -> double
Calculate the molar amount of elements (in units of mol) More...

auto elementAmountInPhase (Index ielement, Index iphase, VectorConstRef n) const -> double
Calculate the molar amounts of elements in a given phase (in units of mol) More...

auto elementAmountInSpecies (Index ielement, const Indices &ispecies, VectorConstRef n) const -> double
Calculate the molar amounts of 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, VectorConstRef n) const -> ChemicalProperties
Calculate the thermodynamic and chemical properties of the chemical system. More...

Detailed Description

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

Species, Phase

◆ numSpeciesInPhase()

 auto numSpeciesInPhase ( Index iphase ) const -> unsigned

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

Parameters
 iphase The index of the phase

◆ element() [1/2]

 auto element ( Index index ) const -> const Element&

Return an element of the system.

Parameters
 index The index of the element

◆ element() [2/2]

 auto element ( std::string name ) const -> const Element&

Return an element of the system.

Parameters
 name The name of the element

◆ species() [1/2]

 auto species ( Index index ) const -> const Species&

Return a species of the system.

Parameters
 index The index of the species

◆ species() [2/2]

 auto species ( std::string name ) const -> const Species&

Return a species of the system.

Parameters
 name The name of the species

◆ phase() [1/2]

 auto phase ( Index index ) const -> const Phase&

Return a phase of the system.

Parameters
 index The index of the phase

◆ phase() [2/2]

 auto phase ( std::string name ) const -> const Phase&

Return a phase of the system.

Parameters
 name The name of the phase

◆ indexElement()

 auto indexElement ( std::string name ) const -> Index

Return the index of an element in the system.

Parameters
 name The name of the element

◆ indexElementWithError()

 auto 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

◆ indexSpecies()

 auto indexSpecies ( std::string name ) const -> Index

Return the index of a species in the system.

Parameters
 name The name of the species

◆ indexSpeciesWithError()

 auto 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.

◆ indexSpeciesAny()

 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.

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.

◆ indexSpeciesAnyWithError()

 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.

Parameters
 names The tentative names of the species in the system.
Returns
The index of the species if found, or a runtime exception otherwise.

◆ indexPhase()

 auto indexPhase ( std::string name ) const -> Index

Return the index of a phase in the system.

Parameters
 name The name of the phase

◆ indexPhaseWithError()

 auto 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

◆ indexPhaseWithSpecies()

 auto indexPhaseWithSpecies ( Index index ) const -> Index

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

Parameters
 index The index of the species

◆ indexFirstSpeciesInPhase()

 auto indexFirstSpeciesInPhase ( Index iphase ) const -> unsigned

Return the index of the first species in a phase.

Parameters
 iphase The index of the phase

◆ indicesElements()

 auto 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

◆ indicesElementsInSpecies() [1/2]

 auto indicesElementsInSpecies ( Index index ) const -> Indices

Return the indices of the elements that compose a species.

Parameters
 index The index of the species

◆ indicesElementsInSpecies() [2/2]

 auto 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

◆ indicesSpecies()

 auto 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

◆ indicesSpeciesInPhases()

 auto 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

◆ indicesPhases()

 auto 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

◆ indicesPhasesWithSpecies()

 auto indicesPhasesWithSpecies ( const Indices & indices ) const -> Indices

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

Parameters
 indices The indices of the species

◆ elementAmounts()

 auto elementAmounts ( VectorConstRef 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)

◆ elementAmountsInPhase()

 auto elementAmountsInPhase ( Index iphase, VectorConstRef 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)

◆ elementAmountsInSpecies()

 auto elementAmountsInSpecies ( const Indices & ispecies, VectorConstRef 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)

◆ elementAmount()

 auto elementAmount ( Index ielement, VectorConstRef n ) const -> double

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

Parameters
 ielement The index of the element n The molar amounts of the species (in units of mol)

◆ elementAmountInPhase()

 auto elementAmountInPhase ( Index ielement, Index iphase, VectorConstRef n ) const -> double

Calculate the molar amounts of 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)

◆ elementAmountInSpecies()

 auto elementAmountInSpecies ( Index ielement, const Indices & ispecies, VectorConstRef n ) const -> double

Calculate the molar amounts of 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)

◆ properties() [1/2]

 auto 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)

◆ properties() [2/2]

 auto properties ( double T, double P, VectorConstRef 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: