Skip to content

Commit

Permalink
Deprecate most XML-era model names
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Mar 14, 2023
1 parent 4e16561 commit fde6650
Show file tree
Hide file tree
Showing 63 changed files with 167 additions and 170 deletions.
4 changes: 2 additions & 2 deletions doc/sphinx/yaml/phases.rst
Expand Up @@ -929,7 +929,7 @@ Example::
- name: isotropic-electron-energy-plasma
thermo: plasma
kinetics: gas
transport: Ion
transport: ionized-gas
electron-energy-distribution:
type: isotropic
shape-factor: 2.0
Expand All @@ -938,7 +938,7 @@ Example::
- name: discretized-electron-energy-plasma
thermo: plasma
kinetics: gas
transport: Ion
transport: ionized-gas
electron-energy-distribution:
type: discretized
energy-levels: [0.0, 0.1, 1.0, 10.0]
Expand Down
5 changes: 3 additions & 2 deletions include/cantera/base/FactoryBase.h
Expand Up @@ -97,8 +97,9 @@ class Factory : public FactoryBase {
} else if (m_synonyms.count(name)) {
return m_synonyms.at(name);
} else if (m_deprecated_names.count(name)) {
warn_deprecated(name,
fmt::format("Use '{}' instead.", m_deprecated_names.at(name)));
warn_deprecated("FactoryBase::canonicalize",
fmt::format("Model name '{}' is deprecated. Use '{}' instead.",
name, m_deprecated_names.at(name)));
return m_deprecated_names.at(name);
} else {
throw CanteraError("Factory::canonicalize", "No such type: '{}'", name);
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/kinetics/EdgeKinetics.h
Expand Up @@ -28,7 +28,7 @@ class EdgeKinetics : public InterfaceKinetics
}

