Commit graph

7147 commits

Author SHA1 Message Date
Ingmar Schoegl
717635d3e6 Add case-sensitive/lowercase logic to Phase::species
Further:
* revert unit tests to previous species definitions (some case mis-matches)
* remove non-essential comments
* opt to maintain case-sensitive species maps with lowercase as fallback
2019-09-23 21:53:06 -04:00
Ingmar Schoegl
76dd997692 [Thermo] update unit tests to handle case sensitive species names 2019-09-23 21:53:06 -04:00
Ingmar Schoegl
2231141e32 [Thermo] add flag that makes species names case sensitive
* store species information with case sensitive names
* retain lookup for non-case sensitive species names, e.g. Phase::speciesIndex
* implement flag that enforces case sensitive species names as a member
variable of Phase
* add exception handling for species that are not uniquely defined unless case
sensitive (e.g. Cs and CS in nasa.cti if cs is specified and case sensitivity
is not enforced)
* deprecate Phase::species(std::string&)
2019-09-23 21:53:06 -04:00
Ingmar Schoegl
e0fe5eed59 [Thermo] fix compiler warning for RedlichKwongMFTP 2019-09-23 21:53:06 -04:00
Ray Speth
265a1860cc [1D] Disable free flame domain width check when auto=False
Solving with auto=True and then solving with auto=False would leave the domain
width check in place, but without the logic for automatically increasing the
domain width, resulting in unexpected solver failures.
2019-08-13 12:48:45 -04:00
Ingmar Schoegl
7ac09108c9 Update .gitignore 2019-08-13 11:33:40 -04:00
Ingmar Schoegl
eff23b6f82 Update ic_engine example using new cantera capabilities 2019-08-13 11:33:40 -04:00
Ingmar Schoegl
eea04255fd [Thermo] add write_hdf to SolutionArray objects
* The commit implements saving of data extracted from SolutionArrays
 to HDF containers using pandas infrastructure.
 * Two methods are introduced: `write_hdf` and `to_pandas`.
 * Both methods only work if the pandas module can be imported; an
 exception is raised only if the method is called without a working
 pandas installation.
2019-08-13 11:32:51 -04:00
band-a-prend
5184ebccba Fix "catching polymorphic type" GCC 8 warnings
The "catching polymorphic type" warnings appear during compilation with GCC 8:

