Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
FormationReaction.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 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 // Reaktoro includes
21 #include <Reaktoro/Common/Types.hpp>
22 #include <Reaktoro/Core/StandardThermoModel.hpp>
23 #include <Reaktoro/Core/ReactionStandardThermoModel.hpp>
24 
25 namespace Reaktoro {
26 
27 // Forward declarations
28 class Species;
29 
33 {
34 public:
37 
39  auto clone() const -> FormationReaction;
40 
42  auto withReactants(Pairs<Species, double> const& reactants) const -> FormationReaction;
43 
54  auto withEquilibriumConstant(real const& lgK0) const -> FormationReaction;
55 
69 
83 
86 
88  auto initialized() const -> bool;
89 
91  auto reactants() const -> const Pairs<Species, double>&;
92 
94  auto stoichiometry(String reactant) const -> double;
95 
97  auto productStandardVolumeModel() const -> const Model<real(real,real)>&;
98 
101 
113 
114 private:
115  struct Impl;
116 
117  std::shared_ptr<Impl> pimpl;
118 };
119 
120 } // namespace Reaktoro
A class to represent a formation reaction of a chemical species.
Definition: FormationReaction.hpp:33
auto initialized() const -> bool
Return true if this FormationReaction object has been initialized with reactants and a reaction therm...
auto withProductStandardVolume(real const &V0p) const -> FormationReaction
Return a duplicate of this FormationReaction object with new standard molar volume function for the p...
auto clone() const -> FormationReaction
Return a deep copy of this FormationReaction object.
auto productStandardVolumeModel() const -> const Model< real(real, real)> &
Return the standard molar volume function of the product species.
auto withReactants(Pairs< Species, double > const &reactants) const -> FormationReaction
Return a duplicate of this FormationReaction object with new reactant species in the formation reacti...
FormationReaction()
Construct a default FormationReaction object.
auto createStandardThermoModel() const -> StandardThermoModel
Construct the standard thermodynamic model function of the product species.
auto withReactionStandardThermoModel(const ReactionStandardThermoModel &fn) const -> FormationReaction
Return a duplicate of this FormationReaction object with a new reaction standard thermodynamic model ...
auto reactionThermoModel() const -> const ReactionStandardThermoModel &
Return the reaction thermodynamic model function of the formation reaction.
auto stoichiometry(String reactant) const -> double
Return the stoichiometric coefficient of a reactant with given name in the formation reaction.
auto withEquilibriumConstant(real const &lgK0) const -> FormationReaction
Return a duplicate of this FormationReaction object with new reaction thermodynamic model function.
auto reactants() const -> const Pairs< Species, double > &
Return the reactant species in the formation reaction.
auto withProductStandardVolumeModel(Model< real(real, real)> fn) const -> FormationReaction
Return a duplicate of this FormationReaction object with new standard molar volume function for the p...
Definition: Model.hpp:30
A type used to represent a chemical species and its attributes.
Definition: Species.hpp:35
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
Vec< Pair< T, U > > Pairs
Convenient alias for std::vector<std::pair<T, U>>.
Definition: Types.hpp:90
std::string String
Convenient alias for std::string.
Definition: Types.hpp:52
autodiff::real real
The number type used throughout the library.
Definition: Real.hpp:26