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-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 // 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);
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
auto operator=(KineticSolver other) -> KineticSolver &
Assign a KineticSolver instance to this instance.
Definition: KineticSolver.cpp:489
A struct to describe the options for a chemical kinetics calculation.
Definition: KineticOptions.hpp:35
auto addPhaseSink(std::string phase, double volumerate, std::string units) -> void
Add a phase sink to the chemical kinetics problem.
Definition: KineticSolver.cpp:510
auto initialize(ChemicalState &state, double tstart) -> void
Initialize the chemical kinetics solver before .
Definition: KineticSolver.cpp:525
KineticSolver()
Construct a default KineticSolver instance.
Definition: KineticSolver.cpp:474
auto setPartition(const Partition &partition) -> void
Set the partition of the chemical system.
Definition: KineticSolver.cpp:500
auto step(ChemicalState &state, double t) -> double
Integrate one step of the chemical kinetics problem.
Definition: KineticSolver.cpp:530
auto setOptions(const KineticOptions &options) -> void
Set the options for the chemical kinetics calculation.
Definition: KineticSolver.cpp:495
auto addFluidSink(double volumerate, std::string units) -> void
Add a fluid sink to the chemical kinetics problem.
Definition: KineticSolver.cpp:515
A class that represents a system of chemical reactions.
Definition: ReactionSystem.hpp:41
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:540
A class that represents a solver for chemical kinetics problems.
Definition: KineticSolver.hpp:35
auto addSolidSink(double volumerate, std::string units) -> void
Add a solid sink to the chemical kinetics problem.
Definition: KineticSolver.cpp:520
Provide a computational representation of the Partition of a chemical system.
Definition: Partition.hpp:55
auto addSource(const ChemicalState &state, double volumerate, std::string units) -> void
Add a source to the chemical kinetics problem.
Definition: KineticSolver.cpp:505
virtual ~KineticSolver()
Destroy the KineticSolver instance.
Definition: KineticSolver.cpp:486
Definition: Units.cpp:38
Provides a computational representation of the state of a multiphase chemical system.
Definition: ChemicalState.hpp:60
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24