Commit graph

6963 commits

Author SHA1 Message Date
Bryan W. Weber
d25637d0ea
Update NumFOCUS donation link in docs sidebar 2019-03-20 09:15:39 -04:00
g3bk47
471041a27a Additional check for Troe coefficients being zero
This will prevent floating point exceptions (sometimes enabled by third-party
codes) in case c[1] or c[2] are zero but will not change the current behaviour
if c[1] and c[2] are not zero.
2019-03-18 14:39:50 -04:00
Bryan W. Weber
4026c17915 Add /usr/local/include to cmake incdirs
By default, CMake uses the system SDK on macOS as the system root by
setting the isysroot flag to clang. This setting removes /usr/local from
the include search path.
2019-03-15 14:44:43 -04:00
Bryan W. Weber
cb008a95d7 Add the Accelerate framework to the CMake builds of the samples 2019-03-15 14:44:43 -04:00
Ray Speth
337f33baad [CI] Use Travis Homebrew addon instead of manual brew commands
This should reduce the time needed to set up the build environment and avoid
build failures associated with errors while updating irrelevant homebrew
packages.
2019-03-14 14:08:54 -04:00
Ray Speth
968dc24925 [Python] Fix compatibility with Cython < 0.27
After setting the "language_level" directive (6c0866ef), nested comprehension
expressions erroneously triggered an error message from the Cython compiler
saying "local variable 's' referenced before assignment". While the problem has
been fixed in Cython 0.27 and newer, this commit restores compatibility with
older Cython versions as well.
2019-03-14 14:03:51 -04:00
Ray Speth
5e226535de Fix regression in compatibility with Sundials 2.4.0
Regression was introduced in 9c50f752 when adding compatibility with
Sundials 3.x.

Fixes #613
2019-03-14 14:03:51 -04:00
Bryan W. Weber
6c0866efb8 Add Cython language_level directive to _cantera.pyx
This fixes the warnings generated by recent versions of Cython that
the language_level will be changed in the future. By setting this
directive, all the code in the .pyx files should be written in
Python 3 syntax. This required several changes to the import
syntax in the files to fix relative vs. absolute imports
2019-03-11 17:00:13 -04:00
Ray Speth
d6d91f4d98 [Thermo] Fix updating state of PDSS_IonsFromNeutral objects
Setting T and P now updates the state of the underlying "neutral
molecule phase".

Also removed the unimplemented setState_TR method.
2019-03-06 19:50:16 -05:00
Ray Speth
bdc81684b1 [Thermo] Fix BinarySolutionTabulatedThermo initial mole fraction thermo
The value of m_xlast should only be set to a valid value by _updateThermo,
after it has calculated values for the tabulated enthalpy and entropy.
2019-03-06 19:48:45 -05:00
Ray Speth
aceb896f62 [Thermo] Fix BinarySolutionTabulatedThermo updates when only T changes
In the case where temperature changes but the mole fractions are the same, we
still need to apply the enthalpy and entropy offsets to the tabulated species.
2019-03-06 19:48:45 -05:00
Ray Speth
47005a5008 [Thermo] Fix overriding of IdealSolidSolnPhase::_updateThermo
Since IdealSolidSolnPhase::_updateThermo wasn't a virtual method, and
the signatures didn't match (const vs non-const), calls to this method
from IdealSolidSolnPhase weren't being overridden by
BinarySolutionTabulatedThermo::_updateThermo as expected.
2019-03-06 19:48:45 -05:00
Ray Speth
1f70f7751c Move sofc.cti from examples to main data directory 2019-03-05 16:09:55 -05:00
Ray Speth
ec7f779434 [Input] Include more significant digits for Redlich-Kwong coefficients
ctml_writer was severely truncating Redlich-Kwong coefficients when converting
from CTI to XML formats, keeping only 5 significant digints in the "a"
coefficients and two decimal digits in the "b" coefficients, which is less than
what is used even in the example CTI files. The use of the "%f" format also
meant that the precision depended on input units.
2019-03-05 16:09:55 -05:00
Ray Speth
6c82b61c3d [Kinetics] Always use temperature of "reacting" phase
This is always the lowest-dimensional phase, e.g. surface or edge for
heterogeneous systems.
2019-03-05 15:03:48 -05:00
Ray Speth
5601ee9067 [Python] Add 'kinetics_species_name' and 'kinetics_species_names' 2019-03-05 15:03:48 -05:00
Ray Speth
5ad656e342 [ck2cti] Fix Chebyshev rate constant when using local quantity units
Since the leading Chebyshev coefficient has effective units like
log(cm^3/kmol), it needs to be converted directly to the default units of
the CTI file.

