Skip to content

Commit f09de99

Browse files
committed
Test molar enthalpy for IdealSolidSolnPhas
- Test that `enthalpy_mole = sum(X_k * h_k)` for `IdealSolidSolnPhase` class, where `X_k` is mole fraction and `h_k` partial molar enthalpy. - Also test the pressure independence of this equality, by verifying at pressures 1 atm and 2 atm.
1 parent f514cae commit f09de99

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/thermo/thermoFromYaml.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,28 @@ TEST(ThermoFromYaml, IdealSolidSolnPhase)
383383
EXPECT_NEAR(thermo->density(), 10.1787080, 1e-6);
384384
EXPECT_NEAR(thermo->enthalpy_mass(), -15642788.8547624, 1e-4);
385385
EXPECT_NEAR(thermo->gibbs_mole(), -313642312.7114608, 1e-4);
386+
387+
// Test that molar enthalpy equals sum(h_k*X_k). Test first at default
388+
// pressure:
389+
double h_avg = 0;
390+
size_t N = thermo->nSpecies();
391+
vector_fp X_k(N);
392+
vector_fp h_k(N);
393+
thermo->getMoleFractions(X_k.data());
394+
thermo->getPartialMolarEnthalpies(h_k.data());
395+
for (size_t k = 0; k < N; k++) {
396+
h_avg += X_k[k]*h_k[k];
397+
}
398+
EXPECT_NEAR(thermo->enthalpy_mole(), h_avg, 1e-6);
399+
400+
// Now test the pressure dependence, by repeating at 2 atm:
401+
thermo->setState_TP(298, 2*OneAtm);
402+
thermo->getPartialMolarEnthalpies(h_k.data());
403+
h_avg = 0;
404+
for (size_t k = 0; k < N; k++) {
405+
h_avg += X_k[k]*h_k[k];
406+
}
407+
EXPECT_NEAR(thermo->enthalpy_mole(), h_avg, 1e-6);
386408
}
387409

388410
TEST(ThermoFromYaml, Lattice)

0 commit comments

Comments
 (0)