Remove deprecated class GasKinetics

This commit is contained in:
Ray Speth
2023-08-24 23:49:42 -04:00
committed by Ingmar Schoegl
parent 79fe628510
commit 04d37a9737
7 changed files with 18 additions and 96 deletions

View File

@@ -102,7 +102,8 @@ and optionally reactions that can take place in that phase. The fields of a
are:
- ``none``
- ``gas`` (:ct:`details <GasKinetics>`)
- ``bulk`` (:ct:`details <BulkKinetics>`)
- ``gas`` (alias for ``bulk``)
- ``surface`` (:ct:`details <InterfaceKinetics>`)
- ``edge`` (:ct:`details <EdgeKinetics>`)

View File

@@ -1,73 +0,0 @@
/**
* @file GasKinetics.h
*/
// This file is part of Cantera. See License.txt in the top-level directory or
// at https://cantera.org/license.txt for license and copyright information.
#ifndef CT_GASKINETICS_H
#define CT_GASKINETICS_H
#include "BulkKinetics.h"
#include "Reaction.h"
#ifndef CT_SKIP_DEPRECATION_WARNINGS
#pragma message("warning: GasKinetics.h and class GasKinetics are deprecated and will " \
"be removed after Cantera 3.0. Replace with class BulkKinetics.")
#endif
namespace Cantera
{
/**
* Kinetics manager for elementary gas-phase chemistry. This kinetics manager
* implements standard mass-action reaction rate expressions for low-density
* gases.
* @ingroup kineticsmgr
* @deprecated Replace with BulkKinetics. To be removed after %Cantera 3.0.
*/
class GasKinetics : public BulkKinetics
{
public:
//! Constructor.
GasKinetics() {}
//! @deprecated To be removed after %Cantera 3.0; code base only uses default.
GasKinetics(ThermoPhase* thermo) : GasKinetics() {
warn_deprecated("GasKinetics::GasKinetics(ThermoPhase*)",
"To be removed after Cantera 3.0. Use default constructor instead.");
addPhase(*thermo);
}
string kineticsType() const override {
return "gas";
}
//! Update temperature-dependent portions of reaction rates and falloff
//! functions.
virtual void update_rates_T() {
warn_deprecated("GasKinetics::update_rates_T",
"Class GasKinetics has been merged into class BulkKinetics, and the "
"update_rates_T() method is now part of updateROP(). Class GasKinetics "
"will be removed after Cantera 3.0.");
updateROP();
}
//! Update properties that depend on concentrations.
//! Currently the enhanced collision partner concentrations are updated
//! here, as well as the pressure-dependent portion of P-log and Chebyshev
//! reactions.
virtual void update_rates_C() {
warn_deprecated("GasKinetics::update_rates_C",
"Class GasKinetics has been merged into class BulkKinetics, and the "
"update_rates_T() method is now part of updateROP(). Class GasKinetics "
"will be removed after Cantera 3.0.");
updateROP();
}
};
}
#endif

View File

@@ -77,12 +77,11 @@ class AnyMap;
//! class overloads the virtual methods of Kinetics to implement a particular
//! kinetics model.
//!
//! For example, class GasKinetics implements reaction rate expressions
//! appropriate for homogeneous reactions in ideal gas mixtures, and class
//! InterfaceKinetics implements expressions appropriate for heterogeneous
//! mechanisms at interfaces, including how to handle reactions involving
//! charged species of phases with different electric potentials --- something
//! that class GasKinetics doesn't deal with at all.
//! For example, class BulkKinetics implements reaction rate expressions appropriate for
//! homogeneous reactions, and class InterfaceKinetics implements expressions
//! appropriate for heterogeneous mechanisms at interfaces, including how to handle
//! reactions involving charged species of phases with different electric potentials ---
//! something that class BulkKinetics doesn't deal with at all.
//!
//! Many of the methods of class Kinetics write into arrays the values of some
//! quantity for each species, for example the net production rate. These

View File