Analogous to the fix for PLOG reactions in #435.
2019-02-28 22:37:38 -05:00
Ray Speth
540777c32b [ck2cti] Fix handling of reaction units settings not on last line
Fixes a regression introduced in d56b6205fa.
2019-02-25 11:06:12 -05:00
Ray Speth
0fdbe24aaf Provide error message after failure to create large Sundials matrix
If Sundials tries to create an excessively large matrix, it returns a null
pointer. To avoid a subsequent segfault, throw an exception which makes the
cause of the error clear.

WIP: Better error message for too-large Sundials matrix

TEMP: fixup for cvodes error messages
2019-02-25 11:06:12 -05:00
Ray Speth
90d2ec41ca [Thermo] Eliminate redundant coefficient storage in ShomatePoly2 2019-02-25 11:06:12 -05:00
Ray Speth
8bcb62f727 Fix GRI3.0 transport coefficients
The old (C++) ck2cti program unnecessarily rounded some species transport
coefficients. This updates the coefficients in the input files derived from GRI
3.0, and updates the test comparisons for affected tests.
2019-02-25 11:05:40 -05:00
Ray Speth
8689809d9e Remove unused XML input files
The XML versions of these files that are actually installed/used are the ones
generated during the build process from their CTI equivalents.
2019-02-25 11:05:40 -05:00
Ray Speth
ce9a17dd92 Bump version to 2.5.0a2 2019-02-25 09:14:33 -05:00
Bryan W. Weber
7691d7f9d3
Remove execute bits from test data files 2019-02-22 09:17:20 -05:00
Ray Speth
b8367d6fe8 [Thermo] Eliminate redundant coefficient storage in NasaPoly2 2019-02-21 11:21:03 -05:00
Ray Speth
50997a1651 [Python] Fix documentation of Reaction.listFromCti 2019-02-20 22:50:43 -05:00
Ray Speth
77b467929c [Thermo] Fix calculation of initial density of IdealSolidSolnPhase
The density of IdealSolidSolnPhase and BinarySolutionTabulatedThermo objects was
not being computed as part of construction, causing code that interacted with
them using setState/restoreState, such as the 'Solution' constructors in Matlab
and Python, to fail.
2019-02-20 21:39:22 -05:00
Ray Speth
7cf58af69e [Thermo] Always initialize BinarySolutionTabulatedThermo member variables 2019-02-20 21:39:22 -05:00
Steven DeCaluwe
f0c797c482 Updates to samples/matlab/lithium_ion_battery.m
Added some context and higher level functionality  to
lithium_ion_battery.m sample, such that it now uses some of the
already-present functionality to calculate and plot the open
circuit voltage for a lithium ion battery for a range of active
material compositions.
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
e4789d7102 Fixing BinarySolutionTabulatedThermo::_updateThermo
Previously, BinarySolutionTabulatedThermo::_updateThermo created a new
`speciesThermoInterpType` intance every time the thermo was updated,
storing the tabulated thermo lookups as the reference state thermo.