virtual std::string kineticsType() const {
return "Edge";
return "edge";
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/kinetics/GasKinetics.h
Expand Up @@ -34,7 +34,7 @@ class GasKinetics : public BulkKinetics
GasKinetics(ThermoPhase* thermo);

virtual std::string kineticsType() const {
return "Gas";
return "gas";
}

virtual void getThirdBodyConcentrations(double* concm);
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/kinetics/InterfaceKinetics.h
Expand Up @@ -75,7 +75,7 @@ class InterfaceKinetics : public Kinetics
virtual void resizeReactions();

virtual std::string kineticsType() const {
return "Surf";
return "surface";
}

//! Set the electric potential in the nth phase
Expand Down
2 changes: 2 additions & 0 deletions include/cantera/kinetics/Kinetics.h
Expand Up @@ -128,6 +128,8 @@ class Kinetics
//! Identifies the Kinetics manager type.
//! Each class derived from Kinetics should override this method to return
//! a meaningful identifier.
//! @since Starting in Cantera 3.0, the name returned by this method corresponds
//! to the canonical name used in the YAML input format.
virtual std::string kineticsType() const {
return "None";
}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/BinarySolutionTabulatedThermo.h
Expand Up @@ -174,7 +174,7 @@ class BinarySolutionTabulatedThermo : public IdealSolidSolnPhase
explicit BinarySolutionTabulatedThermo(const std::string& infile="", const std::string& id="");

virtual std::string type() const {
return "BinarySolutionTabulatedThermo";
return "binary-solution-tabulated";
}

virtual bool addSpecies(shared_ptr<Species> spec);
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/DebyeHuckel.h
Expand Up @@ -429,7 +429,7 @@ class DebyeHuckel : public MolalityVPSSTP
//! @{

virtual std::string type() const {
return "DebyeHuckel";
return "Debye-Huckel";
}

//! @}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/EdgePhase.h
Expand Up @@ -39,7 +39,7 @@ class EdgePhase : public SurfPhase
explicit EdgePhase(const std::string& infile="", const std::string& id="");

virtual std::string type() const {
return "Edge";
return "edge";
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/HMWSoln.h
Expand Up @@ -797,7 +797,7 @@ class HMWSoln : public MolalityVPSSTP
//! @{

virtual std::string type() const {
return "HMWSoln";
return "HMW-electrolyte";
}

//! @}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/IdealGasPhase.h
Expand Up @@ -262,7 +262,7 @@ class IdealGasPhase: public ThermoPhase
const std::string& id="");

virtual std::string type() const {
return "IdealGas";
return "ideal-gas";
}

virtual bool isIdeal() const {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/IdealMolalSoln.h
Expand Up @@ -80,7 +80,7 @@ class IdealMolalSoln : public MolalityVPSSTP
const std::string& id="");

virtual std::string type() const {
return "IdealMolalSoln";
return "ideal-molal-solution";
}

virtual bool isIdeal() const {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/IdealSolidSolnPhase.h
Expand Up @@ -57,7 +57,7 @@ class IdealSolidSolnPhase : public ThermoPhase
const std::string& id="");

virtual std::string type() const {
return "IdealSolidSoln";
return "ideal-condensed";
}

virtual bool isIdeal() const {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/LatticePhase.h
Expand Up @@ -193,7 +193,7 @@ class LatticePhase : public ThermoPhase
const std::string& id="");

virtual std::string type() const {
return "Lattice";
return "lattice";
}

virtual bool isCompressible() const {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/LatticeSolidPhase.h
Expand Up @@ -108,7 +108,7 @@ class LatticeSolidPhase : public ThermoPhase
LatticeSolidPhase() = default;

virtual std::string type() const {
return "LatticeSolid";
return "compound-lattice";
}

//! String indicating the mechanical phase of the matter in this Phase.
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/MetalPhase.h
Expand Up @@ -26,7 +26,7 @@ class MetalPhase : public ThermoPhase
// Overloaded methods of class ThermoPhase

virtual std::string type() const {
return "Metal";
return "electron-cloud";
}

virtual bool isCompressible() const {
Expand Down
2 changes: 2 additions & 0 deletions include/cantera/thermo/Phase.h
Expand Up @@ -140,6 +140,8 @@ class Phase
//! String indicating the thermodynamic model implemented. Usually
//! corresponds to the name of the derived class, less any suffixes such as
//! "Phase", TP", "VPSS", etc.
//! @since Starting in Cantera 3.0, the name returned by this method corresponds
//! to the canonical name used in the YAML input format.
virtual std::string type() const {
return "Phase";
}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/PureFluidPhase.h
Expand Up @@ -34,7 +34,7 @@ class PureFluidPhase : public ThermoPhase
PureFluidPhase() = default;

virtual std::string type() const {
return "PureFluid";
return "pure-fluid";
}

//! String indicating the mechanical phase of the matter in this Phase.
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/RedlichKisterVPSSTP.h
Expand Up @@ -243,7 +243,7 @@ class RedlichKisterVPSSTP : public GibbsExcessVPSSTP
const std::string& id="");

virtual std::string type() const {
return "RedlichKister";
return "Redlich-Kister";
}

//! @name Molar Thermodynamic Properties
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/RedlichKwongMFTP.h
Expand Up @@ -30,7 +30,7 @@ class RedlichKwongMFTP : public MixtureFugacityTP
const std::string& id="");

virtual std::string type() const {
return "RedlichKwong";
return "Redlich-Kwong";
}

//! @name Molar Thermodynamic properties
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/StoichSubstance.h
Expand Up @@ -100,7 +100,7 @@ class StoichSubstance : public SingleSpeciesTP
const std::string& id="");

virtual std::string type() const {
return "StoichSubstance";
return "fixed-stoichiometry";
}

