Skip to content

Commit

Permalink
Standardize on lowercase 'none' as empty model name
Browse files Browse the repository at this point in the history
Deprecate 'None'
  • Loading branch information
speth authored and ischoegl committed Mar 14, 2023
1 parent 23ebd13 commit b076ed9
Show file tree
Hide file tree
Showing 34 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion include/cantera/kinetics/Kinetics.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Kinetics
//! @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";
return "none";
}

//! Finalize Kinetics object and associated objects
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/thermo/ThermoPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ThermoPhase : public Phase
//! @{

virtual std::string type() const {
return "None";
return "none";
}

//! Boolean indicating whether phase is ideal
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/Transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Transport
//! @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";
return "none";
}

//! Identifies the Transport object type. Each derived class should override
Expand Down
6 changes: 3 additions & 3 deletions interfaces/cython/cantera/reactor.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cdef class ReactorBase:
"""
Common base class for reactors and reservoirs.
"""
reactor_type = "None"
reactor_type = "none"
def __cinit__(self, *args, **kwargs):
self.rbase = newReactor(stringify(self.reactor_type))

Expand Down Expand Up @@ -760,7 +760,7 @@ cdef class WallBase:
"""
Common base class for walls.
"""
wall_type = "None"
wall_type = "none"
def __cinit__(self, *args, **kwargs):
self.wall = newWall(stringify(self.wall_type))

