Reaktoro 
A unified framework for modeling chemically reactive systems
PhaseChemicalProperties.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 // C++ includes
21 #include <memory>
22 
23 // Reaktoro includes
24 #include <Reaktoro/Common/ChemicalVector.hpp>
25 #include <Reaktoro/Common/ThermoVector.hpp>
26 
27 namespace Reaktoro {
28 
29 // Forward declarations
30 class Phase;
31 
34 {
35 public:
38 
40  explicit PhaseChemicalProperties(const Phase& phase);
41 
44 
46  virtual ~PhaseChemicalProperties();
47 
50 
54  auto update(double T, double P) -> void;
55 
60  auto update(double T, double P, const Vector& n) -> void;
61 
63  auto temperature() const -> double;
64 
66  auto pressure() const -> double;
67 
69  auto composition() const -> const Vector&;
70 
72  auto molarFractions() const -> ChemicalVector;
73 
75  auto lnActivityCoefficients() const -> ChemicalVector;
76 
78  auto lnActivityConstants() const -> ThermoVector;
79 
81  auto lnActivities() const -> ChemicalVector;
82 
84  auto chemicalPotentials() const -> ChemicalVector;
85 
88 
91 
94 
97 
100 
103 
106 
109 
111  auto molarGibbsEnergy() const -> ChemicalScalar;
112 
114  auto molarEnthalpy() const -> ChemicalScalar;
115 
117  auto molarVolume() const -> ChemicalScalar;
118 
120  auto molarEntropy() const -> ChemicalScalar;
121 
123  auto molarInternalEnergy() const -> ChemicalScalar;
124 
126  auto molarHelmholtzEnergy() const -> ChemicalScalar;
127 
129  auto molarHeatCapacityConstP() const -> ChemicalScalar;
130 
132  auto molarHeatCapacityConstV() const -> ChemicalScalar;
133 
135  auto specificGibbsEnergy() const -> ChemicalScalar;
136 
138  auto specificEnthalpy() const -> ChemicalScalar;
139 
141  auto specificVolume() const -> ChemicalScalar;
142 
144  auto specificEntropy() const -> ChemicalScalar;
145 
147  auto specificInternalEnergy() const -> ChemicalScalar;
148 
150  auto specificHelmholtzEnergy() const -> ChemicalScalar;
151 
154 
157 
159  auto density() const -> ChemicalScalar;
160 
162  auto mass() const -> ChemicalScalar;
163 
165  auto amount() const -> ChemicalScalar;
166 
168  auto volume() const -> ChemicalScalar;
169 
170 private:
171  struct Impl;
172 
173  std::unique_ptr<Impl> pimpl;
174 };
175 
176 } // namespace Reaktoro
A type used to define a phase and its attributes.
Definition: Phase.hpp:45
auto mass() const -> ChemicalScalar
Return the mass of the phase (in units of kg).
Definition: PhaseChemicalProperties.cpp:511
ThermoVectorBase< Vector, Vector, Vector > ThermoVector
A type that defines a vector thermo property.
Definition: ScalarTypes.hpp:41
auto composition() const -> const Vector &
Return the amounts of the species of the phase (in units of mol).
Definition: PhaseChemicalProperties.cpp:356
auto standardPartialMolarVolumes() const -> ThermoVector
Return the standard partial molar volumes of the species (in units of m3/mol).
Definition: PhaseChemicalProperties.cpp:396
auto specificEnthalpy() const -> ChemicalScalar
Return the specific enthalpy of the phase (in units of J/kg).
Definition: PhaseChemicalProperties.cpp:471
auto lnActivityCoefficients() const -> ChemicalVector
Return the ln activity coefficients of the species.
Definition: PhaseChemicalProperties.cpp:366
auto molarVolume() const -> ChemicalScalar
Return the molar volume of the phase (in units of m3/mol).
Definition: PhaseChemicalProperties.cpp:436
auto volume() const -> ChemicalScalar
Return the volume of the phase (in units of m3).
Definition: PhaseChemicalProperties.cpp:521
virtual ~PhaseChemicalProperties()
Destroy this instance.
Definition: PhaseChemicalProperties.cpp:327
ChemicalScalarBase< double, Vector > ChemicalScalar
A type that represents a chemical scalar and its derivatives.
Definition: ChemicalScalar.hpp:35
auto molarHeatCapacityConstP() const -> ChemicalScalar
Return the molar isobaric heat capacity of the phase (in units of J/(mol*K)).
Definition: PhaseChemicalProperties.cpp:456
auto standardPartialMolarGibbsEnergies() const -> ThermoVector
Return the standard partial molar Gibbs energies of the species (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:386
auto chemicalPotentials() const -> ChemicalVector
Return the chemical potentials of the species (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:381
auto specificHelmholtzEnergy() const -> ChemicalScalar
Return the specific Helmholtz energy of the phase (in units of J/kg).
Definition: PhaseChemicalProperties.cpp:491
auto molarFractions() const -> ChemicalVector
Return the molar fractions of the species.
Definition: PhaseChemicalProperties.cpp:361
auto molarGibbsEnergy() const -> ChemicalScalar
Return the molar Gibbs energy of the phase (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:426
auto specificVolume() const -> ChemicalScalar
Return the specific volume of the phase (in units of m3/kg).
Definition: PhaseChemicalProperties.cpp:476
auto standardPartialMolarInternalEnergies() const -> ThermoVector
Return the standard partial molar internal energies of the species (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:406
auto update(double T, double P) -> void
Update the thermodynamic properties of the phase.
Definition: PhaseChemicalProperties.cpp:336
Eigen::VectorXd Vector
Define an alias to the vector type of the Eigen library.
Definition: Matrix.hpp:384
auto lnActivityConstants() const -> ThermoVector
Return the ln activity constants of the species.
Definition: PhaseChemicalProperties.cpp:371
auto standardPartialMolarHelmholtzEnergies() const -> ThermoVector
Return the standard partial molar Helmholtz energies of the species (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:411
Defines a class for querying thermodynamic and chemical properties of a phase.
Definition: PhaseChemicalProperties.hpp:33
auto specificInternalEnergy() const -> ChemicalScalar
Return the specific internal energy of the phase (in units of J/kg).
Definition: PhaseChemicalProperties.cpp:486
auto temperature() const -> double
Return the temperature of the phase (in units of K).
Definition: PhaseChemicalProperties.cpp:346
auto lnActivities() const -> ChemicalVector
Return the ln activities of the species.
Definition: PhaseChemicalProperties.cpp:376
auto molarEnthalpy() const -> ChemicalScalar
Return the molar enthalpy of the phase (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:431
ChemicalVectorBase< Vector, Vector, Vector, Matrix > ChemicalVector
A type that represents a vector of chemical scalars and their derivatives.
Definition: ChemicalVector.hpp:39
auto specificHeatCapacityConstP() const -> ChemicalScalar
Return the specific isobaric heat capacity of the phase (in units of J/(kg*K)).
Definition: PhaseChemicalProperties.cpp:496
auto density() const -> ChemicalScalar
Return the density of the phase (in units of kg/m3).
Definition: PhaseChemicalProperties.cpp:506
PhaseChemicalProperties()
Construct a default PhaseChemicalProperties instance.
Definition: PhaseChemicalProperties.cpp:315
auto standardPartialMolarEnthalpies() const -> ThermoVector
Return the standard partial molar enthalpies of the species (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:391
auto molarEntropy() const -> ChemicalScalar
Return the molar entropy of the phase (in units of J/(mol*K)).
Definition: PhaseChemicalProperties.cpp:441
auto amount() const -> ChemicalScalar
Return the amount of the phase (in units of mol).
Definition: PhaseChemicalProperties.cpp:516
auto specificEntropy() const -> ChemicalScalar
Return the specific entropy of the phase (in units of J/(kg*K)).
Definition: PhaseChemicalProperties.cpp:481
auto pressure() const -> double
Return the pressure of the phase (in units of Pa).
Definition: PhaseChemicalProperties.cpp:351
auto standardPartialMolarEntropies() const -> ThermoVector
Return the standard partial molar entropies of the species (in units of J/(mol*K)).
Definition: PhaseChemicalProperties.cpp:401
auto operator=(PhaseChemicalProperties other) -> PhaseChemicalProperties &
Construct a copy of a PhaseChemicalProperties instance.
Definition: PhaseChemicalProperties.cpp:330
auto specificHeatCapacityConstV() const -> ChemicalScalar
Return the specific isochoric heat capacity of the phase (in units of J/(kg*K)).
Definition: PhaseChemicalProperties.cpp:501
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto specificGibbsEnergy() const -> ChemicalScalar
Return the specific Gibbs energy of the phase (in units of J/kg).
Definition: PhaseChemicalProperties.cpp:466
auto molarHeatCapacityConstV() const -> ChemicalScalar
Return the molar isochoric heat capacity of the phase (in units of J/(mol*K)).
Definition: PhaseChemicalProperties.cpp:461
auto molarHelmholtzEnergy() const -> ChemicalScalar
Return the molar Helmholtz energy of the phase (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:451
auto standardPartialMolarHeatCapacitiesConstV() const -> ThermoVector
Return the standard partial molar isochoric heat capacities of the species (in units of J/(mol*K))...
Definition: PhaseChemicalProperties.cpp:421
auto molarInternalEnergy() const -> ChemicalScalar
Return the molar internal energy of the phase (in units of J/mol).
Definition: PhaseChemicalProperties.cpp:446
auto standardPartialMolarHeatCapacitiesConstP() const -> ThermoVector
Return the standard partial molar isobaric heat capacities of the species (in units of J/(mol*K))...
Definition: PhaseChemicalProperties.cpp:416