@@ -435,7 +435,7 @@ cdef class Kinetics(_SolutionBase):
"""
Property setting behavior of derivative evaluation.
For ``GasKinetics``, the following keyword/value pairs are supported:
For :ct:`BulkKinetics`, the following keyword/value pairs are supported:
- ``skip-third-bodies`` (boolean) ... if `False` (default), third body
concentrations are considered for the evaluation of derivatives

View File

@@ -7,16 +7,12 @@
#include "cantera/kinetics/KineticsFactory.h"
#include "cantera/kinetics/BulkKinetics.h"
#define CT_SKIP_DEPRECATION_WARNINGS
#include "cantera/kinetics/GasKinetics.h" // @todo Remove after Cantera 3.0
#include "cantera/kinetics/InterfaceKinetics.h"
#include "cantera/kinetics/EdgeKinetics.h"
#include "cantera/kinetics/Reaction.h"
#include "cantera/thermo/ThermoPhase.h"
#include "cantera/base/stringUtils.h"
#include "cantera/base/Solution.h"
#include <boost/algorithm/string.hpp>
namespace Cantera
@@ -30,10 +26,9 @@ KineticsFactory::KineticsFactory() {
addDeprecatedAlias("none", "Kinetics");
addDeprecatedAlias("none", "None");
reg("bulk", []() { return new BulkKinetics(); });
// @todo After Cantera 3.0, "gas" should be an alias for "bulk"
reg("gas", []() { return new GasKinetics(); });
addDeprecatedAlias("gas", "gaskinetics");
addDeprecatedAlias("gas", "Gas");
addAlias("bulk", "gas");
addDeprecatedAlias("bulk", "gaskinetics");
addDeprecatedAlias("bulk", "Gas");
reg("surface", []() { return new InterfaceKinetics(); });
addAlias("surface", "interface");
addDeprecatedAlias("surface", "Surf");

View File

@@ -546,7 +546,7 @@ TEST(Reaction, PythonExtensibleRate)
EXPECT_DOUBLE_EQ(kf[0], 3.14 * 300 * 300);
}
TEST(Kinetics, GasKineticsFromYaml1)
TEST(Kinetics, BulkKineticsFromYaml1)
{
AnyMap infile = AnyMap::fromYamlFile("ideal-gas.yaml");
auto& phaseNode = infile["phases"].getMapWhere("name", "simple-kinetics");
@@ -561,7 +561,7 @@ TEST(Kinetics, GasKineticsFromYaml1)
EXPECT_DOUBLE_EQ(rate->preExponentialFactor(), 2.7e10);
}
TEST(Kinetics, GasKineticsFromYaml2)
TEST(Kinetics, BulkKineticsFromYaml2)
{
AnyMap infile = AnyMap::fromYamlFile("ideal-gas.yaml");
auto& phaseNode = infile["phases"].getMapWhere("name", "remote-kinetics");
@@ -682,7 +682,7 @@ TEST(KineticsFromYaml, KineticsModelWithReactionsNone1)
{
auto soln = newSolution("phase-reaction-spec1.yaml",
"kinetics-reactions-none");
EXPECT_EQ(soln->kinetics()->kineticsType(), "gas");
EXPECT_EQ(soln->kinetics()->kineticsType(), "bulk");
EXPECT_EQ(soln->kinetics()->nReactions(), (size_t) 0);
}
@@ -690,7 +690,7 @@ TEST(KineticsFromYaml, KineticsModelWithReactionsNone2)
{
auto soln = newSolution("phase-reaction-spec2.yaml",
"kinetics-reactions-none");
EXPECT_EQ(soln->kinetics()->kineticsType(), "gas");
EXPECT_EQ(soln->kinetics()->kineticsType(), "bulk");
EXPECT_EQ(soln->kinetics()->nReactions(), (size_t) 0);
}
@@ -727,7 +727,7 @@ TEST(KineticsFromYaml, KineticsModelWithoutReactionsField)
{
auto soln = newSolution("phase-reaction-spec2.yaml",
"kinetics-noreactions");
EXPECT_EQ(soln->kinetics()->kineticsType(), "gas");
EXPECT_EQ(soln->kinetics()->kineticsType(), "bulk");
EXPECT_EQ(soln->kinetics()->nReactions(), (size_t) 1);
}

View File

@@ -1115,7 +1115,7 @@ class TestSolutionSerialization(utilities.CanteraTest):
data = gas.input_data
self.assertEqual(data['name'], 'ohmech')
self.assertEqual(data['thermo'], 'ideal-gas')
self.assertEqual(data['kinetics'], 'gas')
self.assertEqual(data['kinetics'], 'bulk')
self.assertEqual(data['transport'], 'mixture-averaged')
def test_input_data_user_modifications(self):