Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
EquilibriumProps.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive phases.
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/Matrix.hpp>
22 #include <Reaktoro/Common/Types.hpp>
23 
24 namespace Reaktoro {
25 
26 // Forward declarations
27 class ChemicalProps;
28 class ChemicalState;
29 class EquilibriumSpecs;
30 
35 {
36 public:
38  explicit EquilibriumProps(const EquilibriumSpecs& specs);
39 
42 
45 
48 
54  auto update(VectorXrConstRef n, VectorXrConstRef p, VectorXrConstRef w, bool useIdealModel = false) -> void;
55 
70  auto update(VectorXrConstRef n, VectorXrConstRef p, VectorXrConstRef w, bool useIdealModel, long inpw) -> void;
71 
83  auto assembleFullJacobianBegin() -> void;
84 
88  auto assembleFullJacobianEnd() -> void;
89 
91  auto chemicalState() const -> const ChemicalState&;
92 
94  auto chemicalProps() const -> const ChemicalProps&;
95 
98  auto dudn() const -> MatrixXdConstRef;
99 
102  auto dudp() const -> MatrixXdConstRef;
103 
106  auto dudw() const -> MatrixXdConstRef;
107 
108 private:
109  struct Impl;
110 
111  Ptr<Impl> pimpl;
112 };
113 
114 } // namespace Reaktoro
The class that computes chemical properties of a chemical system.
Definition: ChemicalProps.hpp:34
The chemical state of a chemical system.
Definition: ChemicalState.hpp:41
The class that computes chemical properties of a system during equilibrium calculations.
Definition: EquilibriumProps.hpp:35
auto operator=(EquilibriumProps other) -> EquilibriumProps &
Assign a EquilibriumProps object to this.
auto chemicalState() const -> const ChemicalState &
Return the underlying chemical state of the system and its updated properties.
auto chemicalProps() const -> const ChemicalProps &
Return the underlying chemical properties of the system.
EquilibriumProps(const EquilibriumSpecs &specs)
Construct a EquilibriumProps object with given equilibrium specifications.
auto assembleFullJacobianBegin() -> void
Enable recording of derivatives of the chemical properties with respect to *(n, p,...
auto dudn() const -> MatrixXdConstRef
Return the partial derivatives of the serialized chemical properties u with respect to species amount...
auto dudp() const -> MatrixXdConstRef
Return the partial derivatives of the serialized chemical properties u with respect to control variab...
auto dudw() const -> MatrixXdConstRef
Return the partial derivatives of the serialized chemical properties u with respect to input variable...
auto assembleFullJacobianEnd() -> void
Disable recording of derivatives of the chemical properties with respect to *(n, p,...
auto update(VectorXrConstRef n, VectorXrConstRef p, VectorXrConstRef w, bool useIdealModel, long inpw) -> void
Update the chemical properties of the chemical system.
EquilibriumProps(const EquilibriumProps &other)
Construct a copy of a EquilibriumProps object.
auto update(VectorXrConstRef n, VectorXrConstRef p, VectorXrConstRef w, bool useIdealModel=false) -> void
Update the chemical properties of the chemical system.
~EquilibriumProps()
Destroy this EquilibriumProps object.
The class used to define conditions to be satisfied at chemical equilibrium.
Definition: EquilibriumSpecs.hpp:281
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
Eigen::Ref< const VectorXr > VectorXrConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:60
std::unique_ptr< T > Ptr
Convenient alias for std::unique_ptr<T>.
Definition: Types.hpp:102
Eigen::Ref< const MatrixXd > MatrixXdConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:139