Provides convenient operations to initialize ChemicalSystem and ReactionSystem instances. More...
#include <ChemicalEditor.hpp>
Public Member Functions | |
ChemicalEditor () | |
Construct a default ChemicalEditor instance. More... | |
ChemicalEditor (const Database &database) | |
Construct a ChemicalEditor instance with a provided database. | |
ChemicalEditor (const ThermoFun::Database &database) | |
Construct a ChemicalEditor instance with a provided ThermoFun database. | |
ChemicalEditor (const ChemicalEditor &other) | |
Construct a copy of the provided ChemicalEditor instance. | |
virtual | ~ChemicalEditor () |
Destroy the ChemicalEditor instance. | |
auto | operator= (const ChemicalEditor &other) -> ChemicalEditor & |
Assign this ChemicalEditor instance with another. | |
auto | setTemperatures (std::vector< double > values, std::string units) -> void |
Set the temperatures for constructing interpolation tables of thermodynamic properties. More... | |
auto | setPressures (std::vector< double > values, std::string units) -> void |
Set the pressures for constructing interpolation tables of thermodynamic properties. More... | |
auto | initializePhasesWithElements (const StringList &elements) -> void |
Initialize all possible phases that can exist with given elements. More... | |
auto | addPhase (const AqueousPhase &phase) -> AqueousPhase & |
Add an aqueous phase in the chemical editor. More... | |
auto | addPhase (const GaseousPhase &phase) -> GaseousPhase & |
Add a gaseous phase in the chemical editor. More... | |
auto | addPhase (const LiquidPhase &phase) -> LiquidPhase & |
Add a liquid phase in the chemical editor. More... | |
auto | addPhase (const MineralPhase &phase) -> MineralPhase & |
Add a mineral phase in the chemical editor. More... | |
auto | addReaction (const MineralReaction &reaction) -> MineralReaction & |
Add a mineral reaction in the chemical editor. More... | |
auto | addAqueousPhase (const StringList &species) -> AqueousPhase & |
Add an aqueous phase in the chemical editor. More... | |
auto | addAqueousPhaseWithElements (const StringList &elements) -> AqueousPhase & |
Add an aqueous phase in the chemical editor. More... | |
auto | addAqueousPhaseWithElementsOf (const StringList &compounds) -> AqueousPhase & |
Add an aqueous phase in the chemical editor. More... | |
auto | addGaseousPhase (const StringList &species) -> GaseousPhase & |
Add a gaseous phase in the chemical editor. More... | |
auto | addGaseousPhaseWithElements (const StringList &elements) -> GaseousPhase & |
Add a gaseous phase in the chemical editor. More... | |
auto | addGaseousPhaseWithElementsOf (const StringList &compounds) -> GaseousPhase & |
Add a gaseous phase in the chemical editor. More... | |
auto | addLiquidPhase (const StringList &species) -> LiquidPhase & |
Add a liquid phase in the chemical editor. More... | |
auto | addLiquidPhaseWithElements (const StringList &elements) -> LiquidPhase & |
Add a liquid phase in the chemical editor. More... | |
auto | addLiquidPhaseWithElementsOf (const StringList &compounds) -> LiquidPhase & |
Add a liquid phase in the chemical editor. More... | |
auto | addMineralPhase (const StringList &species) -> MineralPhase & |
Add a mineral phase in the chemical editor. More... | |
auto | addMineralPhaseWithElements (const StringList &elements) -> MineralPhase & |
Add a mineral phase in the chemical editor. More... | |
auto | addMineralPhaseWithElementsOf (const StringList &compounds) -> MineralPhase & |
Add a mineral phase in the chemical editor. More... | |
auto | addMineralReaction (const MineralReaction &reaction) -> MineralReaction & |
Add a mineral reaction in the chemical editor. More... | |
auto | addMineralReaction (std::string mineral) -> MineralReaction & |
Add a mineral reaction in the chemical editor. More... | |
auto | aqueousPhase () const -> const AqueousPhase & |
Return the aqueous phase in the chemical editor. | |
auto | aqueousPhase () -> AqueousPhase & |
Return the aqueous phase in the chemical editor. | |
auto | gaseousPhase () const -> const GaseousPhase & |
Return the gaseous phase in the chemical editor. | |
auto | gaseousPhase () -> GaseousPhase & |
Return the gaseous phase in the chemical editor. | |
auto | liquidPhase () const -> const LiquidPhase & |
Return the liquid phase in the chemical editor. | |
auto | liquidPhase () -> LiquidPhase & |
Return the liquid phase in the chemical editor. | |
auto | mineralPhases () const -> const std::vector< MineralPhase > & |
Return the mineral phases in the chemical editor. | |
auto | mineralPhases () -> std::vector< MineralPhase > & |
Return the mineral phases in the chemical editor. | |
auto | createChemicalSystem () const -> ChemicalSystem |
Create a ChemicalSystem instance with the current state of the chemical editor. | |
auto | createReactionSystem () const -> ReactionSystem |
Create a ReactionSystem instance with the current state of the chemical editor. | |
operator ChemicalSystem () const | |
Convert this ChemicalEditor instance to a ChemicalSystem instance. | |
operator ReactionSystem () const | |
Convert this ChemicalEditor instance to a ReactionSystem instance. | |
Detailed Description
Provides convenient operations to initialize ChemicalSystem and ReactionSystem instances.
The ChemicalEditor class is used to conveniently create instances of classes ChemicalSystem and ReactionSystem.
Usage
The code below uses a ChemicalEditor instance to define a chemical system composed of an aqueous phase and a mineral phase. In addition, it defines a chemical reaction involving both aqueous and mineral species. Finally, the editor instance is used to create a ChemicalSystem instance and a ReactionSystem instance.
- See also
- Database, ChemicalSystem, ReactionSystem, AqueousPhase, GaseousPhase, LiquidPhase, MineralPhase, AqueousSpecies, GaseousSpecies, LiquidSpecies, MineralSpecies, MineralReaction
Constructor & Destructor Documentation
◆ ChemicalEditor()
ChemicalEditor | ( | ) |
Construct a default ChemicalEditor instance.
The built-in database supcrt98.xml
is used for the initialization of a ChemicalEditor instance using the default constructor.
Member Function Documentation
◆ setTemperatures()
auto setTemperatures | ( | std::vector< double > | values, |
std::string | units | ||
) | -> void |
Set the temperatures for constructing interpolation tables of thermodynamic properties.
- Parameters
-
values The temperature values units The units of the temperature values
◆ setPressures()
auto setPressures | ( | std::vector< double > | values, |
std::string | units | ||
) | -> void |
Set the pressures for constructing interpolation tables of thermodynamic properties.
- Parameters
-
values The pressure values units The units of the pressure values
◆ initializePhasesWithElements()
auto initializePhasesWithElements | ( | const StringList & | elements | ) | -> void |
Initialize all possible phases that can exist with given elements.
- Parameters
-
elements The element symbols of interest.
◆ addPhase() [1/4]
auto addPhase | ( | const AqueousPhase & | phase | ) | -> AqueousPhase& |
Add an aqueous phase in the chemical editor.
Note that only one aqueous phase can exist in the chemical editor. So whenever this method is called, it has the effect of updating the current state of the aqueous phase in the editor.
- Parameters
-
phase The AqueousPhase instance
- Returns
- A reference to the created AqueousPhase object.
◆ addPhase() [2/4]
auto addPhase | ( | const GaseousPhase & | phase | ) | -> GaseousPhase& |
Add a gaseous phase in the chemical editor.
Note that only one gaseous phase can exist in the chemical editor. So whenever this method is called, it has the effect of updating the current state on gaseous phase in the editor.
- Parameters
-
phase The GaseousPhase instance
- Returns
- A reference to the created GaseousPhase object.
◆ addPhase() [3/4]
auto addPhase | ( | const LiquidPhase & | phase | ) | -> LiquidPhase& |
Add a liquid phase in the chemical editor.
Note that only one liquid phase can exist in the chemical editor. So whenever this method is called, it has the effect of updating the current state on liquid phase in the editor.
- Parameters
-
phase The LiquidPhase instance
- Returns
- A reference to the created LiquidPhase object.
◆ addPhase() [4/4]
auto addPhase | ( | const MineralPhase & | phase | ) | -> MineralPhase& |
Add a mineral phase in the chemical editor.
If a mineral phase with the same name already exists, then the existing phase is replaced by the new one.
- Parameters
-
phase The MineralPhase instance
- Returns
- A reference to the created MineralPhase object.
◆ addReaction()
auto addReaction | ( | const MineralReaction & | reaction | ) | -> MineralReaction& |
Add a mineral reaction in the chemical editor.
- Parameters
-
reaction The MineralReaction instance
- Returns
- A reference to the created MineralReaction object.
◆ addAqueousPhase()
auto addAqueousPhase | ( | const StringList & | species | ) | -> AqueousPhase& |
Add an aqueous phase in the chemical editor.
This method constructs an AqueousPhase object that represents an aqueous phase in the system. The AqueousPhase object is created by specifying the names of the species one by one. These species names must conform to those used in the database that was specified during the initialization of the ChemicalEditor object, otherwise, an exception will be thrown. The example below describes the usage of this method for an aqueous phase that could be formed by mixing H2O, CO2 and NaCl.
An alternative way, in which to prior knowledge of the species names in the database is needed, consists of specifying a list of chemical element, compound, or substance names, and let the ChemicalEditor to figure out automatically which species from the loaded database should be added in the phase. This functionality is supported by methods
addAqueousPhaseWithElements(const std::vector<std::string>& elements),
addAqueousPhaseWithElementsOf(const std::vector<std::string>& compounds).
- Parameters
-
species A StringList containing the names of the species.
- Returns
- A reference to the created AqueousPhase object.
- See also
- addGaseousPhase, addLiquidPhase, addMineralPhase
- Note
- The old use of this function to add elements and/or compounds was removed. To use these functionalities, use addAqueousPhaseWitElements to add elements and addAqueousPhaseWitElementsOf to add compounds.
◆ addAqueousPhaseWithElements()
auto addAqueousPhaseWithElements | ( | const StringList & | elements | ) | -> AqueousPhase& |
Add an aqueous phase in the chemical editor.
This method constructs an AqueousPhase object that represents an aqueous phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the AqueousPhase object to be constructed by using a list of chemical element names, and the database will then be searched for all species that could be formed out of those elements. These species will then be used to construct the AqueousPhase object. The example below describes three equivalent alternatives to construct an AqueousPhase object that represents an aqueous phase that could be formed by mixing H2O, CO2 and NaCl.
This might not be relevant for an aqueous phase, which in general contains many species, but it is a convenient functionality for gaseous and mineral phases, for example, which might only contain one species of interest.
- Parameters
-
elements A StringList containing a list of chemical element names.
- Returns
- A reference to the created AqueousPhase object.
◆ addAqueousPhaseWithElementsOf()
auto addAqueousPhaseWithElementsOf | ( | const StringList & | compounds | ) | -> AqueousPhase& |
Add an aqueous phase in the chemical editor.
This method constructs an AqueousPhase object that represents an aqueous phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the AqueousPhase object to be constructed by using a list of compound or substance names that might not represent names of species in the database. The list of compounds will be broken into a list of element names, and the database will then be searched for all species that could be formed out of those elements. These species will then be used to construct the AqueousPhase object. The example below describes three equivalent alternatives to construct an AqueousPhase object that represents an aqueous phase that could be formed by mixing H2O, CO2 and NaCl.
This might not be relevant for an aqueous phase, which in general contains many species, but it is a convenient functionality for gaseous and mineral phases, for example, which might only contain one species of interest.
- Parameters
-
compounds A StringList containing a list of compound names.
- Returns
- A reference to the created AqueousPhase object.
◆ addGaseousPhase()
auto addGaseousPhase | ( | const StringList & | species | ) | -> GaseousPhase& |
Add a gaseous phase in the chemical editor.
This method constructs a GaseousPhase object that represents a gaseous phase in the system. The GaseousPhase object is created by specifying the names of the species one by one. These species names must conform to those used in the database that was specified during the initialization of the ChemicalEditor object, otherwise, an exception will be thrown. The example below describes the usage of this method for a gaseous phase that could be formed by mixing CH4 and O2.
An alternative way, in which to prior knowledge of the species names in the database is needed, consists of specifying a list of chemical element, compound, or substance names, and let the ChemicalEditor to figure out automatically which species from the loaded database should be added in the phase. This functionality is supported by method addGaseousPhaseWithElements(std::string elements). addGaseousPhaseWithElementsOf(std::string compounds).
- Parameters
-
species A StringList containing the names of the species.
- Returns
- A reference to the created GaseousPhase object.
- See also
- addAqueousPhase, addLiquidPhase, addMineralPhase
- Note
- The old use of this function to add elements and/or compounds was removed. To use these functionalities, use addGaseousPhaseWitElements to add elements and addGaseousPhaseWitElementsOf to add compounds.
◆ addGaseousPhaseWithElements()
auto addGaseousPhaseWithElements | ( | const StringList & | elements | ) | -> GaseousPhase& |
Add a gaseous phase in the chemical editor.
This method constructs a GaseousPhase object that represents a gaseous phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the GaseousPhase object to be constructed by using a list of chemical element names and the database will then be searched for all species that could be formed out of those elements. These species will then be used to construct the GaseousPhase object. The example below describes three equivalent alternatives to construct a GaseousPhase object that represents a gaseous phase that could be formed by mixing H2O and CO2.
- Parameters
-
elements A StringList containing a list of chemical element names.
- Returns
- A reference to the created GaseousPhase object.
◆ addGaseousPhaseWithElementsOf()
auto addGaseousPhaseWithElementsOf | ( | const StringList & | compounds | ) | -> GaseousPhase& |
Add a gaseous phase in the chemical editor.
This method constructs a GaseousPhase object that represents a gaseous phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the GaseousPhase object to be constructed by using a list of compound or substance names that might not represent names of species in the database. The list of compounds will be broken into a list of element names, and the database will then be searched for all species that could be formed out of those elements. The example below describes three equivalent alternatives to construct a GaseousPhase object that represents a gaseous phase that could be formed by mixing H2O and CO2.
- Parameters
-
compounds A StringList containing a list of compound names.
- Returns
- A reference to the created GaseousPhase object.
◆ addLiquidPhase()
auto addLiquidPhase | ( | const StringList & | species | ) | -> LiquidPhase& |
Add a liquid phase in the chemical editor.
This method constructs a LiquidPhase object that represents a liquid phase in the system. The LiquidPhase object is created by specifying the names of the species one by one. These species names must conform to those used in the database that was specified during the initialization of the ChemicalEditor object, otherwise, an exception will be thrown. The example below describes the usage of this method for a liquid phase that could be formed by mixing CH4 and O2.
An alternative way, in which to prior knowledge of the species names in the database is needed, consists of specifying a list of chemical element, compound, or substance names, and let the ChemicalEditor to figure out automatically which species from the loaded database should be added in the phase. This functionality is supported by method addLiquidPhaseWithElements(std::string elements). addLiquidPhaseWithElementsOf(std::string compounds).
- Parameters
-
species A StringList containing the names of the species.
- Returns
- A reference to the created LiquidPhase object.
- See also
- addAqueousPhase, addGaseousPhase, addMineralPhase
- Note
- The old use of this function to add elements and/or compounds was removed. To use these functionalities, use addGaseousPhaseWitElements to add elements and addGaseousPhaseWitElementsOf to add compounds.
◆ addLiquidPhaseWithElements()
auto addLiquidPhaseWithElements | ( | const StringList & | elements | ) | -> LiquidPhase& |
Add a liquid phase in the chemical editor.
This method constructs a LiquidPhase object that represents a liquid phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the LiquidPhase object to be constructed by using a list of chemical element names and the database will then be searched for all species that could be formed out of those elements. These species will then be used to construct the LiquidPhase object. The example below describes three equivalent alternatives to construct a LiquidPhase object that represents a liquid phase that could be formed by mixing H2S and CO2.
- Parameters
-
elements A StringList containing a list of chemical element names.
- Returns
- A reference to the created LiquidPhase object.
◆ addLiquidPhaseWithElementsOf()
auto addLiquidPhaseWithElementsOf | ( | const StringList & | compounds | ) | -> LiquidPhase& |
Add a liquid phase in the chemical editor.
This method constructs a LiquidPhase object that represents a liquid phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the LiquidPhase object to be constructed by using a list of compound or substance names that might not represent names of species in the database. The list of compounds will be broken into a list of element names, and the database will then be searched for all species that could be formed out of those elements. The example below describes three equivalent alternatives to construct a LiquidPhase object that represents a liquid phase that could be formed by mixing H2S and CO2.
- Parameters
-
compounds A StringList containing a list of compound names.
- Returns
- A reference to the created LiquidPhase object.
◆ addMineralPhase()
auto addMineralPhase | ( | const StringList & | species | ) | -> MineralPhase& |
Add a mineral phase in the chemical editor.
This method constructs a MineralPhase object that represents a mineral phase in the system. The MineralPhase object is created by specifying the names of the species one by one. These species names must conform to those used in the database that was specified during the initialization of the ChemicalEditor object, otherwise, an exception will be thrown. The example below describes the usage of this method for the creation of two pure mineral phases and one solid solution with two mineral species.
An alternative way, in which a prior knowledge of the species names in the database is needed, consists of specifying a list of chemical elements or compounds, and let the ChemicalEditor to figure out automatically which species from the loaded database should be added in the phase. This functionality is supported by methods addMineralPhaseWithElements(std::string elements) and addMineralPhaseWithElementsOf(std::string compounds).
- Parameters
-
species A StringList containing the names of the species.
- Returns
- A reference to the created MineralPhase object.
- See also
- addAqueousPhase, addLiquidPhase, addGaseousPhase
- Note
- The old use of this function to add elements and/or compounds was removed. To use these functionalities, use addMineralPhaseWitElements to add eslements and addMineralPhaseWitElementsOf to add compounds.
◆ addMineralPhaseWithElements()
auto addMineralPhaseWithElements | ( | const StringList & | elements | ) | -> MineralPhase& |
Add a mineral phase in the chemical editor.
This method constructs a MineralPhase object that represents a mineral phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the MineralPhase object to be constructed by using a list of chemical element names, and the database will then be searched for all species that could be formed out of those elements. These species will then be used to construct the MineralPhase object. The example below describes several possibilities to construct a MineralPhase object.
- Note
- In most cases, the solid solutions of interest have predefined mineral composition, so that one might prefer instead to list the mineral end-members one by one, instead of letting ChemicalEditor to populate the solid solution with many minerals that could be formed from a given list of chemical elements.
- Parameters
-
elements A StringList containing a list of chemical element names.
- Returns
- A reference to the created MineralPhase object.
◆ addMineralPhaseWithElementsOf()
auto addMineralPhaseWithElementsOf | ( | const StringList & | compounds | ) | -> MineralPhase& |
Add a mineral phase in the chemical editor.
This method constructs a MineralPhase object that represents a mineral phase in the system. Instead of listing the names of the species one by one, which might require prior knowledge of the species names in the database, this method permits the MineralPhase object to be constructed by using a list of compound or substance names that might not represent names of species in the database. The list of compounds will be broken into a list of element names, and the database will then be searched for all species that could be formed out of those elements. These species will then be used to construct the MineralPhase object. The example below describes several possibilities to construct a MineralPhase object.
- Note
- In most cases, the solid solutions of interest have predefined mineral composition, so that one might prefer instead to list the mineral end-members one by one, instead of letting ChemicalEditor to populate the solid solution with many minerals that could be formed from a given list of compound names.
- Parameters
-
compounds A StringList containing a list of compound names.
- Returns
- A reference to the created MineralPhase object.
◆ addMineralReaction() [1/2]
auto addMineralReaction | ( | const MineralReaction & | reaction | ) | -> MineralReaction& |
Add a mineral reaction in the chemical editor.
- Parameters
-
reaction The mineral reaction.
- Returns
- A reference to the created MineralReaction object.
◆ addMineralReaction() [2/2]
auto addMineralReaction | ( | std::string | mineral | ) | -> MineralReaction& |
Add a mineral reaction in the chemical editor.
- Parameters
-
mineral The name of the mineral for which the reaction will be defined.
- Returns
- A reference to the created MineralReaction object.
The documentation for this class was generated from the following files:
- Reaktoro/Thermodynamics/Core/ChemicalEditor.hpp
- Reaktoro/Thermodynamics/Core/ChemicalEditor.cpp