test(tests/eos): added test for composition module mode
This commit is contained in:
@@ -17,8 +17,6 @@ namespace serif::eos {
|
|||||||
q.abar = in.composition.getMeanParticleMass(); // Mean atomic mass in g
|
q.abar = in.composition.getMeanParticleMass(); // Mean atomic mass in g
|
||||||
q.zbar = in.composition.getMeanAtomicNumber(); // Mean atomic number (dimensionless)
|
q.zbar = in.composition.getMeanAtomicNumber(); // Mean atomic number (dimensionless)
|
||||||
|
|
||||||
std::cout << "(EOS) abar: " << q.abar << ", zbar: " << q.zbar << std::endl;
|
|
||||||
|
|
||||||
helmholtz::HELMEOSOutput tempOutput;
|
helmholtz::HELMEOSOutput tempOutput;
|
||||||
tempOutput = helmholtz::get_helm_EOS(q, *std::get<std::unique_ptr<helmholtz::HELMTable>>(m_reader.getTable()));
|
tempOutput = helmholtz::get_helm_EOS(q, *std::get<std::unique_ptr<helmholtz::HELMTable>>(m_reader.getTable()));
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace serif::eos {
|
|||||||
std::string name; ///< Name of the parameter (e.g., "Pressure", "Energy", "Entropy").
|
std::string name; ///< Name of the parameter (e.g., "Pressure", "Energy", "Entropy").
|
||||||
|
|
||||||
friend std::ostream& operator<<(std::ostream& os, const EOSParameter& param) {
|
friend std::ostream& operator<<(std::ostream& os, const EOSParameter& param) {
|
||||||
os << std::setprecision(3) << "<EOSParameter (" << param.name << "): " << param.total << " (gas: " << param.gas
|
os << std::setprecision(5) << "<EOSParameter (" << param.name << "): " << param.total << " (gas: " << param.gas
|
||||||
<< ", radiation: " << param.radiation << ") "
|
<< ", radiation: " << param.radiation << ") "
|
||||||
<< "d/dRho: " << param.dDensity << ", d/dT: " << param.dTemperature
|
<< "d/dRho: " << param.dDensity << ", d/dT: " << param.dTemperature
|
||||||
<< ", d/dAbar: " << param.dMeanAtomicMassNumber
|
<< ", d/dAbar: " << param.dMeanAtomicMassNumber
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ TEST_F(eosTest, get_helm_EOS) {
|
|||||||
auto& helmTable = *std::get<std::unique_ptr<serif::eos::helmholtz::HELMTable>>(table);
|
auto& helmTable = *std::get<std::unique_ptr<serif::eos::helmholtz::HELMTable>>(table);
|
||||||
serif::eos::helmholtz::HELMEOSOutput helmEos = get_helm_EOS(eos1, helmTable);
|
serif::eos::helmholtz::HELMEOSOutput helmEos = get_helm_EOS(eos1, helmTable);
|
||||||
|
|
||||||
const double absErr = 1e-12;
|
constexpr double absErr = 1e-12;
|
||||||
|
|
||||||
//Check composition info
|
//Check composition info
|
||||||
EXPECT_NEAR( helmEos.ye, 8.75e-01, absErr);
|
EXPECT_NEAR( helmEos.ye, 8.75e-01, absErr);
|
||||||
@@ -90,10 +90,26 @@ TEST_F(eosTest, get_helm_EOS) {
|
|||||||
|
|
||||||
TEST_F(eosTest, eos_using_composition) {
|
TEST_F(eosTest, eos_using_composition) {
|
||||||
serif::composition::Composition 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("H-1", 0.75);
|
||||||
composition.setMassFraction("He-4", 0.23);
|
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();
|
composition.finalize();
|
||||||
|
|
||||||
serif::resource::ResourceManager& rm = serif::resource::ResourceManager::getInstance();
|
serif::resource::ResourceManager& rm = serif::resource::ResourceManager::getInstance();
|
||||||
@@ -108,4 +124,7 @@ TEST_F(eosTest, eos_using_composition) {
|
|||||||
|
|
||||||
serif::eos::EOSOutput eosOutput;
|
serif::eos::EOSOutput eosOutput;
|
||||||
EXPECT_NO_THROW(eosOutput = EOS.get(eosInput));
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user