Reaktoro
A unified framework for modeling chemically reactive systems
MineralReaction.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 <vector>
23 #include <memory>
24 
25 // Reaktoro includes
26 #include <Reaktoro/Common/ScalarTypes.hpp>
27 #include <Reaktoro/Thermodynamics/Reactions/MineralCatalyst.hpp>
28 #include <Reaktoro/Thermodynamics/Reactions/MineralMechanism.hpp>
29 
30 namespace Reaktoro {
31 
32 // Forward declarations
33 class ChemicalSystem;
34 class Reaction;
35 class ReactionEquation;
36 
38 {
39 public:
42 
44  MineralReaction(std::string mineral);
45 
47  auto setMineral(std::string mineral) -> MineralReaction&;
48 
52 
57  auto setEquation(std::string equation) -> MineralReaction&;
58 
62  auto setEquilibriumConstant(const ThermoScalarFunction& lnk) -> MineralReaction&;
63 
71  auto setSpecificSurfaceArea(double value, std::string unit) -> MineralReaction&;
72 
77  auto setSurfaceArea(double value, std::string unit) -> MineralReaction&;
78 
81  auto addMechanism(std::string mechanism) -> MineralReaction&;
82 
86  auto addMechanism(const MineralMechanism& mechanism) -> MineralReaction&;
87 
91  auto setMechanisms(const std::vector<MineralMechanism>& mechanisms) -> MineralReaction&;
92 
94  auto mineral() const -> std::string;
95 
98  auto equation() const -> const ReactionEquation&;
99 
101  auto equilibriumConstant() const -> const ThermoScalarFunction&;
102 
104  auto specificSurfaceArea() const -> double;
105 
107  auto volumetricSurfaceArea() const -> double;
108 
110  auto surfaceArea() const -> double;
111 
114  auto mechanisms() const -> const std::vector<MineralMechanism>&;
115 
116 private:
117  struct Impl;
118 
119  std::shared_ptr<Impl> pimpl;
120 };
121 
122 auto createReaction(const MineralReaction& reaction, const ChemicalSystem& system) -> Reaction;
123 
124 } // namespace Reaktoro
auto equation() const -> const ReactionEquation &
Return the equation of the mineral reaction as a string.
Definition: MineralReaction.cpp:367
auto setMechanisms(const std::vector< MineralMechanism > &mechanisms) -> MineralReaction &
Set the mineral mechanisms of the kinetic rate model of the mineral reaction.
Definition: MineralReaction.cpp:356
auto unit(Index rows, Index i) -> decltype(Vector::Unit(rows, i))
Return an expression of a unit vector.
Definition: Matrix.hxx:47
Definition: MineralReaction.hpp:37
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:37
auto setSpecificSurfaceArea(double value, std::string unit) -> MineralReaction &
Set the specific surface area of the mineral.
Definition: MineralReaction.cpp:332
auto equilibriumConstant() const -> const ThermoScalarFunction &
Return the equilibrium constant of the mineral reaction.
Definition: MineralReaction.cpp:372
auto specificSurfaceArea() const -> double
Return the specific surface area of the mineral (in units of m2/kg).
Definition: MineralReaction.cpp:377
auto volumetricSurfaceArea() const -> double
Return the volumetric surface area of the mineral (in units of m2/m3).
Definition: MineralReaction.cpp:382
MineralReaction()
Construct a default MineralReaction instance.
Definition: MineralReaction.cpp:300
Provide a computational representation of a chemical reaction.
Definition: Reaction.hpp:59
auto setEquation(const ReactionEquation &equation) -> MineralReaction &
Set the equation of the mineral reaction.
Definition: MineralReaction.cpp:314
auto surfaceArea() const -> double
Return the specified surface area of the mineral (in units of m2).
Definition: MineralReaction.cpp:387
Define a type that describes the equation of a reaction.
Definition: ReactionEquation.hpp:35
auto setEquilibriumConstant(const ThermoScalarFunction &lnk) -> MineralReaction &
Set the equilibrium constant of the mineral reaction (in natural log scale).
Definition: MineralReaction.cpp:326
Definition: MineralMechanism.hpp:29
auto mechanisms() const -> const std::vector< MineralMechanism > &
Return the mineral mechanisms of the kinetic rate model of the mineral reaction.
Definition: MineralReaction.cpp:392
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto setMineral(std::string mineral) -> MineralReaction &
Set the name of the mineral species in the reaction.
Definition: MineralReaction.cpp:308
auto setSurfaceArea(double value, std::string unit) -> MineralReaction &
Set the surface area of the mineral.
Definition: MineralReaction.cpp:338
auto addMechanism(std::string mechanism) -> MineralReaction &
Adds a mineral mechanism to the kinetic rate model of the mineral reaction.
Definition: MineralReaction.cpp:344
auto mineral() const -> std::string
Return the name of the mineral species in the reaction.
Definition: MineralReaction.cpp:362