Reaktoro
A unified framework for modeling chemically reactive systems
EquilibriumPath.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 #include <vector>
24 
25 // Reaktoro includes
26 #include <Reaktoro/Equilibrium/EquilibriumOptions.hpp>
27 #include <Reaktoro/Equilibrium/EquilibriumResult.hpp>
28 #include <Reaktoro/Math/ODE.hpp>
29 
30 namespace Reaktoro {
31 
32 // Forward declarations
33 class ChemicalOutput;
34 class ChemicalPlot;
35 class ChemicalSystem;
36 class ChemicalState;
37 class Partition;
38 
41 {
44 
47 
49  double maxstep = 0.1;
50 };
51 
54 {
57 };
58 
61 {
62 public:
64  explicit EquilibriumPath(const ChemicalSystem& system);
65 
67  EquilibriumPath(const EquilibriumPath& other);
68 
70  virtual ~EquilibriumPath();
71 
74 
76  auto setOptions(const EquilibriumPathOptions& options) -> void;
77 
79  auto setPartition(const Partition& partition) -> void;
80 
82  auto solve(const ChemicalState& state_i, const ChemicalState& state_f) -> EquilibriumPathResult;
83 
89  auto output() -> ChemicalOutput;
90 
96  auto plot() -> ChemicalPlot;
97 
103  auto plots(unsigned num) -> std::vector<ChemicalPlot>;
104 
106  auto system() const -> const ChemicalSystem&;
107 
109  auto partition() const -> const Partition&;
110 
111 private:
112  struct Impl;
113 
114  std::unique_ptr<Impl> pimpl;
115 };
116 
117 } // namespace Reaktoro
double maxstep
The maximum step length during the equilibrium path calculation.
Definition: EquilibriumPath.hpp:49
auto plot() -> ChemicalPlot
Return a ChemicalPlot instance.
Definition: EquilibriumPath.cpp:234
The options for the equilibrium calculations.
Definition: EquilibriumOptions.hpp:55
auto output() -> ChemicalOutput
Return a ChemicalPlot instance.
Definition: EquilibriumPath.cpp:228
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:38
Provides a computational representation of the state of a multiphase chemical system.
Definition: ChemicalState.hpp:61
virtual ~EquilibriumPath()
Destroy an EquilibriumPath instance.
Definition: EquilibriumPath.cpp:204
A struct that defines the options for the ODESolver.
Definition: ODE.hpp:44
EquilibriumOptions equilibrium
The options for the chemical equilibrium calculations.
Definition: EquilibriumPath.hpp:43
auto system() const -> const ChemicalSystem &
Return the chemical system in the equilibrium path definition.
Definition: EquilibriumPath.cpp:246
A class that describes a path of equilibrium states.
Definition: EquilibriumPath.hpp:61
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
A type used to output sequence of chemical states to a file or terminal.
Definition: ChemicalOutput.hpp:36
auto partition() const -> const Partition &
Return the partition of the chemical system in the equilibrium path definition.
Definition: EquilibriumPath.cpp:251
auto setPartition(const Partition &partition) -> void
Set the partition of the chemical system.
Definition: EquilibriumPath.cpp:218
A struct that describes the options from an equilibrium path calculation.
Definition: EquilibriumPath.hpp:41
EquilibriumResult equilibrium
The accumulated result of the equilibrium calculations.
Definition: EquilibriumPath.hpp:56
EquilibriumPath(const ChemicalSystem &system)
Construct an EquilibriumPath instance.
Definition: EquilibriumPath.cpp:196
auto operator=(EquilibriumPath other) -> EquilibriumPath &
Assign an EquilibriumPath instance to this instance.
Definition: EquilibriumPath.cpp:207
Provide a computational representation of the Partition of a chemical system.
Definition: Partition.hpp:56
auto plots(unsigned num) -> std::vector< ChemicalPlot >
Return a collection of ChemicalPlot instances.
Definition: EquilibriumPath.cpp:240
A class used to create plots from sequence of chemical states.
Definition: ChemicalPlot.hpp:36
auto setOptions(const EquilibriumPathOptions &options) -> void
Set the options for the equilibrium path calculation and visualization.
Definition: EquilibriumPath.cpp:213
A struct that describes the result of an equilibrium path calculation.
Definition: EquilibriumPath.hpp:54
auto solve(const ChemicalState &state_i, const ChemicalState &state_f) -> EquilibriumPathResult
Solve the path of equilibrium states between two chemical states.
Definition: EquilibriumPath.cpp:223
ODEOptions ode
The options for the ODE solver.
Definition: EquilibriumPath.hpp:46
A type used to describe the result of an equilibrium calculation.
Definition: EquilibriumResult.hpp:35