src/base/global.cpp: In function ‘void Cantera::setLogger(Cantera::Logger*)’:
src/base/global.cpp:28:19: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
     } catch (std::bad_alloc) {
                   ^~~~~~~~~

src/equil/vcs_MultiPhaseEquil.cpp: In member function ‘int Cantera::vcs_MultiPhaseEquil::equilibrate_HP(doublereal, int, double, double, int, int, doublereal, int, int)’:
src/equil/vcs_MultiPhaseEquil.cpp:228:31: warning: catching polymorphic type ‘class Cantera::CanteraError’ by value [-Wcatch-value=]
         } catch (CanteraError err) {
                               ^~~

src/equil/vcs_MultiPhaseEquil.cpp: In member function ‘int Cantera::vcs_MultiPhaseEquil::equilibrate_SP(doublereal, double, double, int, int, doublereal, int, int)’:
src/equil/vcs_MultiPhaseEquil.cpp:354:31: warning: catching polymorphic type ‘class Cantera::CanteraError’ by value [-Wcatch-value=]
         } catch (CanteraError err) {
                               ^~~

This commit fix this warnings via caught by reference.
2019-08-10 15:07:44 -04:00
band-a-prend
1606ce1565 Remove m_iter variable and deprecate setIterator function
Remove m_iter variable and deprecate setIterator function
because only Newton (CV_NEWTON) iteration method is used.
2019-08-09 18:08:47 -04:00
band-a-prend
6a8d7f7de3 Fix building Cantera against Sundials 4.x library
The changelog of Sundials 4.0.0 states:

"With the introduction of SUNNonlinSol modules, the input parameter iter
to CVodeCreate has been removed along with the function CVodeSetIterType
and the constants CV_NEWTON and CV_FUNCTIONAL.
Similarly, the ITMETH parameter has been removed from the Fortran interface
function FCVMALLOC. Instead of specifying the nonlinear iteration type
when creating the CVODE(S) memory structure, CVODE(S) uses
the SUNNONLINSOL_NEWTON module implementation of a Newton iteration by default."

so the appropreate conditional changes are added to control
the code execution via CT_SUNDIALS_VERSION preprocessor variable
to omit the parameters of Sundials solver that are no longer required.
2019-08-09 18:08:47 -04:00
band-a-prend
3b948e17d4 Simple fix for Sundials 3.2 compatibility
The Sundials 3.1 and 3.2 are compatible with each other
so this patch just allows to pass check for the installed Sundials 3.2
2019-08-09 18:08:47 -04:00
Ingmar Schoegl
97356a48df Add set_equivalence_ratio to SolutionArray objects 2019-08-09 17:39:10 -04:00
Ray Speth
27f30c6a2d Use more precise atomic masses for deuterium and tritium 2019-08-09 15:15:30 -04:00
Bryan W. Weber
fc01d7f3de Make format of atomic weights struct consistent
In the atomic weights struct in Elements.cpp, ensure that there is no
space before the closing brace of an element and that there is one
space between the longest element name and a 3-digit weight.
2019-08-09 15:15:30 -04:00
Bryan W. Weber
ded50547f9 Update test results changed by constants and elements
Update reference values and blessed files in regression tests.
2019-08-09 15:15:30 -04:00
Bryan W. Weber
b5a7575bc0 [Doc] Fix element function exception documentation
For several elements-related functions, the documentation listed
incorrect or incomplete exceptions that could be thrown from that
function.
2019-08-09 15:15:30 -04:00
Ray Speth
a7363e4b54 Update mass of electron "element" to 2018 CODATA value 2019-08-09 15:15:30 -04:00
Ray Speth
7461c3c960 Fix data for thallium in elements.xml
The entry for element with atomic number 81 incorrectly had the atomic symbol
and standard entropy for titanium.
2019-08-09 15:15:30 -04:00
Bryan W. Weber
dc96fb5fe8 Update atomic weights with 2018 IUPAC/CIAAW data
Use data from the periodic table at
http://www.ciaaw.org/atomic-weights.htm and
https://iupac.org/wp-content/uploads/2018/12/IUPAC_Periodic_Table-01Dec18.pdf
Elements without any atomic weight in either table do not have a stable
isotope. These are deleted from elements.xml and have their atomic
weight set to -1.0 in Elements.cpp. Add elements after plutonium that
were not previously listed. None of these elements have stable
isotopes.

These elements are retained/added so their symbols, names, and atomic
numbers can still be retrieved and the mapping of atomic number to
index - 1 in the struct is maintained.

Modify the element weight lookup functions to throw errors when an
element with no weight is requested (i.e., the weight is -1.0 in the
struct).
2019-08-09 15:15:30 -04:00
Bryan W. Weber
541fddb15e Rearrange the physical constants 2019-08-09 15:15:30 -04:00
Bryan W. Weber
3e6e57edbf Change all doublereal in ct_defs to double 2019-08-09 15:15:30 -04:00
Bryan W. Weber
3e4842be9e Update physical constants with CODATA 2018 values
These values include the redefinition of the kilogram. The data were
released on 20 May, 2019.
2019-08-09 15:15:30 -04:00
Ingmar Schoegl
bbdc790257 Address error C2512 when compiling with Visual Studio
Using a default value, VS2019 (VC 14.1) complains about a missing default constructor for UnitSystem.
2019-08-05 21:56:25 -04:00
Ingmar Schoegl
bc8b4be654 [Reactor] clarify FlowDevice interface
* differentiated Valve::setValveCoeff from PressureController::setPressureCoeff
 and introduced MassFlowController::setMassFlowCoeff for consistency.
 * introduced FlowDevice::setTimeFunction and FlowDevice::setPressureFunction to
 differentiate time-dependent and pressure-dependent functions.
 * introduced arbitrary pressure dependence for PressureController
 * deprecated FlowDevice::setFunction which is replaced by time and pressure
 specific functions.
 * introduced properties Valve.valve_coeff / PressureController.pressure_coeff /
 MassFlowController.mass_flow_coeff in Cython interface and deprecated
 Valve.set_pressure_coeff / PressureController.set_pressure_coeff
 * deprecated corresponding function calls in clib interface
 * deprecate FlowDevice.setParameters (which was only used by MATLAB interface)
2019-08-05 17:01:05 -04:00
agarwalrounak
7523022d71 Update diamond.cti and diamond_cvd.py
Replace data/inputs/diamond.cti with test_problems version that has
more information. This results in a change in the default pressure and
mole fractions of the gas phase, which in turn changes the result of
one of the regression tests. This is fixed by setting the composition
and pressure of the gas phase in the test to their original values. The
default state from the CTI file matches from the paper.

In addition, there was a difference in the reversibility of reaction u
between the files. Since the thermo for C(d) specifies that the
reaction is irreversible, this is the sense of the reaction that is
chosen.

Include plotting in the diamond_cvd.py and use open properly.
2019-08-05 14:09:03 -04:00
Bryan W. Weber
bfa5a66ed3 [SCons] Remove fmt from linking
We use the header-only version of fmt now, so no need to link to the
compiled library.
2019-08-01 18:10:00 -04:00
Bryan W. Weber
c0f019407e [SCons] Link to yaml-cpp when using system libs
Similar to the system_sundials option, libyaml-cpp must be added to the
linker line when the system libraries are used.
2019-08-01 18:10:00 -04:00
Sebastian Pinnau
dda89663ea [SCons] Add yaml-cpp to shared libraries if building with system yaml-cpp
If building Cantera with system_yamlcpp=y the yaml-cpp library needs to be
specified in the linker flags.

Fixes #668
2019-08-01 18:10:00 -04:00
Kyle Niemeyer
6852087ff5 Fixed typo in ctml_writer.py
"explcit" -> "explicit"
2019-08-01 15:56:45 -04:00
band-a-prend
582eb42b2f cantera: Fix passing 'python_prefix' variable into installation path
The '${python_prefix}' substring for installation prefix path
was accepted as mapping key for '.format()' function resulting in
a 'KeyError' failure of 'cantera/interfaces/cython/SConscript' script
in case of `env[libdirname] == 'lib64'`.

Moreover the early applied pull request[1] didn't take into account
the additional setting of installation prefix path in the cases
when 'libdirname' takes values different from 'lib64'.

This patch resolves both those issues.

[1]: https://github.com/Cantera/cantera/pull/661
2019-08-01 15:53:20 -04:00
Ingmar Schoegl
d263566670 [Reactor] Deprecating magic numbers.
* add deprecation warning for int ReactorBase::type() (to be changed after Cantera 2.5)
 * introduce temporary std::string ReactorBase::typeStr() (to be renamed after Cantera 2.5)
 * deprecate all functions using the old call and introduce associated temporary functions
2019-08-01 15:37:48 -04:00
Ingmar Schoegl
77295b2103 Update AUTHORS list 2019-08-01 15:37:48 -04:00
Bryan W. Weber
296e2912e5 [Test] Update to not use deprecated PureFluid.h
Update test_problems for rankine and pureFluid to avoid using the
deprecated PureFluid.h convenience wrapper classes. Update the
rankine.cpp test problem to match the rankine.cpp sample. Switch
both test_problems updated here to use writelog instead of
printf/cout.
2019-07-30 13:24:11 -04:00
Bryan W. Weber
ed59ae9516 [Samples] Update to not use PureFluid wrapper
Update rankine.cpp sample to avoid using the deprecated PureFluid wrapper
classes. Update the small changes in the blessed output.
2019-07-30 13:24:11 -04:00
Bryan W. Weber
386c215b3b [Thermo] Deprecate PureFluid, use PureFluidPhase instead
The convenience wrapper PureFluid class can be replaced by
PureFluidPhase::initThermoFile or other methods of creating ThermoPhase
instances.
2019-07-30 13:24:11 -04:00
Ray Speth
409227cd05 [CI] Make test errors show up as CI failures for macOS builds 2019-07-30 13:24:11 -04:00
Bryan W. Weber
5f08b362aa
[CTI/YAML] Check convert arguments in cti2yaml
Check that one, and only one, of the filename/text arguments are
specified.
2019-06-29 17:02:41 -04:00
Bryan W. Weber
27438751ce
[CTI/YAML] Change cti2yaml to use pathlib
cti2yaml converts input and output file names to pathlib.Path objects.
This makes it easier to manage paths for test data files
2019-06-29 17:02:41 -04:00
Bryan W. Weber
8d57424188
[Test] Write converted test files to the work dir
The previous behavior was to write the test files to the current working
directory
2019-06-29 17:02:41 -04:00
Bryan W. Weber
2e54811549
[Test] Remove relative directory for data files
The relative directory wasn't the same for the installed Cython
interface
2019-06-29 17:02:41 -04:00
Bryan W. Weber
1e2a9f23a3
[Test] Avoid using path in source tree in tests
The relative path that is eliminated here relied on being in the source
directory structure, breaking tests of the installed Cython interface
2019-06-29 17:02:41 -04:00
Bryan W. Weber
a4ad2f5d66
[Cython/Test] Install test subdirs in Cython interface
The tests now include subdirectories with data files, so those should be
installed with the rest of the data files
2019-06-29 17:02:41 -04:00
band-a-prend
674c37ce3c cantera: Sconstruct 'libdirname' env PathVariable
Some distributions (e.g. Fedora/RHEL) use 'lib64' instead of 'lib'
on 64-bit systems or could use some other library directory name
instead of 'lib' depends on architecture and profile
(e.g. Gentoo 'libx32' on x32 profile).
If user didn't set 'libdirname' configuration variable then
set it to default value 'lib'

This commit is related to early closed issue:
https://github.com/Cantera/cantera/issues/318
2019-06-28 15:25:41 -04:00
Ray Speth
c840142bff Bump version to 2.5.0a3 2019-06-27 18:29:21 -04:00
Steven DeCaluwe
2d2004da7e Exposing getDeltaEnthalpies to Matlab interface.
The general intent here was to enable calculating reaction enthalpies in the
Matlab toolbox, as part of the li-ion battery simulations in PR #563.

This required several changes:

- Create getDeltaEnthalpies.m in Matlab toolbox/@Kinetics, as well as similar
methods for Gibbs free energy and entropy of reaction
- Add kin_getDelta to kineticsmethods.cpp.
- Add getPartialMolarEnthalpies to metalPhase class (it returns all zeros).

Note that similar methods are not enabled for the corresponding
'Standard State' methods, for the time being.  Mainly because it is
difficult for me to envision a significant use case, but also because of
some lingering confusion between 'standard' and 'reference' states in
Cantera's codebase.
2019-06-27 18:03:07 -04:00
bryanwweber
8502d18ff7 Initialize m_units in AnyMap default constructor
Without this initialization, VS2017 (VC 14.1) complains there is a missing default constructor for UnitSystem.
2019-06-27 16:00:01 -04:00
bryanwweber
946ed901a0 Bump yaml-cpp submodule commit
For VS2017, we need fixes from jbeder/yaml-cpp#597 to compile the submodule
2019-06-27 16:00:01 -04:00
Ray Speth
a247d0f4eb [Reactor] Use correct phase state after mass flow rate evaluation
A user-defined mass flow rate function can modify the ThermoPhase object used by
a reactor, for example if it depends on calculating some property of a different
reactor. To make sure that the reactor governing equations are evaluated
correctly, the ThermoPhase state needs to be set after all user-defined
functions have been called.
2019-06-27 10:47:05 -04:00
Ray Speth
edcc9c59fd [Input] Fix CTI to YAML conversion of phases with no elements 2019-06-26 20:20:23 -04:00