mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-13 07:08:23 +01:00
Implementing mass_h2o into ESSENTIALS
This commit is contained in:
parent
115fe2f272
commit
51162a4c1d
@ -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
|
||||
|
||||
@ -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
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
|
||||
@ -304,7 +304,7 @@ std::vector<std::string> PhreeqcMatrix::getMatrixTransported() const {
|
||||
std::vector<std::string> names;
|
||||
|
||||
const std::vector<std::string> 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<std::string> PhreeqcMatrix::getMatrixTransported() const {
|
||||
std::vector<std::string> PhreeqcMatrix::getMatrixOutOnly() const {
|
||||
// MDL we must append here selected_output / user_punch
|
||||
std::vector<std::string> defaultnames = {
|
||||
"tc", "patm", "SolVol", "pH", "pe"
|
||||
"tc", "patm", "SolVol", "pH", "pe", "MassH2O"
|
||||
};
|
||||
std::vector<std::string> ret;
|
||||
for (auto nm : defaultnames) {
|
||||
|
||||
@ -36,6 +36,7 @@ void SolutionWrapper::get(std::span<LDBLE> &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<LDBLE> &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<LDBLE> &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());
|
||||
}
|
||||
|
||||
@ -40,10 +40,10 @@ private:
|
||||
cxxSolution *solution;
|
||||
const std::vector<std::string> solution_order;
|
||||
|
||||
static constexpr std::array<const char *, 8> ESSENTIALS = {
|
||||
static constexpr std::array<const char *, 9> 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();
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<int> &ints,
|
||||
std::vector<double> &doubles);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user