Reaktoro
A unified framework for modeling chemically reactive systems
ThermoModel.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 <functional>
22 
23 // Reaktoro includes
24 #include <Reaktoro/Thermodynamics/Models/PhaseThermoModel.hpp>
25 
26 namespace Reaktoro {
27 
30 {
31 public:
34 
38  ThermoModelResult(Index nphases, Index nspecies);
39 
43  auto resize(Index nphases, Index nspecies) -> void;
44 
49  auto phaseProperties(Index iphase, Index ispecies, Index nspecies) -> PhaseThermoModelResult;
50 
55  auto phaseProperties(Index iphase, Index ispecies, Index nspecies) const -> PhaseThermoModelResultConst;
56 
58  inline auto standardPartialMolarGibbsEnergies() -> ThermoVectorRef { return standard_partial_molar_gibbs_energies; };
59 
61  inline auto standardPartialMolarGibbsEnergies() const -> ThermoVectorConstRef { return standard_partial_molar_gibbs_energies; };
62 
64  inline auto standardPartialMolarEnthalpies() -> ThermoVectorRef { return standard_partial_molar_enthalpies; };
65 
67  inline auto standardPartialMolarEnthalpies() const -> ThermoVectorConstRef { return standard_partial_molar_enthalpies; };
68 
70  inline auto standardPartialMolarVolumes() -> ThermoVectorRef { return standard_partial_molar_volumes; };
71 
73  inline auto standardPartialMolarVolumes() const -> ThermoVectorConstRef { return standard_partial_molar_volumes; };
74 
76  inline auto standardPartialMolarHeatCapacitiesConstP() -> ThermoVectorRef { return standard_partial_molar_heat_capacities_cp; };
77 
79  inline auto standardPartialMolarHeatCapacitiesConstP() const -> ThermoVectorConstRef { return standard_partial_molar_heat_capacities_cp; };
80 
82  inline auto standardPartialMolarHeatCapacitiesConstV() -> ThermoVectorRef { return standard_partial_molar_heat_capacities_cv; };
83 
85  inline auto standardPartialMolarHeatCapacitiesConstV() const -> ThermoVectorConstRef { return standard_partial_molar_heat_capacities_cv; };
86 
88  inline auto lnActivityConstants() -> ThermoVectorRef { return ln_activity_constants; };
89 
91  inline auto lnActivityConstants() const -> ThermoVectorConstRef { return ln_activity_constants; };
92 
93 private:
95  ThermoVector standard_partial_molar_gibbs_energies;
96 
98  ThermoVector standard_partial_molar_enthalpies;
99 
101  ThermoVector standard_partial_molar_volumes;
102 
104  ThermoVector standard_partial_molar_heat_capacities_cp;
105 
107  ThermoVector standard_partial_molar_heat_capacities_cv;
108 
110  ThermoVector ln_activity_constants;
111 };
112 
114 using ThermoModel = std::function<void(ThermoModelResult&, Temperature, Pressure)>;
115 
116 } // namespace Reaktoro
std::function< void(ThermoModelResult &, Temperature, Pressure)> ThermoModel
The signature of the thermodynamic model function that calculates the standard thermodynamic properti...
Definition: ThermoModel.hpp:114
auto standardPartialMolarEnthalpies() const -> ThermoVectorConstRef
The standard partial molar enthalpies of the species (in units of J/mol).
Definition: ThermoModel.hpp:67
ThermoModelResult()
Construct a default ThermoModelResult instance.
Definition: ThermoModel.cpp:22
auto lnActivityConstants() -> ThermoVectorRef
The natural log of the activity constants of the species.
Definition: ThermoModel.hpp:88
auto standardPartialMolarVolumes() const -> ThermoVectorConstRef
The standard partial molar volumes of the species (in units of m3/mol).
Definition: ThermoModel.hpp:73
A type that describes pressure in units of Pa.
Definition: ThermoScalar.hpp:194
auto standardPartialMolarGibbsEnergies() const -> ThermoVectorConstRef
The standard partial molar Gibbs energies of the species (in units of J/mol).
Definition: ThermoModel.hpp:61
auto standardPartialMolarGibbsEnergies() -> ThermoVectorRef
The standard partial molar Gibbs energies of the species (in units of J/mol).
Definition: ThermoModel.hpp:58
auto lnActivityConstants() const -> ThermoVectorConstRef
The natural log of the activity constants of the species.
Definition: ThermoModel.hpp:91
The result of a thermodynamic model function that calculates standard thermodynamic properties of spe...
Definition: ThermoModel.hpp:30
auto standardPartialMolarHeatCapacitiesConstP() -> ThermoVectorRef
The standard partial molar isobaric heat capacities of the species (in units of J/(mol*K)).
Definition: ThermoModel.hpp:76
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
PhaseThermoModelResultBase< ThermoVectorConstRef > PhaseThermoModelResultConst
The thermodynamic properties of the species in a phase (constant).
Definition: PhaseThermoModel.hpp:56
A type that describes temperature in units of K.
Definition: ThermoScalar.hpp:177
PhaseThermoModelResultBase< ThermoVectorRef > PhaseThermoModelResult
The thermodynamic properties of the species in a phase.
Definition: PhaseThermoModel.hpp:53
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
auto standardPartialMolarVolumes() -> ThermoVectorRef
The standard partial molar volumes of the species (in units of m3/mol).
Definition: ThermoModel.hpp:70
auto standardPartialMolarEnthalpies() -> ThermoVectorRef
The standard partial molar enthalpies of the species (in units of J/mol).
Definition: ThermoModel.hpp:64
auto standardPartialMolarHeatCapacitiesConstV() -> ThermoVectorRef
The standard partial molar isochoric heat capacities of the species (in units of J/(mol*K)).
Definition: ThermoModel.hpp:82
auto phaseProperties(Index iphase, Index ispecies, Index nspecies) -> PhaseThermoModelResult
Return a view of the thermodynamic properties of a phase.
Definition: ThermoModel.cpp:44
auto resize(Index nphases, Index nspecies) -> void
Resize this ThermoModelResult with a given number of species.
Definition: ThermoModel.cpp:34
auto standardPartialMolarHeatCapacitiesConstP() const -> ThermoVectorConstRef
The standard partial molar isobaric heat capacities of the species (in units of J/(mol*K)).
Definition: ThermoModel.hpp:79
auto standardPartialMolarHeatCapacitiesConstV() const -> ThermoVectorConstRef
The standard partial molar isochoric heat capacities of the species (in units of J/(mol*K)).
Definition: ThermoModel.hpp:85
A template base class to represent a vector of thermodynamic scalars and their partial derivatives.
Definition: ThermoVector.hpp:48