diff --git a/CMakeLists.txt b/CMakeLists.txt index 73436b81..b19f1253 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ endif() # compile Var.c as c++ set_source_files_properties(src/Var.c PROPERTIES LANGUAGE CXX) -add_library(IPhreeqc STATIC src/IPhreeqc.cpp) +add_library(IPhreeqc src/IPhreeqc.cpp) target_sources(IPhreeqc PRIVATE diff --git a/litephreeqc/CMakeLists.txt b/litephreeqc/CMakeLists.txt index 3e75ae34..a51a65ff 100644 --- a/litephreeqc/CMakeLists.txt +++ b/litephreeqc/CMakeLists.txt @@ -21,7 +21,8 @@ set(LPQC_SOURCE_FILES src/PhreeqcMatrix/Misc.cpp ) -add_library(litephreeqc STATIC ${LPQC_SOURCE_FILES}) +# add_library(litephreeqc STATIC ${LPQC_SOURCE_FILES}) +add_library(litephreeqc ${LPQC_SOURCE_FILES}) target_link_libraries(litephreeqc PUBLIC IPhreeqc) target_include_directories(litephreeqc PUBLIC $ diff --git a/litephreeqc/src/PhreeqcMatrix/Access.cpp b/litephreeqc/src/PhreeqcMatrix/Access.cpp index 87387d16..9d0729b4 100644 --- a/litephreeqc/src/PhreeqcMatrix/Access.cpp +++ b/litephreeqc/src/PhreeqcMatrix/Access.cpp @@ -304,7 +304,7 @@ std::vector PhreeqcMatrix::getMatrixTransported() const { std::vector names; const std::vector to_remove = { - "tc", "patm", "SolVol", "pH", "pe" + "tc", "patm", "SolVol", "pH", "pe", "MassH2O" }; // sols contains all solutes; we must remove { tc, patm, SolVol, pH, pe } @@ -322,7 +322,7 @@ std::vector PhreeqcMatrix::getMatrixTransported() const { std::vector PhreeqcMatrix::getMatrixOutOnly() const { // MDL we must append here selected_output / user_punch std::vector defaultnames = { - "tc", "patm", "SolVol", "pH", "pe" + "tc", "patm", "SolVol", "pH", "pe", "MassH2O" }; std::vector ret; for (auto nm : defaultnames) { diff --git a/litephreeqc/src/Wrapper/SolutionWrapper.cpp b/litephreeqc/src/Wrapper/SolutionWrapper.cpp index 9156b382..23302f2d 100644 --- a/litephreeqc/src/Wrapper/SolutionWrapper.cpp +++ b/litephreeqc/src/Wrapper/SolutionWrapper.cpp @@ -36,6 +36,7 @@ void SolutionWrapper::get(std::span &data) const { data[5] = solution->Get_soln_vol(); data[6] = solution->Get_ph(); data[7] = solution->Get_pe(); + data[8] = solution->Get_mass_water(); const cxxNameDouble &totals = (_with_redox ? solution->Get_totals() @@ -61,6 +62,7 @@ void SolutionWrapper::set(const std::span &data) { const double &cb = data[2]; const double &tc = data[3]; const double &patm = data[4]; + const double &massh2o = data[5]; for (const auto &tot_name : solution_order) { const double value = data[i++]; @@ -71,7 +73,7 @@ void SolutionWrapper::set(const std::span &data) { new_totals[tot_name] = value; } - this->solution->Update(total_h, total_o, cb, tc, patm, + this->solution->Update(total_h, total_o, cb, tc, patm, massh2o, _with_redox ? new_totals : new_totals.Simplify_redox()); } diff --git a/litephreeqc/src/Wrapper/SolutionWrapper.hpp b/litephreeqc/src/Wrapper/SolutionWrapper.hpp index ee909aec..3f7ee8e8 100644 --- a/litephreeqc/src/Wrapper/SolutionWrapper.hpp +++ b/litephreeqc/src/Wrapper/SolutionWrapper.hpp @@ -40,10 +40,10 @@ private: cxxSolution *solution; const std::vector solution_order; - static constexpr std::array ESSENTIALS = { + static constexpr std::array ESSENTIALS = { "H", "O", "Charge", "tc", "patm", - "SolVol", "pH", "pe"}; // MDL; ML: only output + "SolVol", "pH", "pe", "MassH2O"}; // MDL; ML: only output static constexpr std::size_t NUM_ESSENTIALS = ESSENTIALS.size(); diff --git a/src/phreeqcpp/Solution.cxx b/src/phreeqcpp/Solution.cxx index 478911fb..eb5fde44 100644 --- a/src/phreeqcpp/Solution.cxx +++ b/src/phreeqcpp/Solution.cxx @@ -1070,7 +1070,7 @@ void cxxSolution::read_raw(CParser &parser, bool check) { } void cxxSolution::Update(LDBLE h_tot, LDBLE o_tot, LDBLE charge, LDBLE tc, - LDBLE patm, const cxxNameDouble &const_nd) { + LDBLE patm, LDBLE massh2o, const cxxNameDouble &const_nd) { this->new_def = false; this->patm = patm; // this->potV = 0.0; @@ -1083,7 +1083,7 @@ void cxxSolution::Update(LDBLE h_tot, LDBLE o_tot, LDBLE charge, LDBLE tc, this->total_h = h_tot; this->total_o = o_tot; this->cb = charge; - this->mass_water = o_tot / 55.55; + this->mass_water = massh2o; // o_tot / 55.55; MDL // this->density = 1.0; // this->viscosity = 1.0; diff --git a/src/phreeqcpp/Solution.h b/src/phreeqcpp/Solution.h index c659981b..01807b0e 100644 --- a/src/phreeqcpp/Solution.h +++ b/src/phreeqcpp/Solution.h @@ -123,7 +123,7 @@ public: // void modify_activities(const cxxSolution & original); // void Simplify_totals(); void Update(const cxxNameDouble &nd); - void Update(LDBLE h_tot, LDBLE o_tot, LDBLE charge, LDBLE tc, LDBLE patm, const cxxNameDouble &nd); + void Update(LDBLE h_tot, LDBLE o_tot, LDBLE charge, LDBLE tc, LDBLE patm, LDBLE massh2o, const cxxNameDouble &nd); void Update_activities(const cxxNameDouble &original_tot); void Serialize(Dictionary &dictionary, std::vector &ints, std::vector &doubles);