Commit graph

35 commits

Author SHA1 Message Date
Ray Speth
6e138d0ae4 [Reactor] Always check that input/output are finite
This causes problems to be caught early, where they can at least sometimes be
handled as recoverable intergrator errors, rather than letting NaN values
propagate through the solution.
2015-08-24 12:27:07 -04:00
Ray Speth
6a04193646 Fix un-bracketed if, for, and else statements 2015-08-02 23:06:15 -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
0590b2cda8 [Reactor] Deprecate possibly-ambiguous names in componentIndex
Resolves #274.
2015-06-22 18:12:05 -04:00
Ray Speth
ab2beb4c64 [Reactor] Check that contents are assigned before starting integration 2015-02-28 00:24:38 +00:00
Ray Speth
2e53890adf Minor cleanup of constructors and destructors 2015-02-26 21:58:42 +00:00
Ray Speth
a6a10b854c [Reactor] Add damping factor to setState Newton iteration
This resolves convergence issues in somes cases where the iteration would
oscillate around the true solution.
2014-11-07 02:14:55 +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
Ray Speth
56ccc667df Fix some uninitialized member variables 2014-07-30 16:59:39 +00:00
Ray Speth
1b1703cc56 [Reactor] Remove unused variable ReactorBase::m_init 2014-07-18 15:14:07 +00:00
Ray Speth
6ffbaa5f77 [Reactor] Remove unneeded variables from ReactorBase 2014-06-10 16:23:43 +00:00
Ray Speth
8b5ca80303 [Reactor] Implement reactor network reinitialization
Adds ReactorNet::reinitialize, which skips all one-time initialization and
re-uses the same CVODES integrator. The Reactor::syncState() method is
introduced for applying new initial conditions for individual Reactor objects.

This approach increases efficiency when solving many similar problems with short
integration times, for example when being used as the chemistry term integrator
in an operator-split CFD code.
2014-06-10 16:23:03 +00:00
Ray Speth
1437aade8c [Reactor] Refactor updateState and getInitialConditions implementations
Extract common parts related to surface species
2014-06-10 16:22:46 +00:00
Ray Speth
0da063cdef [Reactor] Refactor wall / surface chemistry evaluation
This creates a single implementation of the calculation of the contributions of
walls and surface chemistry to the governing equations for all reactor types.
2014-06-10 16:21:56 +00:00
Ray Speth
b5396837b2 Make use of std::min, std::max, and clip 2014-06-03 16:52:43 +00:00
Ray Speth
f1b28158bf [Reactor] Fix behavior of componentIndex with ambigous names
The name 'H' can mean either the species by that name or the entahlpy
of the reactor, in the case of ConstPressureReactor, and the previous
behavior always returned the index of the enthalpy.

This changes the behavior to preferentially return the species, and
adds alternative names for reactor state variables that are less
likely to generate namespace collisions: 'mass', 'volume',
'int_energy', 'enthalpy', 'temperature', 'distance', 'velocity'. The
single character names are still supported.

Resolves Issue 193.
2013-12-14 00:18:12 +00:00
Ray Speth
0295f975e0 [Reactor] Refactor handling of sensitivity parameters in evalEqs 2013-07-30 15:57:48 +00:00
Ray Speth
c89b7f1c93 [Reactor] Change formulation of Reactor to support non-ideal phases
Expanding the time derivative of the total internal energy only works for ideal
phases, so for the more general case it is necessary to keep the internal energy
as the state variable and use an iterative method for setting the state.
2013-07-16 22:09:37 +00:00
Ray Speth
5a94876c91 Update Doxygen docs for class ReactorBase and descendants 2013-06-03 22:17:05 +00:00
Ray Speth
a59309e81e [Reactor] Independent variables for Reactor are now T,V, and Yk
This formulation for the reactor's governing equations significantly improves
the performance of integrator, mostly by improving the quality of the
Jacobian. The effect is small for smaller mechanisms (GRI 3.0) but can lead to
order-of-magnitude improvements for mechanisms with hundreds or thousands of
species.

Since this set of variables corresponds to the intrinsic state variables used
for IdealGasPhase objects, we also eliminate the need to iterate when setting
the state of the thermo object.

Additionally, by using temperature as an independent variable, the
temperature-dependent parts of the kinetic rate expressions do not need to be
recomputed while updating the Jacobian (this optimization is not currently
implemented).
2013-05-23 19:33:16 +00:00
Ray Speth
259ceaa9a6 Added assertions to check that some variables remain finite 2013-05-06 20:05:53 +00:00
Ray Speth
7da738d238 Re-applied consistent formatting to trunk
Applied using: astyle -n --style=kr --add-brackets --indent=spaces=4
--indent-col1-comments --unpad-paren --pad-header --align-pointer=type
--lineend=linux
2013-02-07 23:40:59 +00:00
Ray Speth
205706f5dd [Reactor] Avoid a segfault when using phases with no Kinetics 2013-01-07 18:08:23 +00:00
Ray Speth
fe6b5d3c0b Changed the ordering of Reactor sensitivity coefficients
The order now matches the order in which the corresponding sensitivity reactions
are added to the ReactorNet, regardless of the order in which Reactors and Walls
are added to the network.

Sensitivity parameter names can be accessed using the "sensitivityParameterName"
method of ReactorNet, and the "sensParamID" methods of Reactor and Wall have
been removed as they no longer meaningful.
2012-11-02 20:07:25 +00:00
Ray Speth
b3e25ee963 Modified Reactor::updateState to get sensitivity analysis working
Sensitivity analysis requires that the system responds appropriately to small
perturbations in the solution, a condition which is not satisfied when using the
default iterative method implemented by ThermoPhase::setState_UV. Instead, we
now use Newton's method to calculate the mixture temperature to within a small
multiple of machine precision.
2012-11-02 20:07:21 +00:00
Ray Speth
c404c31879 Eliminated unnecessary string copying in Reactor / ReactorNet 2012-10-12 20:34:41 +00:00
Ray Speth
11a11bea79 Removing deprecated / nonfunctional methods from Reactor
These functions / variables are for driving the time integration, which is
handled entirely by ReactorNet.
2012-10-12 20:34:33 +00:00
Ray Speth
15755c1447 Pruning some dead code 2012-05-24 16:30:04 +00:00
Ray Speth
ee746bf895 Fixed a size_t-related error that caused Reactor walls to behave incorrectly 2012-05-24 16:29:20 +00:00
Ray Speth
ca4212cc57 Removed a number of unused / redundant typedefs 2012-03-15 19:51:57 +00:00
Ray Speth
d8edde0264 Expanded array bounds checking in C interface functions 2012-03-15 19:51:37 +00:00
Ray Speth
3bff32dd55 Fixed problems that generated warnings with the Intel compiler 2012-03-07 00:51:13 +00:00
Ray Speth
b955395ed1 Skip cast from size_t to int when calling int2str 2012-02-27 18:14:17 +00:00
Ray Speth
a310345b9e Updated #includes to reflect new header file locations 2012-02-12 02:44:14 +00:00
Ray Speth
2528df0f75 Reorganized source tree structure
These changes make it unnecessary to copy header files around during
the build process, which tends to confuse IDEs and debuggers. The
headers which comprise Cantera's external C++ interface are now in
the 'include' directory.

All of the samples and demos are now in the 'samples' subdirectory.
2012-02-12 02:27:14 +00:00
Renamed from Cantera/src/zeroD/Reactor.cpp (Browse further)