Commit graph

76 commits

Author SHA1 Message Date
Ray Speth
11f6c2f993 Consolidate duplicate species checks in Phase::addSpecies 2016-09-10 21:45:24 -04:00
Ray Speth
abf71c4cb1 Allow non-positive atomic weights for custom elements 2016-08-30 20:28:35 -04:00
Ray Speth
6a928b57f9 Replace getValue with std::map.at where possible
Deprecate the two-argument version of getValue, since the C++11 at method does
the same thing.
2016-04-18 19:34:40 -04:00
Ray Speth
32b3543cbe [Thermo] Introduce Phase::compositionChanged
This function is called after any change in composition, and can be used by
phases to update quantities that are affected by the composition change, instead
of needing to overload all of the different functions which update the
composition.
2016-04-17 23:58:34 -04:00
Ray Speth
9c4a0baa55 [Thermo] Simplify adding species for most phase types
Where possible, extend arrays as species are added rather than requiring a
later call to initThermo(). For phases that do not require any data except
that which is included in the Species objects themselves (notably, this
includes IdealGasPhase), species can now be added dynamically without
affecting the phase state.
2016-04-15 20:56:24 -04:00
Ray Speth
4428a62f3c [Thermo] Add ability to modify species data for existing Phase objects 2016-04-15 15:32:38 -04:00
Ray Speth
13fa0c7a4f Add invalidateCache() function to ThermoPhase and Kinetics
This can be used to invalidate cached data after a change to underlying data
such as species thermo coefficients or reaction rate coefficients. Needs to be
user-accessible so that dependent objects can be updated manually.
2016-04-15 15:32:38 -04:00
Ray Speth
b99ba44f13 Fix SurfPhase::setCoveragesNoNorm to retain negative coverages
This prevents Jacobian singularities due to (trivial) negative coverages,
e.g. in ReactingSurf1D.
2016-03-27 17:07:36 -04:00
Bryan W. Weber
f3bc7a5d5b Replace LookupWtElements with getElementWeight function
Deprecate LookupWtElements. Also split the atomic weights
database into one for named elements and for named isotopes.
2016-01-22 18:18:42 -05:00
Ray Speth
f5ff849b47 Replace std::copy with simpler direct assignment where possible 2015-11-12 17:35:30 -05:00
Ray Speth
4382ae6c85 Clean up comments in Thermo class source files 2015-11-09 17:34:46 -05:00
Ray Speth
2589a27b6c Use range-based for and auto to simplify some loops 2015-10-14 18:45:23 -04:00
Ray Speth
e669f912a5 Use cppformat in Phase and ThermoPhase 2015-10-14 18:45:22 -04:00
Ray Speth
acdf9cf0ed Clean up interstitial whitespace
Remove extra space around operators, between words, etc.
2015-08-02 23:06:16 -04:00
Ray Speth
e4c45b6429 General whitespace cleanup
Remove unnecessary blank lines and trailing whitespace. Replace tabs with
spaces.
2015-08-02 23:06:15 -04:00
Ray Speth
c3c80f79fb Remove extraneous parentheses 2015-08-02 23:06:14 -04:00
Ray Speth
e8292d387e Fix definition of elemental mole fraction
The elemental mole fractions should be invariant under composition changes which
conserve atoms.
2015-07-16 10:41:39 -04:00
Ray Speth
f1f10b6526 Remove unused, deprecated code marked for removal after Cantera 2.2 2015-07-15 12:08:50 -04:00
Ray Speth
546289f737 Remove deprecated code with functional alternatives 2015-07-13 18:59:09 -04:00
Ray Speth
140da430c0 Check for non-existent species in setMass/MoleFractionsByName 2015-06-24 13:05:28 -04:00
Ray Speth
1c878c16de Fix issues indicated by compiler warnings 2015-05-26 11:42:20 -04:00
Ray Speth
96cf312ec6 [Thermo] Always add species using Species objects
Deprecate the non-Species-based addSpecies and addUniqueSpecies
functions.
2015-04-20 18:34:38 -04:00
Ray Speth
a471e4316a [Thermo] Phase::addSpecies takes shared_ptr by value
This helps to clarify that addSpecies stores a copy of the shared_ptr.
2015-04-20 18:34:37 -04:00
Ray Speth
d1cda15f42 Improve performance of importing phases
Replace the O(k) implementation of Phase::speciesIndex with one that is
O(log(k)). This function is called frequently as part of Kinetics object
initialization. Optimize for the more common case where the species name is not
qualified with a phase name.
2015-04-14 15:29:28 -04:00
Ray Speth
bde0f1466d [Thermo] Add index-based accessor for Species objects 2015-04-14 15:29:28 -04:00
Ray Speth
882a4986da Remove 'thermo' argument from Species constructor
Since the Species object now stores its SpeciesThermoInterpType contents as a
shared_ptr, it is undesirable to have the Species constructor take this as a raw
pointer argument.
2015-04-14 15:29:28 -04:00
Ray Speth
43952b30fc [Thermo] Use shared_ptr<Species> in ThermoPhase 2015-04-14 15:29:28 -04:00
Ray Speth
dab74d2d10 [Thermo] Deprecate mean_Y and sum_xlogQ methods of class Phase 2015-02-20 23:44:36 +00:00
Ray Speth
2ed8552939 [Thermo] Add a version of Phase::mean_X that takes vector_fp
This simplifies all internal calls to this function
2015-02-20 23:44:21 +00:00
Thomas Fiala
4bc4fda90c Add C++ and Cython support for computing elemental mass/mole fractions 2015-02-17 23:23:51 +00:00
Ray Speth
7acf0378c6 [Thermo] Improve usage of local variables
Also eliminate some unnecessary temporary variables.
2015-02-12 04:04:18 +00:00
Ray Speth
b8a99b4b83 Remove unnecessary explicit calls to default constructors 2015-01-22 00:04:12 +00:00
Ray Speth
2a50dc50f7 [Thermo] Add accessor for Species objects 2015-01-08 23:36:24 +00:00
Ray Speth
5bc4a12e2e Add options for handling Species containing undefined elements 2014-10-17 23:44:37 +00:00
Ray Speth
26b6f190f3 Introduce class Species 2014-10-17 23:44:31 +00:00
Ray Speth
5b1b08849c Additional uses for getValue with default value 2014-10-03 01:45:54 +00:00
Ray Speth
4baccc732c [Thermo] Simplify interface for adding elements to a Phase
Phase::addElements(string name, ...) is the single entry point for adding
elements. It always perform the uniqueness check, and can do the extra
additional work required to add elements to a phase that already has species,
removing the need for "freezing" the phase's elements. Parsing the XML tree for
elements is now handled in "installElements". The variant element-adding methods
are deprecated.
2014-09-27 00:09:05 +00:00
Ray Speth
09db5a498a [Thermo] Add getMass/MoleFractionsByName functions with thresholds
This makes it easier to set the composition of a phase based on the composition
of another phase with a different set of species. The threshold argument allows
species with negligible concentrations to be skipped.

