From 6eb7248f5dfab0c7a674319713af2be443d6ff73 Mon Sep 17 00:00:00 2001 From: Ian Bell <ian.bell@nist.gov> Date: Wed, 10 Aug 2022 13:29:24 -0400 Subject: [PATCH] Pure endpoint polishing is opt-in, not opt-out for critical curves --- include/teqp/algorithms/critical_tracing.hpp | 2 +- src/tests/catch_test_ammonia_water.cxx | 7 ++++--- src/tests/catch_tests.cxx | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/teqp/algorithms/critical_tracing.hpp b/include/teqp/algorithms/critical_tracing.hpp index e776d55..5825aa5 100644 --- a/include/teqp/algorithms/critical_tracing.hpp +++ b/include/teqp/algorithms/critical_tracing.hpp @@ -34,7 +34,7 @@ struct TCABOptions { double stability_rel_drho = 0.001; ///< The relative size of the step (relative to the sum of the molar concentration vector) to be used when taking the step in the direction of \f$\sigma_1\f$ when assessing local stability int verbosity = 0; ///< The greater the verbosity, the more output you will get, especially about polishing failures bool polish_exception_on_fail = false; ///< If true, when polishing fails, throw an exception, otherwise, terminate tracing - bool pure_endpoint_polish = true; ///< If true, if the last step crossed into negative concentrations, try to interpolate to find the pure fluid endpoint hiding in the data + bool pure_endpoint_polish = false; ///< If true, if the last step crossed into negative concentrations, try to interpolate to find the pure fluid endpoint hiding in the data }; template<typename Model, typename Scalar = double, typename VecType = Eigen::ArrayXd> diff --git a/src/tests/catch_test_ammonia_water.cxx b/src/tests/catch_test_ammonia_water.cxx index 26a35a5..56fd8e3 100644 --- a/src/tests/catch_test_ammonia_water.cxx +++ b/src/tests/catch_test_ammonia_water.cxx @@ -9,7 +9,7 @@ using Catch::Approx; using namespace teqp; -TEST_CASE("Trace critical curve w/ Tillner-Roth", "[NHfty3H2O]") { +TEST_CASE("Trace critical curve w/ Tillner-Roth", "[NH3H2O]") { auto model = AmmoniaWaterTillnerRoth(); auto z = (Eigen::ArrayXd(2) << 0.7, 0.3).finished(); auto Ar01 = teqp::TDXDerivatives<decltype(model)>::get_Ar01(model, 300, 300, z); @@ -20,7 +20,8 @@ TEST_CASE("Trace critical curve w/ Tillner-Roth", "[NHfty3H2O]") { auto pig0 = rhovec0.sum() * model.R(rhovec0/rhovec0.sum())*T0; REQUIRE(prc0 + pig0 == Approx(11.33e6).margin(0.01e6)); - TCABOptions opt; opt.polish = true; opt.integration_order = 1; opt.init_dt = 100; + TCABOptions opt; opt.polish = true; opt.integration_order = 1; opt.init_dt = 100; + opt.pure_endpoint_polish = false; // Doesn't work for pure water CriticalTracing<decltype(model)>::trace_critical_arclength_binary(model, T0, rhovec0, "TillnerRoth_crit.csv", opt); } @@ -62,6 +63,6 @@ TEST_CASE("Bell et al. REFPROP 10", "[NH3H2O]") { auto pig0 = rhovec0.sum() * mutant.R(rhovec0 / rhovec0.sum()) * T0; TCABOptions opt; opt.polish = true; opt.integration_order = 1; opt.init_dt = 100; opt.verbosity = 1000; - + opt.pure_endpoint_polish = false; // Doesn't work for pure water CriticalTracing<decltype(mutant)>::trace_critical_arclength_binary(mutant, T0, rhovec0, "BellREFPROP10_NH3.csv", opt); } \ No newline at end of file diff --git a/src/tests/catch_tests.cxx b/src/tests/catch_tests.cxx index 672b486..e842649 100644 --- a/src/tests/catch_tests.cxx +++ b/src/tests/catch_tests.cxx @@ -265,6 +265,7 @@ TEST_CASE("Trace critical locus for vdW", "[vdW][crit]") using ct = CriticalTracing<decltype(vdW), double, Eigen::ArrayXd>; TCABOptions opt; opt.polish = true; + opt.pure_endpoint_polish = true; auto trace = ct::trace_critical_arclength_binary(vdW, T0, rhovec0, filename, opt); auto tic1 = std::chrono::steady_clock::now(); double max_splus = 0; -- GitLab