Skip to content

Commit

Permalink
Add consistency tests for Maskell phase
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Jun 10, 2022
1 parent 88669ca commit 17bb016
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 8 deletions.
33 changes: 33 additions & 0 deletions test/data/consistency-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
42 changes: 34 additions & 8 deletions test/thermo/consistency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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()) {
Expand All @@ -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());
Expand All @@ -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()) {
Expand Down Expand Up @@ -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")))
);

}

0 comments on commit 17bb016

Please sign in to comment.