[Thermo] Deprecate "gas" mode of IdealSolnGasVPSS

This commit is contained in:
Ray Speth
2020-01-03 17:25:04 -05:00
parent 3a9f637753
commit 4082636dc3
7 changed files with 28 additions and 2 deletions

View File

@@ -538,6 +538,9 @@ The ideal gas model as
The ideal gas model, using variable pressure standard state methods as
`described here <https://cantera.org/documentation/dev/doxygen/html/dc/ddb/classCantera_1_1IdealSolnGasVPSS.html#details>`__.
.. deprecated:: 2.5
Use the ``ideal-gas`` model instead.
.. _sec-yaml-ideal-molal-solution:

View File

@@ -23,6 +23,9 @@ namespace Cantera
*
* An ideal solution or an ideal gas approximation of a phase. Uses variable
* pressure standard state methods for calculating thermodynamic properties.
*
* @deprecated "Gas" mode to be removed after Cantera 2.5. Use IdealGasPhase for
* ideal gas phases instead.
*/
class IdealSolnGasVPSS : public VPStandardStateTP
{
@@ -62,7 +65,11 @@ public:
}
//! Set this phase to represent an ideal gas
void setGasMode() { m_idealGas = true; }
void setGasMode() {
warn_deprecated("IdealSolnGasVPSS::setGasMode",
"To be removed after Cantera 2.5. Use class IdealGasPhase instead.");
m_idealGas = true;
}
//! Set this phase to represent an ideal liquid or solid solution
void setSolnMode() { m_idealGas = false; }

View File

@@ -1187,7 +1187,9 @@ class ctml2yamlTest(utilities.CanteraTest):
Path(self.test_data_dir).joinpath("pdss_hkft.xml"),
Path(self.test_work_dir).joinpath("pdss_hkft.yaml"),
)
# @todo Remove "gas" mode test after Cantera 2.5 - "gas" mode of class
# IdealSolnGasVPSS is deprecated
ct.suppress_deprecation_warnings()
for name in ["vpss_gas_pdss_hkft_phase", "vpss_soln_pdss_hkft_phase"]:
ctmlPhase = ct.ThermoPhase("pdss_hkft.xml", name=name)
yamlPhase = ct.ThermoPhase("pdss_hkft.yaml", name=name)
@@ -1200,6 +1202,7 @@ class ctml2yamlTest(utilities.CanteraTest):
self.assertEqual(ctmlPhase.element_names, yamlPhase.element_names)
self.assertEqual(ctmlPhase.species_names, yamlPhase.species_names)
self.checkThermo(ctmlPhase, yamlPhase, [300, 500])
ct.make_deprecation_warnings_fatal()
def test_lattice_solid(self):
ctml2yaml.convert(

View File

@@ -93,6 +93,8 @@ phases:
species: [KCl(l)]
thermo: Margules
# todo: Remove after Cantera 2.5 - the "gas" moode of class IdealSolnGasVPSS is
# deprecated.
- name: IdealSolnGas-gas
thermo: ideal-gas-VPSS
species: [{gas-species: [H2O, H2, O2]}]

View File

@@ -344,8 +344,11 @@ TEST_F(ConstructFromScratch, RedlichKwongMFTP_missing_coeffs)
EXPECT_THROW(p.setState_TP(300, 200e5), CanteraError);
}
//! @todo Remove after Cantera 2.5 - "gas" mode of IdealSolnGasVPSS is
//! deprecated
TEST_F(ConstructFromScratch, IdealSolnGasVPSS_gas)
{
suppress_deprecation_warnings();
IdealSolnGasVPSS p;
p.addSpecies(sH2O);
p.addSpecies(sH2);
@@ -367,6 +370,7 @@ TEST_F(ConstructFromScratch, IdealSolnGasVPSS_gas)
EXPECT_NEAR(p.temperature(), 479.929, 1e-3); // based on h2o2.cti
EXPECT_NEAR(p.moleFraction("H2O"), 0.01, 1e-4);
EXPECT_NEAR(p.moleFraction("H2"), 0.0, 1e-4);
make_deprecation_warnings_fatal();
}
TEST(PureFluidFromScratch, CarbonDioxide)

View File

@@ -234,9 +234,13 @@ TEST(ThermoFromYaml, IonsFromNeutral_fromString)
EXPECT_NEAR(mu[1], -2.88157316e+06, 1e-1);
}
//! @todo Remove after Cantera 2.5 - "gas" mode of IdealSolnGasVPSS is
//! deprecated
TEST(ThermoFromYaml, IdealSolnGas_gas)
{
suppress_deprecation_warnings();
auto thermo = newThermo("thermo-models.yaml", "IdealSolnGas-gas");
make_deprecation_warnings_fatal();
thermo->equilibrate("HP");
EXPECT_NEAR(thermo->temperature(), 479.929, 1e-3); // based on h2o2.cti
EXPECT_NEAR(thermo->moleFraction("H2O"), 0.01, 1e-4);

View File

@@ -9,12 +9,15 @@
using namespace std;
using namespace Cantera;
//! @todo Remove this test after Cantera 2.5 - "gas" mode of class
//! IdealSolnGasVPSS is deprecated
int main(int argc, char** argv)
{
#if defined(_MSC_VER) && _MSC_VER < 1900
_set_output_format(_TWO_DIGIT_EXPONENT);
#endif
try {
suppress_deprecation_warnings();
IdealSolnGasVPSS gg("silane.xml", "silane");
ThermoPhase* g = &gg;
cout.precision(4);