Skip to content

Commit

Permalink
Fix compareThermo test for PlasmaPhase
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Jan 15, 2023
1 parent 2f9abcf commit cb514cd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/thermo/thermoToYaml.cpp
Expand Up @@ -342,6 +342,7 @@ class ThermoYamlRoundTrip : public testing::Test
input1);
skip_cp = false;
skip_activities = false;
skip_entropy = false;
rtol = 1e-14;
}

Expand All @@ -367,8 +368,10 @@ class ThermoYamlRoundTrip : public testing::Test
EXPECT_NEAR(original->cp_mass(), duplicate->cp_mass(),
rtol * original->cp_mass());
}
EXPECT_NEAR(original->entropy_mass(), duplicate->entropy_mass(),
rtol * fabs(original->entropy_mass()));
if (!skip_entropy) {
EXPECT_NEAR(original->entropy_mass(), duplicate->entropy_mass(),
rtol * fabs(original->entropy_mass()));
}
EXPECT_NEAR(original->enthalpy_mole(), duplicate->enthalpy_mole(),
rtol * fabs(original->enthalpy_mole()));

Expand Down Expand Up @@ -403,6 +406,7 @@ class ThermoYamlRoundTrip : public testing::Test
shared_ptr<ThermoPhase> duplicate;
bool skip_cp;
bool skip_activities;
bool skip_entropy;
double rtol;
};

Expand Down Expand Up @@ -517,6 +521,8 @@ TEST_F(ThermoYamlRoundTrip, Surface)
TEST_F(ThermoYamlRoundTrip, IsotropicElectronEnergyPlasma)
{
roundtrip("oxygen-plasma.yaml", "isotropic-electron-energy-plasma");
skip_cp = true; // Not implemented for PlasmaPhase
skip_entropy = true; // Not implemented for PlasmaPhase
compareThermo(800, 2*OneAtm);
auto origPlasma = std::dynamic_pointer_cast<PlasmaPhase>(original);
auto duplPlasma = std::dynamic_pointer_cast<PlasmaPhase>(duplicate);
Expand All @@ -530,6 +536,8 @@ TEST_F(ThermoYamlRoundTrip, IsotropicElectronEnergyPlasma)
TEST_F(ThermoYamlRoundTrip, DiscretizedElectronEnergyPlasma)
{
roundtrip("oxygen-plasma.yaml", "discretized-electron-energy-plasma");
skip_cp = true; // Not implemented for PlasmaPhase
skip_entropy = true; // Not implemented for PlasmaPhase
compareThermo(800, 2*OneAtm);
EXPECT_DOUBLE_EQ(original->electronTemperature(), duplicate->electronTemperature());
}

0 comments on commit cb514cd

Please sign in to comment.