From b383d3388018b3d2a5fd2fc075708a3b30cc0bf4 Mon Sep 17 00:00:00 2001
From: renchao_lu <renchao.lu@gmail.com>
Date: Fri, 10 Dec 2021 14:07:10 +0100
Subject: [PATCH] [CL] Initialize the "fixing_pe" option.

---
 ChemistryLib/PhreeqcIOData/AqueousSolution.h         | 10 ++++++----
 ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp |  8 ++++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ChemistryLib/PhreeqcIOData/AqueousSolution.h b/ChemistryLib/PhreeqcIOData/AqueousSolution.h
index c646666a1d1..96fd71db1c4 100644
--- a/ChemistryLib/PhreeqcIOData/AqueousSolution.h
+++ b/ChemistryLib/PhreeqcIOData/AqueousSolution.h
@@ -45,11 +45,12 @@ struct Component
 
 struct AqueousSolution
 {
-    AqueousSolution(double temperature_, double pressure_,
-                    MeshLib::PropertyVector<double>* pe_, double const pe0_,
-                    std::vector<Component>&& components_,
+    AqueousSolution(bool const fixing_pe_, double temperature_,
+                    double pressure_, MeshLib::PropertyVector<double>* pe_,
+                    double const pe0_, std::vector<Component>&& components_,
                     ChargeBalance charge_balance_)
-        : temperature(temperature_),
+        : fixing_pe(fixing_pe_),
+          temperature(temperature_),
           pressure(pressure_),
           pe(pe_),
           pe0(pe0_),
@@ -60,6 +61,7 @@ struct AqueousSolution
 
     void print(std::ostream& os, std::size_t const chemical_system_id) const;
 
+    bool const fixing_pe;
     double const temperature;
     double const pressure;
     std::unique_ptr<GlobalVector> pH;
diff --git a/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp b/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp
index 2392d48af05..0ff8d94c96a 100644
--- a/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp
+++ b/ChemistryLib/PhreeqcIOData/CreateAqueousSolution.cpp
@@ -23,6 +23,9 @@ namespace PhreeqcIOData
 std::unique_ptr<AqueousSolution> createAqueousSolution(
     BaseLib::ConfigTree const& config, MeshLib::Mesh& mesh)
 {
+    //! \ogs_file_attr{prj__chemical_system__solution__fixing_pe}
+    auto const fixing_pe = config.getConfigAttribute<bool>("fixing_pe", false);
+
     //! \ogs_file_param{prj__chemical_system__solution__temperature}
     auto const temperature = config.getConfigParameter<double>("temperature");
 
@@ -39,8 +42,9 @@ std::unique_ptr<AqueousSolution> createAqueousSolution(
 
     auto charge_balance = createChargeBalance(config);
 
-    return std::make_unique<AqueousSolution>(
-        temperature, pressure, pe, pe0, std::move(components), charge_balance);
+    return std::make_unique<AqueousSolution>(fixing_pe, temperature, pressure,
+                                             pe, pe0, std::move(components),
+                                             charge_balance);
 }
 }  // namespace PhreeqcIOData
 }  // namespace ChemistryLib
-- 
GitLab