Reaktoro 
A unified framework for modeling chemically reactive systems
ChemicalField.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 // Reaktoro includes
21 #include <Reaktoro/Common/ChemicalScalar.hpp>
22 #include <Reaktoro/Math/Matrix.hpp>
23 #include <Reaktoro/Core/Partition.hpp>
24 
25 namespace Reaktoro {
26 
27 // Forward declarations
28 struct EquilibriumSensitivity;
29 
32 {
33 public:
35  ChemicalField();
36 
40  ChemicalField(const Partition& partition, Index npoints);
41 
43  ChemicalField(const ChemicalField& other);
44 
46  virtual ~ChemicalField();
47 
49  auto operator=(ChemicalField other) -> ChemicalField&;
50 
55  auto set(Index i, const ChemicalScalar& scalar, const EquilibriumSensitivity& sensitivity) -> void;
56 
58  auto partition() const -> const Partition&;
59 
61  auto size() const -> Index;
62 
64  auto val() -> Vector&;
65 
67  auto val() const -> const Vector&;
68 
70  auto ddT() -> Vector&;
71 
73  auto ddT() const -> const Vector&;
74 
76  auto ddP() -> Vector&;
77 
79  auto ddP() const -> const Vector&;
80 
82  auto ddbe() -> std::vector<Vector>&;
83 
85  auto ddbe() const -> const std::vector<Vector>&;
86 
88  auto ddnk() -> std::vector<Vector>&;
89 
91  auto ddnk() const -> const std::vector<Vector>&;
92 
93 private:
94  struct Impl;
95 
96  std::unique_ptr<Impl> pimpl;
97 };
98 
100 auto operator<<(std::ostream& out, const ChemicalField& f) -> std::ostream&;
101 
102 } // namespace Reaktoro
103 
auto operator=(ChemicalField other) -> ChemicalField &
Construct a copy of a ChemicalField instance.
Definition: ChemicalField.cpp:123
auto ddP() -> Vector &
Return a reference to the derivatives w.r.t. pressure of the chemical field.
Definition: ChemicalField.cpp:164
A type that contains the values of a scalar field and its derivatives.
Definition: ChemicalField.hpp:31
auto ddbe() -> std::vector< Vector > &
Return a reference to the derivatives w.r.t. molar amounts of equilibrium elements of the chemical fi...
Definition: ChemicalField.cpp:174
A type that contains the sensitivity data of the equilibrium state.
Definition: EquilibriumSensitivity.hpp:31
ChemicalField()
Construct a default ChemicalField instance.
Definition: ChemicalField.cpp:108
Eigen::VectorXd Vector
Define an alias to the vector type of the Eigen library.
Definition: Matrix.hpp:384
auto ddnk() -> std::vector< Vector > &
Return a reference to the derivatives w.r.t. molar amounts of kinetic species of the chemical field...
Definition: ChemicalField.cpp:184
virtual ~ChemicalField()
Destroy this instance.
Definition: ChemicalField.cpp:120
auto partition() const -> const Partition &
Return the partition of the chemical system.
Definition: ChemicalField.cpp:134
Provide a computational representation of the Partition of a chemical system.
Definition: Partition.hpp:55
auto ddT() -> Vector &
Return a reference to the derivatives w.r.t. temperature of the chemical field.
Definition: ChemicalField.cpp:154
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
auto size() const -> Index
Return the size of the chemical field.
Definition: ChemicalField.cpp:139
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto val() -> Vector &
Return a reference to the values of the chemical field.
Definition: ChemicalField.cpp:144