Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
KineticsSolver.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 EquilibriumSpecs;
33 class KineticsSensitivity;
34 struct KineticsOptions;
35 struct KineticsResult;
36 
39 {
40 public:
42  explicit KineticsSolver(ChemicalSystem const& system);
43 
45  explicit KineticsSolver(EquilibriumSpecs const& specs);
46 
49 
52 
55 
56  //=================================================================================================================
57  //
58  // CHEMICAL KINETICS PRECONDITION METHODS
59  //
60  //=================================================================================================================
61 
71 
75  auto precondition(ChemicalState& state, EquilibriumRestrictions const& restrictions) -> KineticsResult;
76 
80  auto precondition(ChemicalState& state, EquilibriumConditions const& conditions) -> KineticsResult;
81 
86  auto precondition(ChemicalState& state, EquilibriumConditions const& conditions, EquilibriumRestrictions const& restrictions) -> KineticsResult;
87 
88  //=================================================================================================================
89  //
90  // CHEMICAL KINETICS SOLVE METHODS
91  //
92  //=================================================================================================================
93 
97  auto solve(ChemicalState& state, real const& dt) -> KineticsResult;
98 
103  auto solve(ChemicalState& state, real const& dt, EquilibriumRestrictions const& restrictions) -> KineticsResult;
104 
109  auto solve(ChemicalState& state, real const& dt, EquilibriumConditions const& conditions) -> KineticsResult;
110 
116  auto solve(ChemicalState& state, real const& dt, EquilibriumConditions const& conditions, EquilibriumRestrictions const& restrictions) -> KineticsResult;
117 
118  //=================================================================================================================
119  //
120  // CHEMICAL KINETICS SOLVE METHODS WITH SENSITIVITY CALCULATION
121  //
122  //=================================================================================================================
123 
128  auto solve(ChemicalState& state, KineticsSensitivity& sensitivity, real const& dt) -> KineticsResult;
129 
135  auto solve(ChemicalState& state, KineticsSensitivity& sensitivity, real const& dt, EquilibriumRestrictions const& restrictions) -> KineticsResult;
136 
142  auto solve(ChemicalState& state, KineticsSensitivity& sensitivity, real const& dt, EquilibriumConditions const& conditions) -> KineticsResult;
143 
150  auto solve(ChemicalState& state, KineticsSensitivity& sensitivity, real const& dt, EquilibriumConditions const& conditions, EquilibriumRestrictions const& restrictions) -> KineticsResult;
151 
152  //=================================================================================================================
153  //
154  // MISCELLANEOUS METHODS
155  //
156  //=================================================================================================================
157 
159  auto setOptions(KineticsOptions const& options) -> void;
160 
161 private:
162  struct Impl;
163 
164  Ptr<Impl> pimpl;
165 };
166 
167 } // 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 class used to define conditions to be satisfied at chemical equilibrium.
Definition: EquilibriumSpecs.hpp:281
The sensitivity derivatives of a chemical equilibrium state.
Definition: KineticsSensitivity.hpp:35
Used for chemical kinetics calculations.
Definition: KineticsSolver.hpp:39
~KineticsSolver()
Destroy this KineticsSolver object.
auto solve(ChemicalState &state, KineticsSensitivity &sensitivity, real const &dt, EquilibriumRestrictions const &restrictions) -> KineticsResult
React a chemical state for a given time interval respecting given reactivity restrictions and compute...
auto solve(ChemicalState &state, real const &dt, EquilibriumConditions const &conditions) -> KineticsResult
React a chemical state for a given time interval respecting given constraint conditions.
auto solve(ChemicalState &state, real const &dt) -> KineticsResult
React a chemical state for a given time interval.
auto solve(ChemicalState &state, real const &dt, EquilibriumConditions const &conditions, EquilibriumRestrictions const &restrictions) -> KineticsResult
React a chemical state for a given time interval respecting given constraint conditions and reactivit...
auto solve(ChemicalState &state, real const &dt, EquilibriumRestrictions const &restrictions) -> KineticsResult
React a chemical state for a given time interval respecting given reactivity restrictions.
auto precondition(ChemicalState &state, EquilibriumRestrictions const &restrictions) -> KineticsResult
React a chemical state for zero seconds to precondition it respecting given reactivity restrictions.
auto precondition(ChemicalState &state, EquilibriumConditions const &conditions, EquilibriumRestrictions const &restrictions) -> KineticsResult
React a chemical state for zero seconds to precondition it respecting given constraint conditions and...
KineticsSolver(EquilibriumSpecs const &specs)
Construct an KineticsSolver object with given chemical equilibrium specifications to be attained duri...
auto operator=(KineticsSolver other) -> KineticsSolver &
Assign a copy of an KineticsSolver object to this.
auto solve(ChemicalState &state, KineticsSensitivity &sensitivity, real const &dt, EquilibriumConditions const &conditions, EquilibriumRestrictions const &restrictions) -> KineticsResult
React a chemical state for a given time interval respecting given constraint conditions and reactivit...
auto solve(ChemicalState &state, KineticsSensitivity &sensitivity, real const &dt) -> KineticsResult
React a chemical state for a given time interval and compute sensitivity derivatives.
auto solve(ChemicalState &state, KineticsSensitivity &sensitivity, real const &dt, EquilibriumConditions const &conditions) -> KineticsResult
React a chemical state for a given time interval respecting given constraint conditions and compute s...
auto setOptions(KineticsOptions const &options) -> void
Set the options of the kinetics solver.
KineticsSolver(ChemicalSystem const &system)
Construct an KineticsSolver object with given chemical system.
auto precondition(ChemicalState &state, EquilibriumConditions const &conditions) -> KineticsResult
React a chemical state for zero seconds to precondition it respecting given constraint conditions.
auto precondition(ChemicalState &state) -> KineticsResult
React a chemical state for zero seconds to precondition it.
KineticsSolver(KineticsSolver const &other)
Construct a copy of an KineticsSolver object.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
autodiff::real real
The number type used throughout the library.
Definition: Real.hpp:26
std::unique_ptr< T > Ptr
Convenient alias for std::unique_ptr<T>.
Definition: Types.hpp:102
The options for chemical kinetics calculation.
Definition: KineticsOptions.hpp:27
Used to describe the result of a chemical kinetics calculation.
Definition: KineticsResult.hpp:27