test(tests/eos): added test for composition module mode

This commit is contained in:
2025-06-17 08:18:06 -04:00
parent 3961c745e3
commit bc548ed311
3 changed files with 23 additions and 6 deletions

View File

@@ -65,7 +65,7 @@ TEST_F(eosTest, get_helm_EOS) {
auto& helmTable = *std::get<std::unique_ptr<serif::eos::helmholtz::HELMTable>>(table);
serif::eos::helmholtz::HELMEOSOutput helmEos = get_helm_EOS(eos1, helmTable);
const double absErr = 1e-12;
constexpr double absErr = 1e-12;
//Check composition info
EXPECT_NEAR( helmEos.ye, 8.75e-01, absErr);
@@ -90,10 +90,26 @@ TEST_F(eosTest, get_helm_EOS) {
TEST_F(eosTest, eos_using_composition) {
serif::composition::Composition composition;
composition.registerSymbol({"H-1", "He-4", "C-12"}, true);
composition.registerSymbol({
"H-1",
"He-4",
"C-12",
"O-16",
"Ne-20",
"Fe-56",
"N-14",
"Si-28",
"Mg-24"
}, true);
composition.setMassFraction("H-1", 0.75);
composition.setMassFraction("He-4", 0.23);
composition.setMassFraction("C-12", 0.02);
composition.setMassFraction("C-12", 0.0044);
composition.setMassFraction("O-16", 0.0096);
composition.setMassFraction("Ne-20", 0.002);
composition.setMassFraction("Fe-56", 0.0018);
composition.setMassFraction("N-14", 0.001);
composition.setMassFraction("Si-28", 0.0008);
composition.setMassFraction("Mg-24", 0.0004);
composition.finalize();
serif::resource::ResourceManager& rm = serif::resource::ResourceManager::getInstance();
@@ -108,4 +124,7 @@ TEST_F(eosTest, eos_using_composition) {
serif::eos::EOSOutput eosOutput;
EXPECT_NO_THROW(eosOutput = EOS.get(eosInput));
eosOutput = EOS.get(eosInput);
constexpr double absErr = 1e-8;
EXPECT_NEAR(eosOutput.pressure.total, 6.9548533046915791E+22, absErr);
}