Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
EquilibriumSolver.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/Common/Matrix.hpp>
23 
24 namespace Reaktoro {
25 
26 // Forward declarations
27 class ChemicalProps;
28 class ChemicalState;
29 class ChemicalSystem;
30 class EquilibriumConditions;
31 class EquilibriumRestrictions;
32 class EquilibriumSensitivity;
33 class EquilibriumSpecs;
34 struct EquilibriumOptions;
35 struct EquilibriumResult;
36 
39 {
40 public:
42  explicit EquilibriumSolver(ChemicalSystem const& system);
43 
45  explicit EquilibriumSolver(EquilibriumSpecs const& specs);
46 
49 
52 
55 
56  //=================================================================================================================
57  //
58  // CHEMICAL EQUILIBRIUM METHODS
59  //
60  //=================================================================================================================
61 
65 
69  auto solve(ChemicalState& state, EquilibriumRestrictions const& restrictions) -> EquilibriumResult;
70 
74  auto solve(ChemicalState& state, EquilibriumConditions const& conditions) -> EquilibriumResult;
75 
80  auto solve(ChemicalState& state, EquilibriumConditions const& conditions, EquilibriumRestrictions const& restrictions) -> EquilibriumResult;
81 
82  //=================================================================================================================
83  //
84  // CHEMICAL EQUILIBRIUM METHODS WITH SENSITIVITY CALCULATION
85  //
86  //=================================================================================================================
87 
92 
97  auto solve(ChemicalState& state, EquilibriumSensitivity& sensitivity, EquilibriumRestrictions const& restrictions) -> EquilibriumResult;
98 
103  auto solve(ChemicalState& state, EquilibriumSensitivity& sensitivity, EquilibriumConditions const& conditions) -> EquilibriumResult;
104 
110  auto solve(ChemicalState& state, EquilibriumSensitivity& sensitivity, EquilibriumConditions const& conditions, EquilibriumRestrictions const& restrictions) -> EquilibriumResult;
111 
112  //=================================================================================================================
113  //
114  // MISCELLANEOUS METHODS
115  //
116  //=================================================================================================================
117 
119  auto setOptions(EquilibriumOptions const& options) -> void;
120 
121 private:
122  struct Impl;
123 
124  Ptr<Impl> pimpl;
125 };
126 
127 } // namespace Reaktoro
The chemical state of a chemical system.
Definition: ChemicalState.hpp:41
The class used to represent a chemical system and its attributes and properties.
Definition: ChemicalSystem.hpp:70
The class used to define conditions to be satisfied at chemical equilibrium.
Definition: EquilibriumConditions.hpp:32
The class used to define reactivity restrictions in a chemical equilibrium calculation.
Definition: EquilibriumRestrictions.hpp:28
The sensitivity derivatives of a chemical equilibrium state.
Definition: EquilibriumSensitivity.hpp:37
Used for calculating chemical equilibrium states.
Definition: EquilibriumSolver.hpp:39
~EquilibriumSolver()
Destroy this EquilibriumSolver object.
auto setOptions(EquilibriumOptions const &options) -> void
Set the options of the equilibrium solver.
auto solve(ChemicalState &state, EquilibriumSensitivity &sensitivity, EquilibriumConditions const &conditions, EquilibriumRestrictions const &restrictions) -> EquilibriumResult
Equilibrate a chemical state respecting given constraint conditions and reactivity restrictions and c...
auto solve(ChemicalState &state, EquilibriumSensitivity &sensitivity, EquilibriumRestrictions const &restrictions) -> EquilibriumResult
Equilibrate a chemical state respecting given reactivity restrictions and compute sensitivity derivat...
auto solve(ChemicalState &state, EquilibriumConditions const &conditions, EquilibriumRestrictions const &restrictions) -> EquilibriumResult
Equilibrate a chemical state respecting given constraint conditions and reactivity restrictions.
auto solve(ChemicalState &state, EquilibriumSensitivity &sensitivity) -> EquilibriumResult
Equilibrate a chemical state and compute sensitivity derivatives.
auto solve(ChemicalState &state, EquilibriumConditions const &conditions) -> EquilibriumResult
Equilibrate a chemical state respecting given constraint conditions.
auto solve(ChemicalState &state, EquilibriumSensitivity &sensitivity, EquilibriumConditions const &conditions) -> EquilibriumResult
Equilibrate a chemical state respecting given constraint conditions and compute sensitivity derivativ...
EquilibriumSolver(ChemicalSystem const &system)
Construct an EquilibriumSolver object with given chemical system.
auto solve(ChemicalState &state) -> EquilibriumResult
Equilibrate a chemical state.
EquilibriumSolver(EquilibriumSolver const &other)
Construct a copy of an EquilibriumSolver object.
auto solve(ChemicalState &state, EquilibriumRestrictions const &restrictions) -> EquilibriumResult
Equilibrate a chemical state respecting given reactivity restrictions.
EquilibriumSolver(EquilibriumSpecs const &specs)
Construct an EquilibriumSolver object with given chemical equilibrium specifications.
auto operator=(EquilibriumSolver other) -> EquilibriumSolver &
Assign a copy of an EquilibriumSolver object to this.
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
std::unique_ptr< T > Ptr
Convenient alias for std::unique_ptr<T>.
Definition: Types.hpp:102
The options for the equilibrium calculations.
Definition: EquilibriumOptions.hpp:43
A type used to describe the result of an equilibrium calculation.
Definition: EquilibriumResult.hpp:28