diff --git a/test/data/consistency-cases.yaml b/test/data/consistency-cases.yaml index fc6880c893..17f327c510 100644 --- a/test/data/consistency-cases.yaml +++ b/test/data/consistency-cases.yaml @@ -32,6 +32,7 @@ ideal-molal-solution: "Implementations of g and s are inconsistent. See GitHub Issue #1300" gk_eq_hk_minus_T_times_sk: "Implementations of g and s are inconsistent. See GitHub Issue #1300" + cv_eq_dudT: cv not implemented states: - {T: 300, P: 101325, molalities: {CH4(aq): 0.01, H2S(aq): 0.03, CO2(aq): 0.1}} - {T: 300, P: 2 atm, molalities: {CH4(aq): 0.1, H2S(aq): 0.01, CO2(aq): 0.1}} @@ -109,6 +110,8 @@ nitrogen-purefluid: file: liquidvapor.yaml phase: nitrogen rtol_fd: 1e-5 + known-failures: + cv_eq_dudT/3: cv not defined in two-phase region states: - {T: 300, P: 1 atm} - {T: 70, P: 1 atm} @@ -121,6 +124,7 @@ plasma: phase: discretized-electron-energy-plasma known-failures: cp_eq_dhdT/1: Test does not account for distinct electron temperature + cv_eq_dudT/1: Test does not account for distinct electron temperature states: - {T: 300, P: 1 atm, X: {O2: 1.0, O2-: 1e-5, E: 1e-5}} - {T: 300, P: 1 atm, X: {E: 1.0}} diff --git a/test/thermo/consistency.cpp b/test/thermo/consistency.cpp index e3a5c2e0cc..043cba37f3 100644 --- a/test/thermo/consistency.cpp +++ b/test/thermo/consistency.cpp @@ -163,6 +163,24 @@ TEST_P(TestConsistency, cp_eq_dhdT) EXPECT_NEAR(cp_fd, cp_mid, max({rtol_fd * cp_mid, rtol_fd * cp_fd, atol})); } +TEST_P(TestConsistency, cv_eq_dudT) +{ + double u1 = phase->intEnergy_mole(); + double cv1 = phase->cv_mole(); + double T1 = phase->temperature(); + double dT = 1e-5 * phase->temperature(); + if (phase->isCompressible()) { + phase->setState_TR(T1 + dT, phase->density()); + } else { + phase->setTemperature(T1 + dT); + } + double u2 = phase->intEnergy_mole(); + double cv2 = phase->cv_mole(); + double cv_mid = 0.5 * (cv1 + cv2); + double cv_fd = (u2 - u1)/dT; + EXPECT_NEAR(cv_fd, cv_mid, max({rtol_fd * cv_mid, rtol_fd * cv_fd, atol})); +} + INSTANTIATE_TEST_SUITE_P(IdealGas, TestConsistency, testing::Combine( testing::Values(getSetup("ideal-gas-h2o2")),