From 89aae60b08e3f99eb2ffba8eeb88396890e653bc Mon Sep 17 00:00:00 2001 From: David Parkhurst Date: Tue, 15 Oct 2024 15:49:40 -0600 Subject: [PATCH] fixed viscos_0 as new datum in solution class. --- mytest/ex13_impl_101.sel | 42 ++++++++++++++++++++-------------------- src/Solution.cxx | 16 ++++++++++++++- src/step.cpp | 2 ++ 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/mytest/ex13_impl_101.sel b/mytest/ex13_impl_101.sel index ff5445f21..6ebf833ae 100644 --- a/mytest/ex13_impl_101.sel +++ b/mytest/ex13_impl_101.sel @@ -69,24 +69,24 @@ 0.001000156719 0.0000000000 0.001000156719 0.0000000000 0.001000162054 0.0000000000 - 0.001417432889 0.0000000000 - 0.001298451747 0.0000000000 - 0.001183988239 0.0000000000 - 0.001087195841 0.0000000000 - 0.001073402530 0.0000000000 - 0.001059805948 0.0000000000 - 0.001046369444 0.0000000000 - 0.001033058137 0.0000000000 - 0.001019840238 0.0000000000 - 0.001006695996 0.0000000000 - 0.001000156719 0.0000000000 - 0.001000181124 0.0000000000 - 0.001000189354 0.0000000000 - 0.001000181279 0.0000000000 - 0.001000176735 0.0000000000 - 0.001000172738 0.0000000000 - 0.001000169192 0.0000000000 - 0.001000166012 0.0000000000 - 0.001000163120 0.0000000000 - 0.001000160448 0.0000000000 - 0.001000157935 0.0000000000 + 0.001392195976 0.0000000000 + 0.001274048320 0.0000000000 + 0.001160229914 0.0000000000 + 0.001081559743 0.0000000000 + 0.001068654959 0.0000000000 + 0.001055936626 0.0000000000 + 0.001043369801 0.0000000000 + 0.001030921415 0.0000000000 + 0.001018561642 0.0000000000 + 0.001006271927 0.0000000000 + 0.001000156719 0.0000000000 + 0.001000180128 0.0000000000 + 0.001000186948 0.0000000000 + 0.001000178797 0.0000000000 + 0.001000174795 0.0000000000 + 0.001000171245 0.0000000000 + 0.001000168071 0.0000000000 + 0.001000165203 0.0000000000 + 0.001000162579 0.0000000000 + 0.001000160141 0.0000000000 + 0.001000157837 0.0000000000 diff --git a/src/Solution.cxx b/src/Solution.cxx index ea2e54da1..231db416a 100644 --- a/src/Solution.cxx +++ b/src/Solution.cxx @@ -276,6 +276,8 @@ cxxSolution::dump_raw(std::ostream & s_oss, unsigned int indent, int *n_out) con // new identifier s_oss << indent1; s_oss << "-viscosity " << this->viscosity << "\n"; + s_oss << indent1; + s_oss << "-viscos_0 " << this->viscos_0 << "\n"; // soln_total conc structures s_oss << indent1; @@ -1088,6 +1090,16 @@ cxxSolution::read_raw(CParser & parser, bool check) } opt_save = CParser::OPT_DEFAULT; break; + case 29: // viscos_0 + if (!(parser.get_iss() >> this->viscos_0)) + { + this->viscos_0 = 1.0; + parser.incr_input_error(); + parser.error_msg("Expected numeric value for viscos_0.", + PHRQ_io::OT_CONTINUE); + } + opt_save = CParser::OPT_DEFAULT; + break; } if (opt == CParser::OPT_EOF || opt == CParser::OPT_KEYWORD) break; @@ -1417,6 +1429,7 @@ cxxSolution::add(const cxxSolution & addee, LDBLE extensive) this->cb += addee.cb * extensive; this->density = f1 * this->density + f2 * addee.density; this->viscosity = f1 * this->viscosity + f2 * addee.viscosity; + this->viscos_0 = f1 * this->viscos_0 + f2 * addee.viscos_0; this->patm = f1 * this->patm + f2 * addee.patm; // this->potV = f1 * this->potV + f2 * addee.potV; // appt this->mass_water += addee.mass_water * extensive; @@ -1775,6 +1788,7 @@ const std::vector< std::string >::value_type temp_vopts[] = { std::vector< std::string >::value_type("log_gamma_map"), // 25 std::vector< std::string >::value_type("potential"), // 26 std::vector< std::string >::value_type("log_molalities_map"), // 27 - std::vector< std::string >::value_type("viscosity") // 28 + std::vector< std::string >::value_type("viscosity"), // 28 + std::vector< std::string >::value_type("viscos_0") // 29 }; const std::vector< std::string > cxxSolution::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); diff --git a/src/step.cpp b/src/step.cpp index 7d3dc1482..131aec3a6 100644 --- a/src/step.cpp +++ b/src/step.cpp @@ -328,6 +328,7 @@ xsolution_zero(void) mu_x = 0.0; ah2o_x = 0.0; viscos = 0.0; + viscos_0 = 0.0; density_x = 0.0; total_h_x = 0.0; total_o_x = 0.0; @@ -381,6 +382,7 @@ add_solution(cxxSolution *solution_ptr, LDBLE extensive, LDBLE intensive) mu_x += solution_ptr->Get_mu() * intensive; ah2o_x += solution_ptr->Get_ah2o() * intensive; viscos += solution_ptr->Get_viscosity() * intensive; + viscos_0 += solution_ptr->Get_viscos_0() * intensive; density_x += solution_ptr->Get_density() * intensive; total_h_x += solution_ptr->Get_total_h() * extensive;