Expand Down Expand Up @@ -944,7 +944,7 @@ cdef class FlowDevice:
across a FlowDevice, and the pressure difference equals the difference in
pressure between the upstream and downstream reactors.
"""
flowdevice_type = "None"
flowdevice_type = "none"
def __cinit__(self, *args, **kwargs):
self.dev = newFlowDevice(stringify(self.flowdevice_type))

Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/solutionbase.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ cdef class _SolutionBase:
raise TypeError("Cannot mix ThermoPhase objects and phase names")

if transport is None or not isinstance(self, Transport):
transport = "None"
transport = "none"
cdef string cxx_transport = stringify(transport)

# Parse input in C++
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/yaml2ck.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,9 @@ def convert(
solution = ct.Solution(solution, phase_name)

# NOTE: solution.transport_model returns back a string. If no transport model is
# present, the string is "None". We guard here against a future API change to
# present, the string is "none". We guard here against a future API change to
# return the singleton None.
if solution.transport_model in ("None", None):
if solution.transport_model in ("none", None):
transport_exists = False
else:
transport_exists = True
Expand Down
4 changes: 2 additions & 2 deletions interfaces/matlab/toolbox/@Solution/Solution.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
% included in ``input.yaml``, it will be included in the :mat:func:`Solution`
% instance with the default transport modeling as set
% in the input file. To specify the transport modeling, set the input
% argument ``trans`` to one of ``'default'``, ``'None'``, or specific transport model
% argument ``trans`` to one of ``'default'``, ``'none'``, or specific transport model
% such as ``'mixture-averaged'`` or ``'multicomponent'``.
% In this case, the phase name must be specified as well. Alternatively,
% change the ``transport`` field in the YAML file before loading the phase. The
Expand All @@ -39,7 +39,7 @@
% Optional unless ``trans`` is specified. Name of the phase to
% import as specified in the YAML file.
% :param trans:
% String, transport modeling. Possible values are ``'default'``, ``'None'``,
% String, transport modeling. Possible values are ``'default'``, ``'none'``,
% or a specific transport model name. If not specified, ``'default'`` is used.
% :return:
% Instance of class :mat:func:`Solution`
Expand Down
2 changes: 1 addition & 1 deletion interfaces/matlab/toolbox/@Transport/Transport.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
% Instance of class :mat:func:`ThermoPhase`
% :param model:
% String indicating the transport model to use. Possible values
% are ``'default'``, ``'None'``, ``'mixture-averaged'``, and ``'multicomponent'``,
% are ``'default'``, ``'none'``, ``'mixture-averaged'``, and ``'multicomponent'``,
% among others. Optional.
% :param loglevel:
% Level of diagnostic logging. Default if not specified is 4.
Expand Down
4 changes: 2 additions & 2 deletions interfaces/matlab/toolbox/GRI30.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
% g1 = GRI30 % mixture-averaged transport properties
% g2 = GRI30('mixture-averaged') % mixture-averaged transport properties
% g3 = GRI30('multicomponent') % miulticomponent transport properties
% g4 = GRI30('None') % no transport properties
% g4 = GRI30('none') % no transport properties
%
% :param tr:
% Transport modeling, ``'None'``, ``'mixture-averaged'``, or ``'multicomponent'``
% Transport modeling, ``'none'``, ``'mixture-averaged'``, or ``'multicomponent'``
% :return:
% Instance of class :mat:func:`Solution`
%
Expand Down
4 changes: 2 additions & 2 deletions samples/cxx/combustor/combustor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using namespace Cantera;
void runexample()
{
// use reaction mechanism GRI-Mech 3.0
auto sol = newSolution("gri30.yaml", "gri30", "None");
auto sol = newSolution("gri30.yaml", "gri30", "none");
auto gas = sol->thermo();

// create a reservoir for the fuel inlet, and set to pure methane.
Expand All @@ -33,7 +33,7 @@ void runexample()
fuel_in.insert(sol);
double fuel_mw = gas->meanMolecularWeight();

auto air = newSolution("air.yaml", "air", "None");
auto air = newSolution("air.yaml", "air", "none");
double air_mw = air->thermo()->meanMolecularWeight();

// create a reservoir for the air inlet
Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/custom/custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ReactorODEs : public FuncEval {

int main() {
/* -------------------- CREATE GAS & SPECIFY STATE -------------------- */
auto sol = newSolution("h2o2.yaml", "ohmech", "None");
auto sol = newSolution("h2o2.yaml", "ohmech", "none");
auto gas = sol->thermo();
gas->setState_TPX(1001, OneAtm, "H2:2, O2:1, N2:4");

Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/jacobian/derivative_speed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void timeit_matrix(Eigen::SparseMatrix<double> (Kinetics::*function)(),
void benchmark(const std::string& mech, const std::string& phase,
const std::string& fuel)
{
auto sol = newSolution(mech, phase, "None");
auto sol = newSolution(mech, phase, "none");
auto& gas = *(sol->thermo());
auto& kin = *(sol->kinetics());

Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/kinetics1/kinetics1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int kinetics1(int np, void* p)
" mixture \nbeginning at T = 1001 K and P = 1 atm." << endl;

// create an ideal gas mixture that corresponds to OH submech from GRI-Mech 3.0
auto sol = newSolution("h2o2.yaml", "ohmech", "None");
auto sol = newSolution("h2o2.yaml", "ohmech", "none");
auto gas = sol->thermo();

// set the state
Expand Down
2 changes: 1 addition & 1 deletion samples/cxx/openmp_ignition/openmp_ignition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void run()
// Create and link the Cantera objects for each thread. This step should be
// done in serial
for (int i = 0; i < nThreads; i++) {
auto sol = newSolution("gri30.yaml", "gri30", "None");
auto sol = newSolution("gri30.yaml", "gri30", "none");
sols.emplace_back(sol);
reactors.emplace_back(new IdealGasConstPressureReactor());
nets.emplace_back(new ReactorNet());
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/ignite_hp.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function ignite_hp(gas)
help ignite_hp

if nargin == 0
gas = Solution('h2o2.yaml', 'ohmech', 'None');
gas = Solution('h2o2.yaml', 'ohmech', 'none');
end

mw = molecularWeights(gas);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/ignite_uv.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function ignite_uv(gas)
help ignite_uv

if nargin == 0
gas = Solution('h2o2.yaml', 'ohmech', 'None');
gas = Solution('h2o2.yaml', 'ohmech', 'none');
end

mw = molecularWeights(gas);
Expand Down
4 changes: 2 additions & 2 deletions samples/matlab/reactor1.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function reactor1(g)
if nargin == 1
gas = g;
else
gas = Solution('h2o2.yaml', 'ohmech', 'None');
gas = Solution('h2o2.yaml', 'ohmech', 'none');
end

P = oneatm;
Expand All @@ -27,7 +27,7 @@ function reactor1(g)
r = IdealGasReactor(gas);

% create a reservoir to represent the environment
a = Solution('air.yaml','air','None');
a = Solution('air.yaml','air','none');
set(a,'P',P)
env = Reservoir(a);

Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/reactor2.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function reactor2(g)
if nargin == 1
gas = g;
else
gas = Solution('h2o2.yaml', 'ohmech', 'None');
gas = Solution('h2o2.yaml', 'ohmech', 'none');
end

% set the initial conditions
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/surfreactor.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
setInitialVolume(r, 1.0e-6)

% create a reservoir to represent the environment
a = Solution('air.yaml','air','None');
a = Solution('air.yaml','air','none');
set(a,'T',t,'P',oneatm);
env = Reservoir(a);

Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/tut2.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
% it has already processed and doesn't need to read them in again:

t0 = cputime;
gas1b = Solution('gri30.yaml', 'gas', 'None');
gas1b = Solution('gri30.yaml', 'gas', 'none');
msg = sprintf('time to create gas1b: %f', cputime - t0)

% Since GRI-Mech is a rather small mechanism, there might not be much
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/tut4.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
% To set a gas mixture to a state of chemical equilibrium, use the
% 'equilibrate' method.
%
g = GRI30('None');
g = GRI30('none');
set(g,'T',1200.0,'P',oneatm,'X','CH4:0.95,O2:2,N2:7.52')
equilibrate(g,'TP')

Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/tut5.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

help tut5

g = GRI30('None');
g = GRI30('none');
set(g,'T',1500,'P',oneatm,'X',ones(nSpecies(g),1));

% Methods are provided that compute many quantities of interest for
Expand Down
2 changes: 1 addition & 1 deletion src/base/Solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ AnyMap Solution::parameters(bool withInput) const
}
if (!m_transport) {
out["transport"] = empty;
} else if (m_transport->transportModel() == "None") {
} else if (m_transport->transportModel() == "none") {
out["transport"] = empty;
} else {
out.update(m_transport->parameters());
Expand Down
6 changes: 3 additions & 3 deletions src/kinetics/KineticsFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ std::mutex KineticsFactory::kinetics_mutex;

KineticsFactory::KineticsFactory() {
reg("none", []() { return new Kinetics(); });
addAlias("none", "Kinetics");
addAlias("none", "None");
addDeprecatedAlias("none", "Kinetics");
addDeprecatedAlias("none", "None");
reg("gas", []() { return new GasKinetics(); });
addDeprecatedAlias("gas", "gaskinetics");
addDeprecatedAlias("gas", "Gas");
Expand Down Expand Up @@ -186,7 +186,7 @@ void addReactions(Kinetics& kin, const AnyMap& phaseNode, const AnyMap& rootNode
rules.push_back(item.begin()->second.asString());
}
}
} else if (kin.kineticsType() != "None") {
} else if (kin.kineticsType() != "none") {
if (!phaseNode.hasKey("kinetics")) {
// Do nothing - default surface or edge kinetics require separate detection
// while not adding reactions
Expand Down
2 changes: 1 addition & 1 deletion src/oneD/IonFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ IonFlow::IonFlow(shared_ptr<Solution> sol, const std::string& id, size_t points)
m_id = id;
m_kin = m_solution->kinetics().get();
m_trans = m_solution->transport().get();
if (m_trans->transportModel() == "None") {
if (m_trans->transportModel() == "none") {
// @deprecated
warn_deprecated("IonFlow",
"An appropriate transport model\nshould be set when instantiating the "
Expand Down
10 changes: 5 additions & 5 deletions src/oneD/StFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ StFlow::StFlow(shared_ptr<Solution> sol, const std::string& id, size_t points)
m_id = id;
m_kin = m_solution->kinetics().get();
m_trans = m_solution->transport().get();
if (m_trans->transportModel() == "None") {
if (m_trans->transportModel() == "none") {
// @deprecated
warn_deprecated("StFlow",
"An appropriate transport model\nshould be set when instantiating the "
Expand Down Expand Up @@ -162,8 +162,8 @@ void StFlow::setTransport(shared_ptr<Transport> trans)
throw CanteraError("StFlow::setTransport", "Unable to set empty transport.");
}
m_trans = trans.get();
if (m_trans->transportModel() == "None") {
throw CanteraError("StFlow::setTransport", "Invalid Transport model 'None'.");
if (m_trans->transportModel() == "none") {
throw CanteraError("StFlow::setTransport", "Invalid Transport model 'none'.");
}
m_do_multicomponent = (m_trans->transportModel() == "multicomponent" ||
m_trans->transportModel() == "multicomponent-CK");
Expand Down Expand Up @@ -245,9 +245,9 @@ void StFlow::setTransport(Transport& trans)
warn_deprecated("StFlow::setTransport(Transport&)", "To be removed after"
" Cantera 3.0. Replaced by setTransport(shared_ptr<Transport>).");
m_trans = &trans;
if (m_trans->transportModel() == "None") {
if (m_trans->transportModel() == "none") {
throw CanteraError("StFlow::setTransport",
"Invalid Transport model 'None'.");
"Invalid Transport model 'none'.");
}
m_do_multicomponent = (m_trans->transportModel() == "multicomponent" ||
m_trans->transportModel() == "multicomponent-CK");
Expand Down
2 changes: 1 addition & 1 deletion src/thermo/ThermoFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ThermoFactory::ThermoFactory()
{
reg("none", []() { return new ThermoPhase(); });
addDeprecatedAlias("none", "ThermoPhase");
addAlias("none", "None");
addDeprecatedAlias("none", "None");
reg("ideal-gas", []() { return new IdealGasPhase(); });
addDeprecatedAlias("ideal-gas", "IdealGas");
reg("plasma", []() { return new PlasmaPhase(); });
Expand Down
4 changes: 2 additions & 2 deletions src/thermo/ThermoPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,9 @@ void ThermoPhase::getdlnActCoeffdlnN_numderiv(const size_t ld, doublereal* const

std::string ThermoPhase::report(bool show_thermo, doublereal threshold) const
{
if (type() == "None") {
if (type() == "none") {
throw NotImplementedError("ThermoPhase::report",
"Not implemented for thermo model 'None'");
"Not implemented for thermo model 'none'");
}

fmt::memory_buffer b;
Expand Down
8 changes: 4 additions & 4 deletions src/transport/TransportFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ std::mutex TransportFactory::transport_mutex;
TransportFactory::TransportFactory()
{
reg("none", []() { return new Transport(); });
addAlias("none", "Transport");
addAlias("none", "None");
addAlias("none", "");
addDeprecatedAlias("none", "Transport");
addDeprecatedAlias("none", "None");
addDeprecatedAlias("none", "");
reg("unity-Lewis-number", []() { return new UnityLewisTransport(); });
addDeprecatedAlias("unity-Lewis-number", "UnityLewis");
reg("mixture-averaged", []() { return new MixTransport(); });
Expand Down Expand Up @@ -98,7 +98,7 @@ Transport* TransportFactory::newTransport(const std::string& transportModel,

Transport* TransportFactory::newTransport(ThermoPhase* phase, int log_level)
{
std::string transportModel = "None";
std::string transportModel = "none";
AnyMap& input = phase->input();
if (input.hasKey("transport")) {
transportModel = input["transport"].asString();
Expand Down
Loading

0 comments on commit b076ed9

Please sign in to comment.