Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
AqueousMixture.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/Matrix.hpp>
22 #include <Reaktoro/Common/Types.hpp>
23 #include <Reaktoro/Core/SpeciesList.hpp>
24 
25 namespace Reaktoro {
26 
30 {
33 
36 
39 
42 
45 
48 
51 
54 };
55 
66 {
67 public:
70 
73 
75  auto clone() const -> AqueousMixture;
76 
79 
82 
84  auto species(Index idx) const -> Species const&;
85 
87  auto species() const -> SpeciesList const&;
88 
90  auto neutral() const -> SpeciesList const&;
91 
93  auto charged() const -> SpeciesList const&;
94 
96  auto cations() const -> SpeciesList const&;
97 
99  auto anions() const -> SpeciesList const&;
100 
102  auto water() const -> Species const&;
103 
105  auto indicesNeutral() const -> Indices const&;
106 
108  auto indicesCharged() const -> Indices const&;
109 
111  auto indicesCations() const -> Indices const&;
112 
114  auto indicesAnions() const -> Indices const&;
115 
117  auto indexWater() const -> Index;
118 
120  auto charges() const -> ArrayXdConstRef;
121 
129 
135 
136 private:
137  struct Impl;
138 
139  SharedPtr<Impl> pimpl;
140 };
141 
142 } // namespace Reaktoro
A type used to describe an aqueous mixture.
Definition: AqueousMixture.hpp:66
auto state(real T, real P, ArrayXrConstRef x) const -> AqueousMixtureState
Calculate the state of the aqueous mixture.
auto indicesCations() const -> Indices const &
Return the indices of the cations in the mixture.
AqueousMixture()
Construct a default AqueousMixture instance.
auto cations() const -> SpeciesList const &
Return the cation solutes in the mixture.
auto water() const -> Species const &
Return the aqueous solvent species in the mixture.
auto indicesCharged() const -> Indices const &
Return the indices of the charged aqueous solutes in the mixture.
auto indicesNeutral() const -> Indices const &
Return the indices of the neutral aqueous solutes in the mixture.
auto clone() const -> AqueousMixture
Return a deep copy of this AqueousMixture object.
auto dissociationMatrix() const -> MatrixXdConstRef
Return the dissociation matrix of the neutral species into charged species.
AqueousMixture(SpeciesList const &species)
Construct an AqueousMixture instance with given species.
auto withWaterDielectricConstantFn(Fn< real(real, real)> epsilon) const -> AqueousMixture
Return a copy of this AqueousMixture object with replaced function for water dielectric constant calc...
auto withWaterDensityFn(Fn< real(real, real)> rho) const -> AqueousMixture
Return a copy of this AqueousMixture object with replaced function for water density calculation.
auto indicesAnions() const -> Indices const &
Return the indices of the anions in the mixture.
auto species() const -> SpeciesList const &
Return the aqueous species in the mixture.
auto anions() const -> SpeciesList const &
Return the anion solutes in the mixture.
auto charges() const -> ArrayXdConstRef
Return the electric charges of the aqueous species in the mixture.
auto charged() const -> SpeciesList const &
Return the charged aqueous solutes in the mixture.
auto neutral() const -> SpeciesList const &
Return the neutral aqueous solutes in the mixture.
auto indexWater() const -> Index
Return the index of the solvent species in the mixture.
A type used as a collection of species.
Definition: SpeciesList.hpp:29
A type used to represent a chemical species and its attributes.
Definition: Species.hpp:35
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
autodiff::real real
The number type used throughout the library.
Definition: Real.hpp:26
constexpr auto epsilon
The value of machine precision epsilon.
Definition: Constants.hpp:68
Eigen::Ref< const ArrayXd > ArrayXdConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:105
std::function< F > Fn
Convenient alias for std::function<R(Args...)>.
Definition: Types.hpp:110
std::vector< Index > Indices
Define a type that represents a collection of indices.
Definition: Index.hpp:29
Eigen::Ref< const MatrixXd > MatrixXdConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:139
std::shared_ptr< T > SharedPtr
Convenient alias for std::shared_ptr<T>.
Definition: Types.hpp:106
Eigen::Ref< const ArrayXr > ArrayXrConstRef
Convenient alias to Eigen type.
Definition: Matrix.hpp:89
autodiff::ArrayXreal ArrayXr
Convenient alias to Eigen type.
Definition: Matrix.hpp:87
A type used to describe the state of an aqueous mixture.
Definition: AqueousMixture.hpp:30
real rho
The density of water (in kg/m3)
Definition: AqueousMixture.hpp:38
ArrayXr m
The molalities of the aqueous species (in mol/kg)
Definition: AqueousMixture.hpp:50
real epsilon
The relative dielectric constant of water (no units)
Definition: AqueousMixture.hpp:41
ArrayXr ms
The stoichiometric molalities of the ionic species (in mol/kg)
Definition: AqueousMixture.hpp:53
real P
The pressure of the mixture (in Pa).
Definition: AqueousMixture.hpp:35
real Is
The stoichiometric ionic strength of the aqueous mixture (in mol/kg)
Definition: AqueousMixture.hpp:47
real Ie
The effective ionic strength of the aqueous mixture (in mol/kg)
Definition: AqueousMixture.hpp:44
real T
The temperature of the mixture (in K).
Definition: AqueousMixture.hpp:32