Reaktoro 
A unified framework for modeling chemically reactive systems
Gems.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // Reaktoro includes
21 #include <Reaktoro/Interfaces/Interface.hpp>
22 
23 // Forward declarations
24 class TNode;
25 
26 namespace Reaktoro {
27 
30 {
32  bool warmstart = true;
33 };
34 
36 class Gems : public Interface
37 {
38 public:
40  Gems();
41 
44  Gems(std::string filename);
45 
47  virtual ~Gems();
48 
50  virtual auto temperature() const -> double;
51 
53  virtual auto pressure() const -> double;
54 
56  virtual auto speciesAmounts() const -> Vector;
57 
59  virtual auto numElements() const -> unsigned;
60 
62  virtual auto numSpecies() const -> unsigned;
63 
65  virtual auto numPhases() const -> unsigned;
66 
68  virtual auto numSpeciesInPhase(Index iphase) const -> unsigned;
69 
71  virtual auto elementName(Index ielement) const -> std::string;
72 
74  virtual auto elementMolarMass(Index ielement) const -> double;
75 
77  virtual auto elementStoichiometry(Index ispecies, Index ielement) const -> double;
78 
80  virtual auto speciesName(Index ispecies) const -> std::string;
81 
83  virtual auto phaseName(Index iphase) const -> std::string;
84 
89  virtual auto properties(Index iphase, double T, double P) -> PhaseThermoModelResult;
90 
96  virtual auto properties(Index iphase, double T, double P, const Vector& nphase) -> PhaseChemicalModelResult;
97 
99  virtual auto clone() const -> std::shared_ptr<Interface>;
100 
104  auto set(double T, double P) -> void;
105 
110  auto set(double T, double P, const Vector& n) -> void;
111 
113  auto setOptions(const GemsOptions& options) -> void;
114 
119  auto equilibrate(double T, double P, const Vector& b) -> void;
120 
122  auto converged() const -> bool;
123 
125  auto numIterations() const -> unsigned;
126 
128  auto elapsedTime() const -> double;
129 
131  auto node() const -> std::shared_ptr<TNode>;
132 
133 private:
134  struct Impl;
135 
136  std::shared_ptr<Impl> pimpl;
137 };
138 
139 } // namespace Reaktoro
auto equilibrate(ChemicalState &state) -> EquilibriumResult
Equilibrate a chemical state instance.
Definition: EquilibriumUtils.cpp:88
The result of the chemical model function that calculates the chemical properties of a phase...
Definition: PhaseChemicalModel.hpp:30
The result of the thermodynamic model function that calculates the standard thermodynamic properties ...
Definition: PhaseThermoModel.hpp:29
bool warmstart
The flag that indicates if smart start initial approximation is used.
Definition: Gems.hpp:32
Eigen::VectorXd Vector
Define an alias to the vector type of the Eigen library.
Definition: Matrix.hpp:384
A class used to interface other codes with Reaktoro.
Definition: Interface.hpp:36
A wrapper class for Gems code.
Definition: Gems.hpp:36
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
A type that describes the options for Gems.
Definition: Gems.hpp:29
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24