OGS
ChemicalSystem.cpp
Go to the documentation of this file.
1
11#include "ChemicalSystem.h"
12
13#include "AqueousSolution.h"
16
17namespace ChemistryLib
18{
19namespace PhreeqcIOData
20{
21void ChemicalSystem::initialize(std::size_t const num_chemical_systems)
22{
25 num_chemical_systems);
26
27 aqueous_solution->pe->resize(num_chemical_systems, aqueous_solution->pe0);
28
29 auto& components = aqueous_solution->components;
30 for (auto& component : components)
31 {
32 component.amount =
34 num_chemical_systems);
35 }
36
37 for (auto& kinetic_reactant : kinetic_reactants)
38 {
39 kinetic_reactant.molality->resize(num_chemical_systems);
40 kinetic_reactant.molality_prev->resize(num_chemical_systems);
41 kinetic_reactant.volume_fraction->resize(num_chemical_systems);
42 kinetic_reactant.volume_fraction_prev->resize(num_chemical_systems);
43 }
44
45 for (auto& equilibrium_reactant : equilibrium_reactants)
46 {
47 equilibrium_reactant.molality->resize(num_chemical_systems);
48 equilibrium_reactant.molality_prev->resize(num_chemical_systems);
49 equilibrium_reactant.volume_fraction->resize(num_chemical_systems);
50 equilibrium_reactant.volume_fraction_prev->resize(num_chemical_systems);
51 }
52
53 for (auto& exchanger : exchangers)
54 {
55 exchanger.molality->resize(num_chemical_systems);
56 }
57
58 for (auto& surface_site : surface)
59 {
60 if (auto const surface_site_ptr =
61 std::get_if<MoleBasedSurfaceSite>(&surface_site))
62 {
63 surface_site_ptr->molality->resize(num_chemical_systems);
64 }
65 }
66}
67} // namespace PhreeqcIOData
68} // namespace ChemistryLib
std::unique_ptr< AqueousSolution > aqueous_solution
std::vector< KineticReactant > kinetic_reactants
std::vector< EquilibriumReactant > equilibrium_reactants
std::vector< std::variant< DensityBasedSurfaceSite, MoleBasedSurfaceSite > > surface
void initialize(std::size_t const num_chemical_systems)