diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index cc7788104..8f440b833 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -460,6 +460,11 @@ static void installShomateThermoFromXML(const std::string& speciesName, SpeciesT if (dualRange) { getFloatArray(f1ptr->child("floatArray"), c1, false); } else { + if(c0.size() != 7) + { + throw CanteraError("installShomateThermoFromXML", + "Shomate thermo requires 7 coefficients in float array."); + } c1.resize(7,0.0); copy(c0.begin(), c0.begin()+7, c1.begin()); } @@ -473,6 +478,11 @@ static void installShomateThermoFromXML(const std::string& speciesName, SpeciesT throw CanteraError("installShomateThermoFromXML", "non-continuous temperature ranges."); } + if(c0.size() != 7 || c1.size() != 7) + { + throw CanteraError("installShomateThermoFromXML", + "Shomate thermo requires 7 coefficients in float array."); + } vector_fp c(15); c[0] = tmid; copy(c0.begin(), c0.begin()+7, c.begin() + 1); diff --git a/test/data/MaskellSolidSolnPhase_nohmix.xml b/test/data/MaskellSolidSolnPhase_nohmix.xml index 8516b09cf..aadcf0ce8 100644 --- a/test/data/MaskellSolidSolnPhase_nohmix.xml +++ b/test/data/MaskellSolidSolnPhase_nohmix.xml @@ -30,7 +30,13 @@ - 1. + 1., + 1., + 1., + 1., + 1., + 1., + 1., @@ -45,6 +51,12 @@ 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, diff --git a/test/data/MaskellSolidSolnPhase_valid.xml b/test/data/MaskellSolidSolnPhase_valid.xml index 3848a51f6..7ba5ff539 100644 --- a/test/data/MaskellSolidSolnPhase_valid.xml +++ b/test/data/MaskellSolidSolnPhase_valid.xml @@ -31,7 +31,13 @@ - 1. + 1., + 1., + 1., + 1., + 1., + 1., + 1., @@ -46,6 +52,12 @@ 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, + 6.94544000E+01, diff --git a/test/thermo/MaskellSolidSolnPhase_Test.cpp b/test/thermo/MaskellSolidSolnPhase_Test.cpp index 206ab20c0..75f2cb620 100644 --- a/test/thermo/MaskellSolidSolnPhase_Test.cpp +++ b/test/thermo/MaskellSolidSolnPhase_Test.cpp @@ -82,6 +82,7 @@ TEST_F(MaskellSolidSolnPhase_Test, construct_from_xml) const std::string valid_file("../data/MaskellSolidSolnPhase_valid.xml"); initializeTestPhaseWithXML(valid_file); MaskellSolidSolnPhase * maskell_phase = dynamic_cast(test_phase); + EXPECT_TRUE(maskell_phase != NULL); } TEST_F(MaskellSolidSolnPhase_Test, chem_potentials)