Reaktoro
A unified framework for modeling chemically reactive systems
Thermo.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2018 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // C++ includes
21 #include <string>
22 #include <memory>
23 
24 // Reaktoro includes
25 #include <Reaktoro/Common/ScalarTypes.hpp>
26 
27 // Forwardt declarations for ThermoFun
28 namespace ThermoFun {
29 
30 class Database;
31 
32 } // namespace ThermoFun
33 
34 namespace Reaktoro {
35 
36 // Forward declarations
37 class Database;
38 struct SpeciesThermoState;
39 struct WaterThermoState;
40 
42 class Thermo
43 {
44 public:
46  explicit Thermo(const Database& database);
47 
49  explicit Thermo(const ThermoFun::Database& database);
50 
55  auto standardPartialMolarGibbsEnergy(double T, double P, std::string species) const -> ThermoScalar;
56 
61  auto standardPartialMolarHelmholtzEnergy(double T, double P, std::string species) const -> ThermoScalar;
62 
67  auto standardPartialMolarInternalEnergy(double T, double P, std::string species) const -> ThermoScalar;
68 
73  auto standardPartialMolarEnthalpy(double T, double P, std::string species) const -> ThermoScalar;
74 
79  auto standardPartialMolarEntropy(double T, double P, std::string species) const -> ThermoScalar;
80 
85  auto standardPartialMolarVolume(double T, double P, std::string species) const -> ThermoScalar;
86 
91  auto standardPartialMolarHeatCapacityConstP(double T, double P, std::string species) const -> ThermoScalar;
92 
97  auto standardPartialMolarHeatCapacityConstV(double T, double P, std::string species) const -> ThermoScalar;
98 
103  auto lnEquilibriumConstant(double T, double P, std::string reaction) -> ThermoScalar;
104 
109  auto logEquilibriumConstant(double T, double P, std::string reaction) -> ThermoScalar;
110 
113  auto hasStandardPartialMolarGibbsEnergy(std::string species) const -> bool;
114 
117  auto hasStandardPartialMolarHelmholtzEnergy(std::string species) const -> bool;
118 
121  auto hasStandardPartialMolarInternalEnergy(std::string species) const -> bool;
122 
125  auto hasStandardPartialMolarEnthalpy(std::string species) const -> bool;
126 
129  auto hasStandardPartialMolarEntropy(std::string species) const -> bool;
130 
133  auto hasStandardPartialMolarVolume(std::string species) const -> bool;
134 
137  auto hasStandardPartialMolarHeatCapacityConstP(std::string species) const -> bool;
138 
141  auto hasStandardPartialMolarHeatCapacityConstV(std::string species) const -> bool;
142 
148  auto speciesThermoStateHKF(double T, double P, std::string species) -> SpeciesThermoState;
149 
154  auto waterThermoStateHGK(double T, double P) -> WaterThermoState;
155 
160  auto waterThermoStateWagnerPruss(double T, double P) -> WaterThermoState;
161 
162 private:
163  struct Impl;
164 
165  std::shared_ptr<Impl> pimpl;
166 };
167 
168 } // namespace Reaktoro
auto hasStandardPartialMolarHeatCapacityConstP(std::string species) const -> bool
Return true if there is support for the calculation of the standard molar isobaric heat capacity of a...
Definition: Thermo.cpp:715
auto logEquilibriumConstant(double T, double P, std::string reaction) -> ThermoScalar
Calculate the log equilibrium constant of a reaction.
Definition: Thermo.cpp:611
Provides operations to retrieve physical and thermodynamic data of chemical species.
Definition: Database.hpp:78
auto hasStandardPartialMolarHeatCapacityConstV(std::string species) const -> bool
Return true if there is support for the calculation of the standard molar isochoric heat capacity of ...
Definition: Thermo.cpp:731
auto speciesThermoStateHKF(double T, double P, std::string species) -> SpeciesThermoState
Calculate the thermodynamic state of an aqueous species using the HKF model.
Definition: Thermo.cpp:747
Describe the thermodynamic state of a species.
Definition: SpeciesThermoState.hpp:27
auto database(std::string name) -> std::string
Return the contents of a built-in database as a string.
Definition: DatabaseUtils.cpp:65
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto hasStandardPartialMolarHelmholtzEnergy(std::string species) const -> bool
Return true if there is support for the calculation of the apparent standard molar Helmholtz free ene...
Definition: Thermo.cpp:635
Definition: WaterThermoState.hpp:26
auto standardPartialMolarInternalEnergy(double T, double P, std::string species) const -> ThermoScalar
Calculate the apparent standard molar internal energy of a species (in units of J/mol).
Definition: Thermo.cpp:576
auto hasStandardPartialMolarInternalEnergy(std::string species) const -> bool
Return true if there is support for the calculation of the apparent standard molar internal energy of...
Definition: Thermo.cpp:651
auto standardPartialMolarEnthalpy(double T, double P, std::string species) const -> ThermoScalar
Calculate the apparent standard molar enthalpy of a species (in units of J/mol).
Definition: Thermo.cpp:581
auto standardPartialMolarHeatCapacityConstP(double T, double P, std::string species) const -> ThermoScalar
Calculate the standard molar isobaric heat capacity of a species (in units of J/(mol*K)).
Definition: Thermo.cpp:596
auto hasStandardPartialMolarEntropy(std::string species) const -> bool
Return true if there is support for the calculation of the standard molar entropies of a species.
Definition: Thermo.cpp:683
auto standardPartialMolarEntropy(double T, double P, std::string species) const -> ThermoScalar
Calculate the standard molar entropies of a species (in units of J/K).
Definition: Thermo.cpp:586
auto hasStandardPartialMolarVolume(std::string species) const -> bool
Return true if there is support for the calculation of the standard molar volumes of a species.
Definition: Thermo.cpp:699
auto standardPartialMolarVolume(double T, double P, std::string species) const -> ThermoScalar
Calculate the standard molar volumes of a species (in units of m3/mol).
Definition: Thermo.cpp:591
Thermo(const Database &database)
Construct a Thermo instance with given Database instance.
Definition: Thermo.cpp:562
auto standardPartialMolarHeatCapacityConstV(double T, double P, std::string species) const -> ThermoScalar
Calculate the standard molar isochoric heat capacity of a species (in units of J/(mol*K)).
Definition: Thermo.cpp:601
auto standardPartialMolarGibbsEnergy(double T, double P, std::string species) const -> ThermoScalar
Calculate the apparent standard molar Gibbs free energy of a species (in units of J/mol).
Definition: Thermo.cpp:566
auto standardPartialMolarHelmholtzEnergy(double T, double P, std::string species) const -> ThermoScalar
Calculate the apparent standard molar Helmholtz free energy of a species (in units of J/mol).
Definition: Thermo.cpp:571
auto waterThermoStateWagnerPruss(double T, double P) -> WaterThermoState
Calculate the thermodynamic state of water using the Wagner and Pruss (1995) equation of state.
Definition: Thermo.cpp:757
auto hasStandardPartialMolarEnthalpy(std::string species) const -> bool
Return true if there is support for the calculation of the apparent standard molar enthalpy of a spec...
Definition: Thermo.cpp:667
auto hasStandardPartialMolarGibbsEnergy(std::string species) const -> bool
Return true if there is support for the calculation of the apparent standard molar Gibbs free energy ...
Definition: Thermo.cpp:616
auto lnEquilibriumConstant(double T, double P, std::string reaction) -> ThermoScalar
Calculate the ln equilibrium constant of a reaction.
Definition: Thermo.cpp:606
auto waterThermoStateHGK(double T, double P) -> WaterThermoState
Calculate the thermodynamic state of water using the Haar–Gallagher–Kell (1984) equation of state.
Definition: Thermo.cpp:752
ThermoScalarBase< double > ThermoScalar
A type that defines a scalar thermo property.
Definition: ScalarTypes.hpp:40
A type to calculate thermodynamic properties of chemical species.
Definition: Thermo.hpp:43