Fix Issue 209.

installShomateThermoFromXML now checks that
7 coefficients are supplied in the floatArray and
throws if that is not the case.

Also update MaskeLLSolidSolnPhase_Test xml files
to correctly contain 7 coefficients to not trigger
the newly added throw.
This commit is contained in:
Victor Brunini 2014-03-06 00:08:58 +00:00
parent 30bf2c806f
commit 32ce311bed
4 changed files with 37 additions and 2 deletions

View file

@ -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);

View file

@ -30,7 +30,13 @@
<thermo>
<Shomate Pref="1 bar" Tmax="800." Tmin="250.0">
<floatArray size="1">
1.
1.,
1.,
1.,
1.,
1.,
1.,
1.,
</floatArray>
</Shomate>
</thermo>
@ -45,6 +51,12 @@
<Shomate Pref="1 bar" Tmax="800." Tmin="250.0">
<floatArray size="1">
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
</floatArray>
</Shomate>
</thermo>

View file

@ -31,7 +31,13 @@
<thermo>
<Shomate Pref="1 bar" Tmax="800." Tmin="250.0">
<floatArray size="1">
1.
1.,
1.,
1.,
1.,
1.,
1.,
1.,
</floatArray>
</Shomate>
</thermo>
@ -46,6 +52,12 @@
<Shomate Pref="1 bar" Tmax="800." Tmin="250.0">
<floatArray size="1">
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
6.94544000E+01,
</floatArray>
</Shomate>
</thermo>

View file

@ -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<MaskellSolidSolnPhase *>(test_phase);
EXPECT_TRUE(maskell_phase != NULL);
}
TEST_F(MaskellSolidSolnPhase_Test, chem_potentials)