This has now been changed such that the reference state is used only
to represent the temperature effects on the thermo, with the tabulated
terms added to this reference state.  This should be a more efficient
implementation.
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
84b4147a99 Fixing return type of BinarySolutionTabulatedThermo::interp
The function `BinarySolutionTabulatedThermo::interp` now returns type
`std::pair<double, double>`, rather than `static double`
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
8169c26271 Updates to ctml_writer.py associated with BinarySolutionTabulatedThermo class.
-Removes option to read tabulated thermo from an external csv file (this is now
handled from within cti or xml).
-Renames `rateCoeff` keyword to the more appropriate `rate_coeff_type`, and fixing
keyword order so that this new keyword is listed last.
-Removes `else` statement from `if isinstance(self._standardState, standardState)
-Removes unused `_pure` attribute from `IdealSolidSolution` and
`BinarySolutionTabulatedThermo`
-Changes default on `tabulated_species` keyword to `None`.
-Removing superfluous `standardState:_build` from ctml_writer.py
- Removes unnecessary conc_dim() definition in `table` class.
- Removes unnecessary units defintion for mole fractions in `table` class.
- Improves grammar in error message for case when thermo table is
not provided for `tabulated_species`.
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
11271d90b2 Fixing unit conversion of tabulated data in BinarySolutionTabulatedThermo
Previously the model imported the tabulated data assuming it was given
in J, mol, K units, and ignoring any user input in the cti file, w/r/t
units.  This fixes that, by amending the `getFloatArray` calls in
thermo/BinarySolutionTabulatedThermo.cpp
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
366d1942ef Updating keyword order in ctml_writer.py species::__init__
The keyword `standardState` was added to species::__init__ in
ctml_writer.py.  This moves this keyword entry to the end of the
list of keywords, so that species instances of the class do not
need to reorder their keyword order.
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
05fdd356f2 Updates to BinarySolutionTabulatedThermo and test file.
-Fixes small typo id incclude/cantera/base/utilities.h docstring
-Removes `m_formGC` from BinarySolutionTabulatedThermo class, and
instead utilizes version and functionality inherited from parent
class `IdealSolidSolnPhase`.
-Moves samples/matlab/lithium_ion_battery/lithium_ion_battery.cti
to data/inputs/lithium_ion_battery.cti
-Fixes typo in test/data/BinarySolutionTabulatedThermo.cti
-Updates expected_result values in several test cases in
test/thermo/BinarySolutionTabulatedThermo_Test.cpp
2019-02-20 21:39:22 -05:00
Steven DeCaluwe
ae555fb063 Add description for BinarySolidSolutionTabulatedThermo class 2019-02-20 21:39:22 -05:00
Steven DeCaluwe
3c9bbc4ec9 Fix IdealMolalSolution::standardConcentration
Standard concentrations in the IdealMolalSolution phase depend on
a user-specified m_formGC parameter, where m_formGC=0 results in a
standard concentration of 1.0, m_formGC = 1 is supposed to result in
a standard concentration for species k  equal to 1 divided by the
molar volume of species k, and m_formGC = 2 is supposed to result in
a standard concentration equal to 1 divided by the molar volume of the
solvent species (which is species 0).

Current behavior is that m_formGC = 1 and m_formGC = 2 *both* result
in a standard concentration of 1 divided by molar vlume of the solvent.

This commit fixes how this is handled, cleans up the switch statement
(the three cases were written somewhat inconsistently), and throws
an error if m_formGC is set < 0 or > 2.
2019-02-20 21:39:22 -05:00
Manik Mayur
b8d5eb405a Add MATLAB example files for BinarySolutionTabulatedThermo class 2019-02-20 21:39:22 -05:00
Jamie
a7449c6cc8 Add tests for BinarySolutionTabulatedThermo class 2019-02-20 21:39:22 -05:00
Manik Mayur
224ef720e6 Add BinarySolutionTabulatedThermo class 2019-02-20 21:39:22 -05:00
Ray Speth
d04fd8cc39 [ck2cti] Show name of species with undefined elements in error message 2019-02-18 18:39:15 -05:00
CyberDrudge
aa9721dbe9
Use Cantera Error in leftover examples
Update diffusion_flame_batch.py and diffusion_flame_extinction.py
to use CanteraError where appropriate. Define a new
FlameExtinguished exception to distinguish between extinction and
other failures. This allows things like OSErrors to still be
raised to the user while dealing with exceptions we can handle.
Closes #569.
2019-02-18 13:38:50 -05:00
CyberDrudge
9d4c0eda03
Fix typo in Matlab documentation for cp_mass
Fixes #590
2019-02-17 08:12:53 -05:00
lavdwall
cb5620996c Add solvePseudoSteadyStateProblem() in cython interface 2019-02-11 13:46:48 -05:00
Ray Speth
e3424d8ed4 [ck2cti] Fix over-zealous detection of section 'end' labels 2019-02-04 18:49:45 -05:00
Ray Speth
33e198f7e5 [Thermo] Generalize check for missing Redlich-Kwong coefficients
A check in the "updateAB" function will be executed regardless of how the phase
is instantiated.
2019-02-04 18:49:45 -05:00
Ray Speth
f385f48190 [CI] Change Codecov to use Linux build instead of macOS
Something changed such that the macOS Travis builds are no long able to upload
coverage data to Codecov. However, uploading from the Linux builds instead seems
to work fine.
2019-02-04 18:49:45 -05:00
Ray Speth
ebb93cb5a2 [Thermo] Fix setting of temperature-dependent Redlich-Kwong parameters
Using negative values to indicate unspecified parameters doesn't work, since
either constant in "a = a0 + a1*T" can be negative and still produce a positive
value for "a". Instead, NaN can be used for this purpose.
2019-02-04 18:49:34 -05:00
Ray Speth
3ff5d87b81 [Doc] Fix descriptions and units of coverage dependency parameters 2019-02-04 16:38:40 -05:00
Ray Speth
46b7cf180a [SCons] Make dependency on copying Eigen headers explicit
SCons seems to miss this dependency sometimes, resulting in confusing failures
while trying to compile DenseMatrix.cpp.
2019-02-04 16:38:40 -05:00