From 17bb016ee279fe2ffd5bb63afed467f4ebf8838b Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 6 Jun 2022 19:42:20 -0400 Subject: [PATCH] Add consistency tests for Maskell phase --- test/data/consistency-cases.yaml | 33 +++++++++++++++++++++++++ test/thermo/consistency.cpp | 42 ++++++++++++++++++++++++++------ 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/test/data/consistency-cases.yaml b/test/data/consistency-cases.yaml index 9ffe23db55..2d5de33b07 100644 --- a/test/data/consistency-cases.yaml +++ b/test/data/consistency-cases.yaml @@ -326,3 +326,36 @@ Redlich-Kister: - {T: 440, P: 1 atm, X: {Li(C6): 0.75, V(C6): 0.25}} - {T: 350, P: 10 atm, X: {Li(C6): 1.0, V(C6): 0.0}} - {T: 350, P: 10 atm, X: {Li(C6): 0.0, V(C6): 1.0}} + +Maskell-solid-solution: + setup: + file: thermo-models.yaml + phase: MaskellSolidSoln + known-failures: + g_eq_sum_gk_Xk: "Inconsistent implementation. See GitHub Issue #1321" + hk0_eq_uk0_plus_p_vk0/[234]: + "Inconsistent except at P = 1 atm. See GitHub Issue #1321" + cpk0_eq_dhk0dT/[234]: + "Inconsistent except at P = 1 atm. See GitHub Issue #1321" + standard_gibbs_nondim/[234]: + "Inconsistent except at P = 1 atm. See GitHub Issue #1321" + g_eq_h_minus_Ts/[34]: + "Generates NaN at limiting composition. See GitHub Issue #1321" + dsdP_const_T_eq_minus_dV_dT_const_P/[34]: + "Generates NaN at limiting composition. See GitHub Issue #1321" + chem_potentials_to_activities/[34]: + "Generates NaN at limiting composition. See GitHub Issue #1321" + activity_coeffs/[34]: + "Generates NaN at limiting composition. See GitHub Issue #1321" + activity_concentrations/[34]: + "Generates NaN at limiting composition. See GitHub Issue #1321" + log_activity_coeffs/[34]: + "Generates NaN at limiting composition. See GitHub Issue #1321" + h_eq_u_plus_Pv/4: + "Generates NaN at limiting composition. See GitHub Issue #1321" + states: + - {T: 300, P: 1 atm, X: {H(s): 0.3, He(s): 0.7}} + - {T: 340, P: 1 atm, X: {H(s): 0.3, He(s): 0.7}} + - {T: 330, P: 10 atm, X: {H(s): 0.3, He(s): 0.7}} + - {T: 280, P: 20 atm, X: {H(s): 1.0, He(s): 0.0}} + - {T: 380, P: 5 atm, X: {H(s): 0.0, He(s): 1.0}} diff --git a/test/thermo/consistency.cpp b/test/thermo/consistency.cpp index 46dd62c556..47ede5b83e 100644 --- a/test/thermo/consistency.cpp +++ b/test/thermo/consistency.cpp @@ -197,8 +197,13 @@ TEST_P(TestConsistency, cp_eq_sum_cpk_Xk) TEST_P(TestConsistency, cp_eq_dhdT) { - double h1 = phase->enthalpy_mole(); - double cp1 = phase->cp_mole(); + double h1, cp1; + try { + h1 = phase->enthalpy_mole(); + cp1 = phase->cp_mole(); + } catch (NotImplementedError& err) { + GTEST_SKIP() << err.getMethod() << " threw NotImplementedError"; + } double T1 = phase->temperature(); double dT = 1e-5 * phase->temperature(); phase->setState_TP(T1 + dT, phase->pressure()); @@ -211,8 +216,13 @@ TEST_P(TestConsistency, cp_eq_dhdT) TEST_P(TestConsistency, cv_eq_dudT) { - double u1 = phase->intEnergy_mole(); - double cv1 = phase->cv_mole(); + double u1, cv1; + try { + u1 = phase->intEnergy_mole(); + cv1 = phase->cv_mole(); + } catch (NotImplementedError& err) { + GTEST_SKIP() << err.getMethod() << " threw NotImplementedError"; + } double T1 = phase->temperature(); double dT = 1e-5 * phase->temperature(); if (phase->isCompressible()) { @@ -229,8 +239,13 @@ TEST_P(TestConsistency, cv_eq_dudT) TEST_P(TestConsistency, cp_eq_dsdT_const_p_times_T) { - double s1 = phase->entropy_mole(); - double cp1 = phase->cp_mole(); + double s1, cp1; + try { + s1 = phase->entropy_mole(); + cp1 = phase->cp_mole(); + } catch (NotImplementedError& err) { + GTEST_SKIP() << err.getMethod() << " threw NotImplementedError"; + } double T1 = phase->temperature(); double dT = 1e-4 * phase->temperature(); phase->setState_TP(T1 + dT, phase->pressure()); @@ -243,8 +258,13 @@ TEST_P(TestConsistency, cp_eq_dsdT_const_p_times_T) TEST_P(TestConsistency, cv_eq_dsdT_const_v_times_T) { - double s1 = phase->entropy_mole(); - double cv1 = phase->cv_mole(); + double s1, cv1; + try { + s1 = phase->entropy_mole(); + cv1 = phase->cv_mole(); + } catch (NotImplementedError& err) { + GTEST_SKIP() << err.getMethod() << " threw NotImplementedError"; + } double T1 = phase->temperature(); double dT = 1e-4 * phase->temperature(); if (phase->isCompressible()) { @@ -636,4 +656,10 @@ INSTANTIATE_TEST_SUITE_P(RedlichKister, TestConsistency, testing::ValuesIn(getStates("Redlich-Kister"))) ); +INSTANTIATE_TEST_SUITE_P(MaskellSolidSolution, TestConsistency, + testing::Combine( + testing::Values(getSetup("Maskell-solid-solution")), + testing::ValuesIn(getStates("Maskell-solid-solution"))) +); + }