Deprecate the unused getMoleFractionsByName function that didn't return a
value.
2014-09-18 22:58:59 +00:00
Ray Speth
002c158761 Cleanup include statements
Move includes from header to implementation files where possible, and remove
unnecessary includes.
2014-08-28 16:54:13 +00:00
Harry Moffat
e129d02d93 Added in real number overflow exception control.
There are a series of activity coefficients for published battery models
 which actually overflows. Cantera was treating this as a nonerror and changing
the return results without comment. This is not correct. Made the behavior a
user controlled capability.
2014-08-05 23:42:24 +00:00
Ray Speth
45f6e84ebf Improved error messages that just reported 'confused' 2014-07-10 22:36:43 +00:00
Ray Speth
789574ac80 Remove commented-out code 2014-05-27 02:52:21 +00:00
Harry Moffat
675df76b1c Fixed a long standing problem with the combination of storred XML files and duplicator functions.
Now the complete XML file is storred within the ThermPhase object starting with the root node.
This is needed for later processing of kinetics and transport mechanisms when the ThermoPhase
file is duplicated and the original file is deleted.

xml() is now a const function, and still returns the same pointer.
setXMLdata() is a new function will stores the xml data.
2014-05-20 19:02:20 +00:00
Ray Speth
14ea7e64c6 [Thermo] make compositonMap a const argument 2014-04-08 16:26:20 +00:00
Victor Brunini
a704df09d8 Convert recent changes to new caching method. 2014-03-18 18:52:29 +00:00
Victor Brunini
b0ecf96cb6 Trying out a cleaner way knowing when expensive state functions need to be recomputed. 2014-03-13 23:50:31 +00:00
Ray Speth
d516d46f33 Remove unnecessary use of static_cast<int> 2014-01-31 23:15:09 +00:00
Ray Speth
607955b9f2 Remove unnecessary conditional surrounding 'delete' statements 2014-01-06 18:45:19 +00:00
Ray Speth
5fff5ce99f [Thermo] Slightly simplify adding species
Eliminate the freezeSpecies and init methods of class Phase, instead adjusting
array sizes as new species are added.
2013-10-04 16:22:35 +00:00
Ray Speth
ee74c80afc Fixed a number of "shadowed variable" compiler warnings 2013-04-18 22:08:36 +00:00