From 2f22c9cdaadfccdd72a787d8691091e81343a994 Mon Sep 17 00:00:00 2001 From: renchao_lu <renchao.lu@gmail.com> Date: Mon, 12 Apr 2021 18:53:24 +0200 Subject: [PATCH] [CL] Add members into EquilibriumReactant. --- ChemistryLib/PhreeqcIOData/ChemicalSystem.cpp | 2 ++ .../PhreeqcIOData/CreateEquilibriumReactants.cpp | 11 +++++++++++ ChemistryLib/PhreeqcIOData/EquilibriumReactant.h | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/ChemistryLib/PhreeqcIOData/ChemicalSystem.cpp b/ChemistryLib/PhreeqcIOData/ChemicalSystem.cpp index 61811f0148e..67367d585a9 100644 --- a/ChemistryLib/PhreeqcIOData/ChemicalSystem.cpp +++ b/ChemistryLib/PhreeqcIOData/ChemicalSystem.cpp @@ -47,7 +47,9 @@ void ChemicalSystem::initialize(std::size_t const num_chemical_systems) for (auto& equilibrium_reactant : equilibrium_reactants) { equilibrium_reactant.molality->resize(num_chemical_systems); + equilibrium_reactant.molality_prev->resize(num_chemical_systems); equilibrium_reactant.volume_fraction->resize(num_chemical_systems); + equilibrium_reactant.volume_fraction_prev->resize(num_chemical_systems); } } } // namespace PhreeqcIOData diff --git a/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp b/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp index 48bdd42967e..1ba9dedbf90 100644 --- a/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp +++ b/ChemistryLib/PhreeqcIOData/CreateEquilibriumReactants.cpp @@ -61,16 +61,27 @@ std::vector<EquilibriumReactant> createEquilibriumReactants( auto molality = MeshLib::getOrCreateMeshProperty<double>( mesh, name, MeshLib::MeshItemType::IntegrationPoint, 1); + auto molality_prev = MeshLib::getOrCreateMeshProperty<double>( + mesh, name + "_prev", MeshLib::MeshItemType::IntegrationPoint, 1); + auto volume_fraction = MeshLib::getOrCreateMeshProperty<double>( mesh, "phi_" + name, MeshLib::MeshItemType::IntegrationPoint, 1); + auto volume_fraction_prev = MeshLib::getOrCreateMeshProperty<double>( + mesh, + "phi_" + name + "_prev", + MeshLib::MeshItemType::IntegrationPoint, + 1); + auto mesh_prop_molality = MeshLib::getOrCreateMeshProperty<double>( mesh, name + "_avg", MeshLib::MeshItemType::Cell, 1); mesh_prop_molality->resize(mesh.getNumberOfElements()); equilibrium_reactants.emplace_back(std::move(name), molality, + molality_prev, volume_fraction, + volume_fraction_prev, mesh_prop_molality, saturation_index, std::move(reaction_irreversibility)); diff --git a/ChemistryLib/PhreeqcIOData/EquilibriumReactant.h b/ChemistryLib/PhreeqcIOData/EquilibriumReactant.h index 99758a1ba21..8fdc172508c 100644 --- a/ChemistryLib/PhreeqcIOData/EquilibriumReactant.h +++ b/ChemistryLib/PhreeqcIOData/EquilibriumReactant.h @@ -30,13 +30,17 @@ struct EquilibriumReactant { EquilibriumReactant(std::string name_, MeshLib::PropertyVector<double>* molality_, + MeshLib::PropertyVector<double>* molality_prev_, MeshLib::PropertyVector<double>* volume_fraction_, + MeshLib::PropertyVector<double>* volume_fraction_prev_, MeshLib::PropertyVector<double>* mesh_prop_molality_, double saturation_index_, std::string reaction_irreversibility_) : name(std::move(name_)), molality(molality_), + molality_prev(molality_prev_), volume_fraction(volume_fraction_), + volume_fraction_prev(volume_fraction_prev_), mesh_prop_molality(mesh_prop_molality_), saturation_index(saturation_index_), reaction_irreversibility(std::move(reaction_irreversibility_)) @@ -47,7 +51,9 @@ struct EquilibriumReactant std::string const name; MeshLib::PropertyVector<double>* molality; + MeshLib::PropertyVector<double>* molality_prev; MeshLib::PropertyVector<double>* volume_fraction; + MeshLib::PropertyVector<double>* volume_fraction_prev; MeshLib::PropertyVector<double>* mesh_prop_molality; double const saturation_index; std::string const reaction_irreversibility; -- GitLab