virtual bool isCompressible() const {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/SurfPhase.h
Expand Up @@ -107,7 +107,7 @@ class SurfPhase : public ThermoPhase
explicit SurfPhase(const std::string& infile="", const std::string& id="");

virtual std::string type() const {
return "Surf";
return "ideal-surface";
}

virtual bool isCompressible() const {
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/IonGasTransport.h
Expand Up @@ -52,7 +52,7 @@ class IonGasTransport : public MixTransport
IonGasTransport() = default;

virtual std::string transportModel() const {
return "Ion";
return "ionized-gas";
}

virtual void init(ThermoPhase* thermo, int mode, int log_level);
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/MixTransport.h
Expand Up @@ -60,7 +60,7 @@ class MixTransport : public GasTransport
MixTransport() = default;

virtual std::string transportModel() const {
return (m_mode == CK_Mode) ? "CK_Mix" : "Mix";
return (m_mode == CK_Mode) ? "mixture-averaged-CK" : "Mix";
}

//! Return the thermal diffusion coefficients
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/MultiTransport.h
Expand Up @@ -33,7 +33,7 @@ class MultiTransport : public GasTransport
MultiTransport(ThermoPhase* thermo=0);

virtual std::string transportModel() const {
return (m_mode == CK_Mode) ? "CK_Multi" : "Multi";
return (m_mode == CK_Mode) ? "multicomponent-CK" : "Multi";
}

//! Return the thermal diffusion coefficients (kg/m/s)
Expand Down
3 changes: 2 additions & 1 deletion include/cantera/transport/Transport.h
Expand Up @@ -161,7 +161,8 @@ class Transport

//! Identifies the model represented by this Transport object. Each derived class
//! should override this method to return a meaningful identifier.
//! @since New in Cantera 3.0.
//! @since New in Cantera 3.0. The name returned by this method corresponds
//! to the canonical name used in the YAML input format.
virtual std::string transportModel() const {
return "None";
}
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/UnityLewisTransport.h
Expand Up @@ -28,7 +28,7 @@ class UnityLewisTransport : public MixTransport
UnityLewisTransport() = default;

virtual std::string transportModel() const {
return "UnityLewis";
return "unity-Lewis-number";
}

//! Returns the unity Lewis number approximation based diffusion
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/_onedim.pyx
Expand Up @@ -463,7 +463,7 @@ cdef class ReactingSurface1D(Boundary1D):
"""
warnings.warn("Method to be removed after Cantera 3.0; set 'Kinetics' when "
"instantiating 'ReactingSurface1D' instead.", DeprecationWarning)
if pystr(kin.kinetics.kineticsType()) not in ("Surf", "Edge"):
if pystr(kin.kinetics.kineticsType()) not in ("surface", "edge"):
raise TypeError('Kinetics object must be derived from '
'InterfaceKinetics.')
self.surf.setKinetics(kin.base.kinetics())
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/composite.py
Expand Up @@ -74,9 +74,9 @@ class Solution(Transport, Kinetics, ThermoPhase):
directly in Python::
spec = ct.Species.list_from_file("gri30.yaml")
spec_gas = ct.Solution(thermo='IdealGas', species=spec)
spec_gas = ct.Solution(thermo='ideal-gas', species=spec)
rxns = ct.Reaction.list_from_file("gri30.yaml", spec_gas)
gas = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
gas = ct.Solution(thermo='ideal-tas', kinetics='gas',
species=spec, reactions=rxns, name='my_custom_name')
where the ``thermo`` and ``kinetics`` keyword arguments are strings
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/kinetics.pyx
Expand Up @@ -810,7 +810,7 @@ cdef class InterfaceKinetics(Kinetics):
super().__init__(infile, name, *args, **kwargs)
if not kwargs.get("init", True):
return
if pystr(self.kinetics.kineticsType()) not in ("Surf", "Edge"):
if pystr(self.kinetics.kineticsType()) not in ("surface", "edge"):
raise TypeError("Underlying Kinetics class is not of the correct type.")
self._setup_phase_indices()

Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/liquidvapor.py
Expand Up @@ -46,10 +46,10 @@ class WaterWithTransport(_cantera.Transport, PureFluid):

if backend == 'Reynolds':
return WaterWithTransport('liquidvapor.yaml', 'water',
transport_model='Water')
transport_model='water')
if backend == 'IAPWS95':
return WaterWithTransport('liquidvapor.yaml', 'liquid-water-IAPWS95',
transport_model='Water')
transport_model='water')

raise KeyError("Unknown backend '{}'".format(backend))

Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/thermo.pyx
Expand Up @@ -59,7 +59,7 @@ cdef class Species:
tran = ct.GasTransportData()
tran.set_customary_units('nonlinear', 3.75, 141.40, 0.0, 2.60, 13.00)
ch4.transport = tran
gas = ct.Solution(thermo='IdealGas', species=[ch4])
gas = ct.Solution(thermo='ideal-gas', species=[ch4])
The static methods `list_from_file` and `list_from_yaml` can be used to create
`Species` objects from existing definitions in the YAML format. Either of the
Expand Down Expand Up @@ -1874,7 +1874,7 @@ cdef class InterfacePhase(ThermoPhase):
def __cinit__(self, *args, **kwargs):
if not kwargs.get("init", True):
return
if pystr(self.thermo.type()) not in ("Surf", "Edge"):
if pystr(self.thermo.type()) not in ("ideal-surface", "edge"):
raise TypeError('Underlying ThermoPhase object is of the wrong type.')
self.surf = <CxxSurfPhase*>(self.thermo)

Expand Down
2 changes: 1 addition & 1 deletion interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m
Expand Up @@ -9,7 +9,7 @@
% mixture, and false (0) otherwise.
%

if strcmp(eosType(tp), 'IdealGas')
if strcmp(eosType(tp), 'ideal-gas')
v = 1;
else
v = 0;
Expand Down
2 changes: 1 addition & 1 deletion samples/python/kinetics/blowers_masel.py
Expand Up @@ -36,7 +36,7 @@
r3 = ct.Reaction({"H":1, "CH4":1}, {"CH3":1, "H2":1},
ct.BlowersMaselRate(3.87e1, 2.7, 6260*1000*4.184, 1e9))

gas = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
gas = ct.Solution(thermo='ideal-gas', kinetics='gas',
species=ct.Solution('gri30.yaml').species(), reactions=[r1, r2, r3])

gas.TP = 300, ct.one_atm
Expand Down
2 changes: 1 addition & 1 deletion samples/python/kinetics/mechanism_reduction.py
Expand Up @@ -64,7 +64,7 @@
species = [gas.species(name) for name in species_names]

# create the new reduced mechanism
gas2 = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
gas2 = ct.Solution(thermo='ideal-gas', kinetics='gas',
species=species, reactions=reactions)

# save the reduced mechanism for later use
Expand Down
2 changes: 1 addition & 1 deletion samples/python/onedim/ion_burner_flame.py
Expand Up @@ -24,7 +24,7 @@
f.set_refine_criteria(ratio=3.0, slope=0.05, curve=0.1)
f.show_solution()

f.transport_model = 'Ion'
f.transport_model = 'ionized-gas'
f.solve(loglevel, auto=True)
f.solve(loglevel=loglevel, stage=2, enable_energy=True)

Expand Down
10 changes: 1 addition & 9 deletions src/equil/vcs_VolPhase.cpp
Expand Up @@ -572,15 +572,7 @@ void vcs_VolPhase::setPtrThermoPhase(ThermoPhase* tp_ptr)
if (nsp == 1) {
m_isIdealSoln = true;
} else {
std::string eos = TP_ptr->type();
if (eos == "IdealGas" || eos == "ConstDensity" || eos == "Surf"
|| eos == "Metal" || eos == "StoichSubstance"
|| eos == "LatticeSolid"
|| eos == "Lattice" || eos == "Edge" || eos == "IdealSolidSoln") {
m_isIdealSoln = true;
} else {
m_isIdealSoln = false;
};
m_isIdealSoln = TP_ptr->isIdeal();
}
}

Expand Down
12 changes: 5 additions & 7 deletions src/equil/vcs_solve.cpp
Expand Up @@ -153,7 +153,7 @@ VCS_SOLVE::VCS_SOLVE(MultiPhase* mphase, int printLvl) :

// Query Cantera for the equation of state type of the current phase.
std::string eos = tPhase->type();
bool gasPhase = (eos == "IdealGas");
bool gasPhase = (eos == "ideal-gas");

// Find out the number of species in the phase
size_t nSpPhase = tPhase->nSpecies();
Expand Down Expand Up @@ -184,15 +184,13 @@ VCS_SOLVE::VCS_SOLVE(MultiPhase* mphase, int printLvl) :
VolPhase->p_activityConvention = tPhase->activityConvention();

// Assign the value of eqn of state. Handle conflicts here.
if (eos == "IdealGas") {
if (eos == "ideal-gas") {
VolPhase->m_eqnState = VCS_EOS_IDEAL_GAS;
} else if (eos == "ConstDensity") {
VolPhase->m_eqnState = VCS_EOS_CONSTANT;
} else if (eos == "StoichSubstance") {
} else if (eos == "fixed-stoichiometry") {
VolPhase->m_eqnState = VCS_EOS_STOICH_SUB;
} else if (eos == "IdealSolidSoln") {
} else if (eos == "ideal-condensed") {
VolPhase->m_eqnState = VCS_EOS_IDEAL_SOLN;
} else if (eos == "Surf" || eos == "Edge") {
} else if (tPhase->nDim() != 3) {
throw CanteraError("VCS_SOLVE::VCS_SOLVE",
"Surface/edge phase not handled yet.");
} else {
Expand Down

0 comments on commit fde6650

Please sign in to comment.