Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellanous small improvements #1140

Merged
merged 7 commits into from
Nov 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jobs:
# See https://github.com/conda-forge/boost-cpp-feedstock/issues/41 for why we
# use boost-cpp rather than boost from conda-forge
run: |
conda install -q sundials=${{ matrix.sundials-ver }} scons numpy ruamel_yaml \
conda install -q sundials=${{ matrix.sundials-ver }} scons numpy ruamel.yaml \
cython boost-cpp fmt eigen yaml-cpp h5py pandas libgomp openblas
- name: Build Cantera
run: |
Expand Down
4 changes: 2 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1300,11 +1300,11 @@ if env['python_package'] != 'none':
if check_for_ruamel_yaml:
ru_script = textwrap.dedent("""\
try:
import ruamel_yaml as yaml
from ruamel import yaml
print(yaml.__version__)
except ImportError as ru_err:
try:
from ruamel import yaml
import ruamel_yaml as yaml
print(yaml.__version__)
except ImportError as ru_err_2:
print('0.0.0')
Expand Down
2 changes: 1 addition & 1 deletion data/inputs/ptcombust.cti
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#**** *
#***********************************************************************
#
# Ref:- 1.) Deutschman et al., 26th Symp. (Intl.) on Combustion,1996
# Ref:- 1.) Deutschmann et al., 26th Symp. (Intl.) on Combustion,1996
# pp. 1747-1754
#----------------------------------------------------------------------
#
Expand Down
2 changes: 1 addition & 1 deletion data/ptcombust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ description: |-
**** *
***********************************************************************

Ref:- 1.) Deutschman et al., 26th Symp. (Intl.) on Combustion, 1996
Ref:- 1.) Deutschmann et al., 26th Symp. (Intl.) on Combustion, 1996
pp. 1747-1754
-----------------------------------------------------------------------

Expand Down
10 changes: 10 additions & 0 deletions doc/sphinx/cython/thermo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,21 @@ ConstantCp
.. autoclass:: ConstantCp(T_low, T_high, P_ref, coeffs)
:no-undoc-members:

Mu0Poly
^^^^^^^
.. autoclass:: Mu0Poly(T_low, T_high, P_ref, coeffs)
:no-undoc-members:

NasaPoly2
^^^^^^^^^
.. autoclass:: NasaPoly2(T_low, T_high, P_ref, coeffs)
:no-undoc-members:

Nasa9PolyMultiTempRegion
^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: Nasa9PolyMultiTempRegion(T_low, T_high, P_ref, coeffs)
:no-undoc-members:

ShomatePoly2
^^^^^^^^^^^^
.. autoclass:: ShomatePoly2(T_low, T_high, P_ref, coeffs)
Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx/yaml/reactions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The fields common to all ``reaction`` entries are:
must be separated by a space.

Reversible reactions may be written using ``<=>`` or ``=`` to separate
reactants and products. Irreversible reacions are written using ``=>``.
reactants and products. Irreversible reactions are written using ``=>``.

``type``
A string specifying the type of reaction or rate coefficient
Expand Down Expand Up @@ -292,7 +292,7 @@ Example::
``interface``
-------------

A reaction occuring on a surface between two bulk phases, or along an edge
A reaction occurring on a surface between two bulk phases, or along an edge
at the intersection of two surfaces, as
`described here <https://cantera.org/science/reactions.html#sec-surface>`__.

Expand Down
2 changes: 1 addition & 1 deletion include/cantera/base/Units.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Units

//! Raise these Units to a power, changing both the conversion factor and
//! the dimensions of these Units.
Units pow(double expoonent) const;
Units pow(double exponent) const;

bool operator==(const Units& other) const;

Expand Down
4 changes: 2 additions & 2 deletions include/cantera/equil/MultiPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ std::ostream& operator<<(std::ostream& s, MultiPhase& x);
* @param[in] orderVectorElements Order vector for the elements. The element
* rows in the formula matrix are rearranged according to this vector.
* @param[in] orderVectorSpecies Order vector for the species. The species are
* rearranged according to this formula. The first nCompoments of this
* rearranged according to this formula. The first nComponents of this
* vector contain the calculated species components on exit.
* @param[in] doFormRxn If true, the routine calculates the formation
* reaction matrix based on the calculated component species. If
Expand Down Expand Up @@ -748,7 +748,7 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
std::vector<size_t>& orderVectorElements);

//! External int that is used to turn on debug printing for the
//! BasisOptimze program.
//! BasisOptimize program.
/*!
* Set this to 1 if you want debug printing from BasisOptimize.
*/
Expand Down
4 changes: 2 additions & 2 deletions include/cantera/kinetics/Kinetics.h
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ class Kinetics
* concentrations (no change to legacy behavior). After Cantera 2.6,
* results will no longer include third-body concentrations and be
* consistent with conventional definitions (see Eq. 9.75 in
* Kee, Coltrin and Glarborg, 'Chemically eacting Flow', Wiley
* Kee, Coltrin and Glarborg, 'Chemically Reacting Flow', Wiley
* Interscience, 2003).
* For new behavior, set 'Cantera::use_legacy_rate_constants(false)'.
*/
Expand All @@ -706,7 +706,7 @@ class Kinetics
* concentrations (no change to legacy behavior). After Cantera 2.6,
* results will no longer include third-body concentrations and be
* consistent with conventional definitions (see Eq. 9.75 in
* Kee, Coltrin and Glarborg, 'Chemically eacting Flow', Wiley
* Kee, Coltrin and Glarborg, 'Chemically Reacting Flow', Wiley
* Interscience, 2003).
* For new behavior, set 'Cantera::use_legacy_rate_constants(false)'.
*/
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/numerics/FuncEval.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class FuncEval
// If true, errors are accumulated in m_errors. Otherwise, they are printed
bool m_suppress_errors;

//! Errors occuring during function evaluations
//! Errors occurring during function evaluations
std::vector<std::string> m_errors;
};

Expand Down
4 changes: 2 additions & 2 deletions include/cantera/numerics/ResidJacEval.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum ResidEval_Type_Enum {
Base_ResidEval = 0,
//! Base residual calculation for the Jacobian calculation
JacBase_ResidEval,
//! Delta residual calculation for the Jacbobian calculation
//! Delta residual calculation for the Jacobian calculation
JacDelta_ResidEval,
//! Base residual calculation for the showSolution routine
/*!
Expand All @@ -32,7 +32,7 @@ enum ResidEval_Type_Enum {
//! Base residual calculation containing any lagged components
/*!
* We use this to calculate residuals when doing line searches along
* irections determined by Jacobians that are missing contributions from
* directions determined by Jacobians that are missing contributions from
* lagged entries.
*/
Base_LaggedSolutionComponents
Expand Down
1 change: 0 additions & 1 deletion include/cantera/oneD/OneDim.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ class OneDim
std::vector<size_t> m_loc;
vector_int m_mask;
size_t m_pts;
doublereal m_solve_time;

// options
int m_ss_jac_age, m_ts_jac_age;
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 @@ -1241,7 +1241,7 @@ class ThermoPhase : public Phase
* @param element either "Bilger" to compute the mixture fraction
* in terms of the Bilger mixture fraction, or
* an element name, to compute the mixture fraction
* bsaed on a single element (default: "Bilger")
* based on a single element (default: "Bilger")
* @returns mixture fraction (kg fuel / kg mixture)
*/
double mixtureFraction(const double* fuelComp, const double* oxComp,
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/zeroD/Reactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class Reactor : public ReactorBase
//! @returns True if at least one limit is set, False otherwise
bool getAdvanceLimits(double* limits);

//! Set individual step size limit for compoment name *nm*
//! Set individual step size limit for component name *nm*
//! @param nm component name
//! @param limit value for step size limit
void setAdvanceLimit(const std::string& nm, const double limit);
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/zeroD/flowControllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class Valve : public FlowDevice
return m_coeff;
}

/// Compute the currrent mass flow rate, based on the pressure difference.
/// Compute the current mass flow rate, based on the pressure difference.
virtual void updateMassFlowRate(double time);
};

Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/_cantera.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ cdef extern from "cantera/oneD/Boundary1D.h":
CxxSurf1D()

cdef cppclass CxxReactingSurf1D "Cantera::ReactingSurf1D":
CxxRreactingSurf1D()
CxxReactingSurf1D()
void setKineticsMgr(CxxInterfaceKinetics*) except +translate_exception
void enableCoverageEquations(cbool) except +translate_exception
cbool coverageEnabled()
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/ck2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
from email.utils import formatdate

try:
import ruamel_yaml as yaml
except ImportError:
from ruamel import yaml
except ImportError:
import ruamel_yaml as yaml

# yaml.version_info is a tuple with the three parts of the version
yaml_version = yaml.version_info
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/cti2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import argparse

try:
import ruamel_yaml as yaml
except ImportError:
from ruamel import yaml
except ImportError:
import ruamel_yaml as yaml

# yaml.version_info is a tuple with the three parts of the version
yaml_version = yaml.version_info
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/ctml2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import numpy as np

try:
import ruamel_yaml as yaml # type: ignore
except ImportError:
from ruamel import yaml
except ImportError:
import ruamel_yaml as yaml # type: ignore

# yaml.version_info is a tuple with the three parts of the version
yaml_version = yaml.version_info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
catalytically on the platinum surface. Gas-phase chemistry is included too,
and has some effect very near the surface.

The catalytic combustion mechanism is from Deutschman et al., 26th
The catalytic combustion mechanism is from Deutschmann et al., 26th
Symp. (Intl.) on Combustion,1996 pp. 1747-1754

Requires: cantera >= 2.5.0
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/examples/thermo/vapordome.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

w = ct.Water()

# create colums
# create columns
columns = ['T', 'P',
'vf', 'vfg', 'vg',
'uf', 'ufg', 'ug',
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def write_hdf(self, filename, *args, group=None, species='X', mode='a',
"""
Write the solution vector to a HDF container file.

The `write_hdf` method preserves the stucture of a `FlameBase`-derived
The `write_hdf` method preserves the structure of a `FlameBase`-derived
object (such as `FreeFlame`). Each simulation is saved as a *group*,
whereas individual domains are saved as subgroups. In addition to
datasets, information on `Sim1D.settings` and `Domain1D.settings` is
Expand Down Expand Up @@ -1638,7 +1638,7 @@ def __init__(self, gas, grid=None, width=None):

def set_initial_guess(self, data=None, group=None):
"""
Set the initial guess for the solution based on an equiibrium solution.
Set the initial guess for the solution based on an equilibrium solution.
Alternatively, a previously calculated result can be supplied as an
initial guess via 'data' and 'key' inputs (see
`FlameBase.set_initial_guess`).
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def test_save_restore_xml(self):
u3 = self.sim.velocity
V3 = self.sim.spread_rate

# TODO: These tolereances seem too loose, but the tests fail on some
# TODO: These tolerances seem too loose, but the tests fail on some
# systems with tighter tolerances.
self.assertArrayNear(Y1, Y3, 3e-3)
self.assertArrayNear(u1, u3, 1e-3)
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class ReactionTests:
_equation = None # reaction equation string
_rate = None # parameters for reaction rate object constructor
_rate_obj = None # reaction rate object
_kwargs = {} # additional parameters required by contructor
_kwargs = {} # additional parameters required by constructor
_index = None # index of reaction in "kineticsfromscratch.yaml"
_yaml = None # YAML parameterization
_input = None # input parameters (dict corresponding to YAML)
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/test/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from pathlib import Path, PurePath

try:
import ruamel_yaml as yaml
except ImportError:
from ruamel import yaml
except ImportError:
import ruamel_yaml as yaml

import cantera

Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/catcomb.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% chemistry is included too, and has some effect very near the
% surface.
%
% The catalytic combustion mechanism is from Deutschman et al., 26th
% The catalytic combustion mechanism is from Deutschmann et al., 26th
% Symp. (Intl.) on Combustion,1996 pp. 1747-1754
%

Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/surfreactor.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
set(gas,'T',t,'P',oneatm,'X','CH4:0.01, O2:0.21, N2:0.78');

% The surface reaction mechanism describes catalytic combustion of
% methane on platinum, and is from Deutschman et al., 26th
% methane on platinum, and is from Deutschmann et al., 26th
% Symp. (Intl.) on Combustion,1996, pp. 1747-1754
surf = importInterface('ptcombust.yaml','Pt_surf', gas);
setTemperature(surf, t);
Expand Down
2 changes: 1 addition & 1 deletion src/base/Units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Units::Units(const std::string& name, bool force_unity)
size_t start = 0;

// Determine factor
std::regex regexp("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
static std::regex regexp("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)");
std::smatch matched;
std::regex_search(name, matched, regexp);
if (matched.size()) {
Expand Down
2 changes: 1 addition & 1 deletion src/base/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class Application
* concentrations (no change to legacy behavior). After Cantera 2.6,
* results will no longer include third-body concentrations and be
* consistent with conventional definitions (see Eq. 9.75 in
* Kee, Coltrin and Glarborg, 'Chemically eacting Flow', Wiley
* Kee, Coltrin and Glarborg, 'Chemically Reacting Flow', Wiley
* Interscience, 2003).
*/
void use_legacy_rate_constants(bool legacy=true) {
Expand Down
16 changes: 7 additions & 9 deletions src/base/stringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ doublereal fpValueCheck(const std::string& val)
ch = str[0];
if (ch == '+' || ch == '-') {
if (str.size() == 1) {
throw CanteraError("fpValueCheck", "string ends in '{}'", ch);
throw CanteraError("fpValueCheck", "string '{}' ends in '{}'", val, ch);
ischoegl marked this conversation as resolved.
Show resolved Hide resolved
}
istart = 1;
}
Expand All @@ -158,33 +158,31 @@ doublereal fpValueCheck(const std::string& val)
numDot++;
if (numDot > 1) {
throw CanteraError("fpValueCheck",
"string has more than one .");
"string '{}' has more than one decimal point.", val);
}
if (numExp > 0) {
throw CanteraError("fpValueCheck",
"string has decimal point in exponent");
"string '{}' has decimal point in exponent", val);
}
} else if (ch == 'e' || ch == 'E' || ch == 'd' || ch == 'D') {
numExp++;
str[i] = 'E';
if (numExp > 1) {
throw CanteraError("fpValueCheck",
"string has more than one exp char");
"string '{}' has more than one exp char", val);
} else if (i == str.size() - 1) {
throw CanteraError("fpValueCheck",
"string ends in '{}'", ch);
throw CanteraError("fpValueCheck", "string '{}' ends in '{}'", val, ch);
}
ch = str[i+1];
if (ch == '+' || ch == '-') {
if (i + 1 == str.size() - 1) {
throw CanteraError("fpValueCheck",
"string ends in '{}'", ch);
"string '{}' ends in '{}'", val, ch);
}
i++;
}
} else {
throw CanteraError("fpValueCheck",
"Trouble processing string, " + str);
throw CanteraError("fpValueCheck", "Trouble processing string '{}'", str);
}
}
return fpValue(str);
Expand Down
2 changes: 1 addition & 1 deletion src/kinetics/BulkKinetics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool BulkKinetics::addReaction(shared_ptr<Reaction> r, bool resize)

if (!(r->usesLegacy())) {
shared_ptr<ReactionRateBase> rate = r->rate();
// If neccessary, add new MultiBulkRate evaluator
// If necessary, add new MultiBulkRate evaluator
if (m_bulk_types.find(rate->type()) == m_bulk_types.end()) {
m_bulk_types[rate->type()] = m_bulk_rates.size();
m_bulk_rates.push_back(rate->newMultiRate());
Expand Down
Loading