Reaktoro
A unified framework for modeling chemically reactive systems
KineticSolver.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 
20 // C++ includes
21 #include <memory>
22 #include <string>
23 
24 namespace Reaktoro {
25 
26 // Forward declarations
27 class ChemicalState;
28 class ChemicalState;
29 class Partition;
30 class ReactionSystem;
31 struct KineticOptions;
32 
36 {
37 public:
39  KineticSolver();
40 
42  explicit KineticSolver(const ReactionSystem& reactions);
43 
45  KineticSolver(const KineticSolver& other) = delete;
46 
48  virtual ~KineticSolver();
49 
51  auto operator=(KineticSolver other) -> KineticSolver&;
52 
54  auto setOptions(const KineticOptions& options) -> void;
55 
58  auto setPartition(const Partition& partition) -> void;
59 
64  auto addSource(const ChemicalState& state, double volumerate, std::string units) -> void;
65 
72  auto addPhaseSink(std::string phase, double volumerate, std::string units) -> void;
73 
79  auto addFluidSink(double volumerate, std::string units) -> void;
80 
86  auto addSolidSink(double volumerate, std::string units) -> void;
87 
92  auto initialize(ChemicalState& state, double tstart) -> void;
93 
98  auto step(ChemicalState& state, double t) -> double;
99 
105  auto step(ChemicalState& state, double t, double tfinal) -> double;
106 
111  auto solve(ChemicalState& state, double t, double dt) -> void;
112 
113 private:
114  struct Impl;
115 
116  std::unique_ptr<Impl> pimpl;
117 };
118 
119 } // namespace Reaktoro
KineticSolver()
Construct a default KineticSolver instance.
Definition: KineticSolver.cpp:471
A class that represents a solver for chemical kinetics problems.
Definition: KineticSolver.hpp:36
auto step(ChemicalState &state, double t) -> double
Integrate one step of the chemical kinetics problem.
Definition: KineticSolver.cpp:523
A struct to describe the options for a chemical kinetics calculation.
Definition: KineticOptions.hpp:36
auto setPartition(const Partition &partition) -> void
Set the partition of the chemical system.
Definition: KineticSolver.cpp:493
auto addFluidSink(double volumerate, std::string units) -> void
Add a fluid sink to the chemical kinetics problem.
Definition: KineticSolver.cpp:508
Provides a computational representation of the state of a multiphase chemical system.
Definition: ChemicalState.hpp:61
auto addPhaseSink(std::string phase, double volumerate, std::string units) -> void
Add a phase sink to the chemical kinetics problem.
Definition: KineticSolver.cpp:503
auto setOptions(const KineticOptions &options) -> void
Set the options for the chemical kinetics calculation.
Definition: KineticSolver.cpp:488
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
KineticSolver(const KineticSolver &other)=delete
Construct a copy of a KineticSolver instance.
A class that represents a system of chemical reactions.
Definition: ReactionSystem.hpp:42
Provide a computational representation of the Partition of a chemical system.
Definition: Partition.hpp:56
auto solve(ChemicalState &state, double t, double dt) -> void
Solve the chemical kinetics problem from a given initial time to a final time.
Definition: KineticSolver.cpp:533
auto addSolidSink(double volumerate, std::string units) -> void
Add a solid sink to the chemical kinetics problem.
Definition: KineticSolver.cpp:513
auto operator=(KineticSolver other) -> KineticSolver &
Assign a KineticSolver instance to this instance.
Definition: KineticSolver.cpp:482
auto initialize(ChemicalState &state, double tstart) -> void
Initialize the chemical kinetics solver before .
Definition: KineticSolver.cpp:518
auto addSource(const ChemicalState &state, double volumerate, std::string units) -> void
Add a source to the chemical kinetics problem.
Definition: KineticSolver.cpp:498
virtual ~KineticSolver()
Destroy the KineticSolver instance.
Definition: KineticSolver.cpp:479