Reaktoro
A unified framework for modeling chemically reactive systems

Provides operations to retrieve physical and thermodynamic data of chemical species. More...

#include <Database.hpp>

Public Member Functions

 Database ()
 Construct a default Database instance.
 
 Database (std::string filename)
 Construct a Database instance by parsing a xml database file. More...
 
 Database (const ThermoFun::Database &fundatabase)
 Construct a Database instance with a given ThermoFun database.
 
auto addElement (const Element &element) -> void
 Add an Element instance in the database.
 
auto addAqueousSpecies (const AqueousSpecies &species) -> void
 Add an AqueousSpecies instance in the database.
 
auto addGaseousSpecies (const GaseousSpecies &species) -> void
 Add a GaseousSpecies instance in the database.
 
auto addLiquidSpecies (const LiquidSpecies &species) -> void
 Add a LiquidSpecies instance in the database.
 
auto addMineralSpecies (const MineralSpecies &species) -> void
 Add a MineralSpecies instance in the database.
 
auto elements () const -> std::vector< Element >
 Return all elements in the database.
 
auto aqueousSpecies () -> std::vector< AqueousSpecies >
 Return all aqueous species in the database.
 
auto aqueousSpecies (std::string name) const -> const AqueousSpecies &
 Return an aqueous species in the database. More...
 
auto gaseousSpecies () -> std::vector< GaseousSpecies >
 Return all gaseous species in the database.
 
auto gaseousSpecies (std::string name) const -> const GaseousSpecies &
 Return a gaseous species in the database. More...
 
auto liquidSpecies () -> std::vector< LiquidSpecies >
 Return all liquid species in the database.
 
auto liquidSpecies (std::string name) const -> const LiquidSpecies &
 Return a liquid species in the database. More...
 
auto mineralSpecies () -> std::vector< MineralSpecies >
 Return all mineral species in the database.
 
auto mineralSpecies (std::string name) const -> const MineralSpecies &
 Return a mineral species in the database. More...
 
auto containsAqueousSpecies (std::string species) const -> bool
 Check if the database contains a given aqueous species. More...
 
auto containsGaseousSpecies (std::string species) const -> bool
 Check if the database contains a given gaseous species. More...
 
auto containsLiquidSpecies (std::string species) const -> bool
 Check if the database contains a given liquid species. More...
 
auto containsMineralSpecies (std::string species) const -> bool
 Check if the database contains a given mineral species. More...
 
auto aqueousSpeciesWithElements (const std::vector< std::string > &elements) const -> std::vector< AqueousSpecies >
 Return the aqueous species that contains at least one of the specified elements.
 
auto gaseousSpeciesWithElements (const std::vector< std::string > &elements) const -> std::vector< GaseousSpecies >
 Return the gaseous species that contains at least one of the specified elements.
 
auto liquidSpeciesWithElements (const std::vector< std::string > &elements) const -> std::vector< LiquidSpecies >
 Return the liquid species that contains at least one of the specified elements.
 
auto mineralSpeciesWithElements (const std::vector< std::string > &elements) const -> std::vector< MineralSpecies >
 Return the mineral species that contains at least one of the specified elements.
 

Detailed Description

Provides operations to retrieve physical and thermodynamic data of chemical species.

The Database class is used to retrieve information of chemical species. It is initialized from a xml database file, which must satisfy some format conditions. Once it is initialized, one can, for example, retrieve thermodynamic information of an aqueous species that will be used to calculate its standard chemical potential.

Usage

In the example below, a Database instance is initialized and queries are made to retrieve information of aqueous, gaseous and liquid species. Note that an exception is thrown if a species is not present in the database.

using namespace Reaktoro;
// Create a Database instance by parsing a local database file
Database db("supcrt98.xml")
// Retrieve information of species H2O(l), CO2(g) and CO2(liq)
AqueousSpecies aqueous_species = db.aqueousSpecies("H2O(l)");
GaseousSpecies gaseous_species = db.gaseousSpecies("CO2(g)");
LiquidSpecies liquid_species = db.liquidSpecies("CO2(liq)");
// Output the data of the species H2O(l), CO2(g), CO2(liq)
std::cout << aqueous_species << std::endl;
std::cout << gaseous_species << std::endl;
std::cout << liquid_species << std::endl;
See also
AqueousSpecies, GaseousSpecies, LiquidSpecies, MineralSpecies

Constructor & Destructor Documentation

◆ Database()

Database ( std::string  filename)
explicit

Construct a Database instance by parsing a xml database file.

If filename does not point to a valid database file or the database file is not found, then a default built-in database with the same name will be tried. If no default built-in database exists with a given name, an exception will be thrown.

Parameters
filenameThe name of the database file

Member Function Documentation

◆ aqueousSpecies()

auto aqueousSpecies ( std::string  name) const -> const AqueousSpecies&

Return an aqueous species in the database.

Note: An exception is thrown if the database does not contain the species.

Parameters
nameThe name of the aqueous species

◆ gaseousSpecies()

auto gaseousSpecies ( std::string  name) const -> const GaseousSpecies&

Return a gaseous species in the database.

Note: An exception is thrown if the database does not contain the species.

Parameters
nameThe name of the gaseous species

◆ liquidSpecies()

auto liquidSpecies ( std::string  name) const -> const LiquidSpecies&

Return a liquid species in the database.

Note: An exception is thrown if the database does not contain the species.

Parameters
nameThe name of the liquid species

◆ mineralSpecies()

auto mineralSpecies ( std::string  name) const -> const MineralSpecies&

Return a mineral species in the database.

Note: An exception is thrown if the database does not contain the species.

Parameters
nameThe name of the mineral species

◆ containsAqueousSpecies()

auto containsAqueousSpecies ( std::string  species) const -> bool

Check if the database contains a given aqueous species.

Parameters
speciesThe name of the aqueous species

◆ containsGaseousSpecies()

auto containsGaseousSpecies ( std::string  species) const -> bool

Check if the database contains a given gaseous species.

Parameters
speciesThe name of the gaseous species

◆ containsLiquidSpecies()

auto containsLiquidSpecies ( std::string  species) const -> bool

Check if the database contains a given liquid species.

Parameters
speciesThe name of the liquid species

◆ containsMineralSpecies()

auto containsMineralSpecies ( std::string  species) const -> bool

Check if the database contains a given mineral species.

Parameters
speciesThe name of the mineral species

The documentation for this class was generated from the following files:
  • Reaktoro/Thermodynamics/Core/Database.hpp
  • Reaktoro/Thermodynamics/Core/Database.cpp
Provides operations to retrieve physical and thermodynamic data of chemical species.
Definition: Database.hpp:78
A type to represent an aqueous species.
Definition: AqueousSpecies.hpp:32
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto gaseousSpecies() -> std::vector< GaseousSpecies >
Return all gaseous species in the database.
Definition: Database.cpp:955
auto liquidSpecies() -> std::vector< LiquidSpecies >
Return all liquid species in the database.
Definition: Database.cpp:965
A type to describe the attributes of a fluids (gaseous or liquid) species.
Definition: FluidSpecies.hpp:31
auto aqueousSpecies() -> std::vector< AqueousSpecies >
Return all aqueous species in the database.
Definition: Database.cpp:945