Reaktoro
A unified framework for modeling chemically reactive systems
ChemicalSolver.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 //
21 //#include <memory>
22 //#include <string>
23 //
25 //#include <Reaktoro/Common/Index.hpp>
26 //#include <Reaktoro/Math/Matrix.hpp>
27 //
28 //namespace Reaktoro {
29 //
31 //class ChemicalField;
32 //class ChemicalSystem;
33 //class ChemicalState;
34 //class Partition;
35 //class ReactionSystem;
36 //
38 //class ChemicalSolver
39 //{
40 //public:
41 // // Forward declaration of the Array type.
42 // template<typename T>
43 // class Array;
44 //
45 // // Forward declaration of the Grid type.
46 // template<typename T>
47 // class Grid;
48 //
49 // /// Construct a default ChemicalSolver instance.
50 // ChemicalSolver();
51 //
52 // /// Construct a ChemicalSolver instance with given chemical system and field number of points.
53 // ChemicalSolver(const ChemicalSystem& system, Index npoints);
54 //
55 // /// Construct a ChemicalSolver instance with given reaction system and field number of points.
56 // ChemicalSolver(const ReactionSystem& reactions, Index npoints);
57 //
58 // /// Return the number of field points.
59 // auto numPoints() const -> Index;
60 //
61 // /// Return the number of equilibrium elements.
62 // auto numEquilibriumElements() const -> Index;
63 //
64 // /// Return the number of kinetic species.
65 // auto numKineticSpecies() const -> Index;
66 //
67 // /// Return the number of chemical components.
68 // auto numComponents() const -> Index;
69 //
70 // /// Set the partitioning of the chemical system.
71 // auto setPartition(const Partition& partition) -> void;
72 //
73 // /// Set the chemical state of all field points uniformly.
74 // /// @param state The state of the chemical system.
75 // auto setStates(const ChemicalState& state) -> void;
76 //
77 // /// Set the chemical state of all field points.
78 // /// @param states The array of states of the chemical system.
79 // auto setStates(const Array<ChemicalState>& states) -> void;
80 //
81 // /// Set the chemical state at a specified field point.
82 // /// @param ipoint The index of the field point.
83 // /// @param state The state of the chemical system.
84 // auto setStateAt(Index ipoint, const ChemicalState& state) -> void;
85 //
86 // /// Set the same chemical state at all specified field points.
87 // /// @param ipoints The indices of the field points.
88 // /// @param state The state of the chemical system.
89 // auto setStateAt(const Array<Index>& ipoints, const ChemicalState& state) -> void;
90 //
91 // /// Set the chemical state at all specified field points.
92 // /// @param ipoints The indices of the field points.
93 // /// @param states The states of the chemical system.
94 // auto setStateAt(const Array<Index>& ipoints, const Array<ChemicalState>& states) -> void;
95 //
96 // /// Equilibrate the chemical state at every field point.
97 // auto equilibrate(Array<double> T, Array<double> P, Array<double> be) -> void;
98 //
99 // /// Equilibrate the chemical state at every field point.
100 // auto equilibrate(Array<double> T, Array<double> P, Grid<double> be) -> void;
101 //
102 // /// React the chemical state at every field point.
103 // auto react(double t, double dt) -> void;
104 //
105 // /// Return the chemical state at given index.
106 // auto state(Index i) const -> const ChemicalState&;
107 //
108 // /// Return the chemical states at all field points.
109 // auto states() const -> const std::vector<ChemicalState>&;
110 //
111 // /// Return the molar amounts of the chemical components at every field point (in units of mol).
112 // auto componentAmounts() -> const std::vector<Vector>&;
113 //
114 // /// Return the molar amounts of each equilibrium species and their derivatives at every field point.
115 // auto equilibriumSpeciesAmounts() -> const std::vector<ChemicalField>&;
116 //
117 // /// Return the porosity at every field point.
118 // auto porosity() -> const ChemicalField&;
119 //
120 // /// Return the saturations of the fluid phases at every field point.
121 // auto fluidSaturations() -> const std::vector<ChemicalField>&;
122 //
123 // /// Return the densities of the fluid phases at every field point (in units of kg/m3).
124 // auto fluidDensities() -> const std::vector<ChemicalField>&;
125 //
126 // /// Return the volumes of the fluid phases at every field point (in units of m3).
127 // auto fluidVolumes() -> const std::vector<ChemicalField>&;
128 //
129 // /// Return the total volume of the fluid phases at every field point (in units of m3).
130 // auto fluidTotalVolume() -> const ChemicalField&;
131 //
132 // /// Return the total volume of the solid phases at every field point (in units of m3).
133 // auto solidTotalVolume() -> const ChemicalField&;
134 //
135 // /// Return the kinetic rates of the chemical components at every field point (in units of mol/s).
136 // auto componentRates() -> const std::vector<ChemicalField>&;
137 //
138 //private:
139 // struct Impl;
140 //
141 // std::shared_ptr<Impl> pimpl;
142 //
143 //public:
144 // /// A type that represents a one-dimensional array of values.
145 // template<typename T>
146 // class Array
147 // {
148 // public:
149 // /// Construct a default Array instance.
150 // Array()
151 // {}
152 //
153 // /// Construct a custom Array instance.
154 // Array(const T* data, Index size)
155 // : data(data), size(size) {}
156 //
157 // /// Construct an Array instance from a vector-like instance.
158 // /// The type of the vector must have public methods `data` and `size`.
159 // template<typename VectorType>
160 // Array(const VectorType& vec)
161 // : data(vec.data()), size(vec.size()) {}
162 //
163 // friend class ChemicalSolver;
164 //
165 // private:
166 // /// The pointer to a one-dimensional array of values.
167 // const T* data = nullptr;
168 //
169 // /// The size of the array.
170 // Index size = 0;
171 // };
172 //
173 // /// A type that represents a two-dimensional array of values.
174 // template<typename T>
175 // class Grid
176 // {
177 // public:
178 // /// Construct a default Grid instance.
179 // Grid()
180 // {}
181 //
182 // /// Construct a custom Grid instance.
183 // Grid(const T** data, Index rows, Index cols)
184 // : data(data), rows(rows), cols(cols) {}
185 //
186 // /// Construct an Grid instance from a vector-like instance.
187 // /// The type of the vector must have public methods `data` and `size`.
188 // template<typename VectorType>
189 // Grid(const std::vector<VectorType>& vec)
190 // {
191 // pointers.reserve(vec.size());
192 // for(const VectorType& v : vec)
193 // pointers.push_back(v.data());
194 // rows = vec.size();
195 // cols = vec.front().size();
196 // }
197 //
198 // friend class ChemicalSolver;
199 //
200 // private:
201 // /// The pointer to a two-dimensional array of values.
202 // const T** data = nullptr;
203 //
204 // /// The pointer to a two-dimensional array of values.
205 // std::vector<const T*> pointers;
206 //
207 // /// The number of rows of the grid.
208 // Index rows = 0;
209 //
210 // /// The number of columns of the grid.
211 // Index cols = 0;
212 // };
213 //};
214 //
215 //} // namespace Reaktoro
216 //