Also eliminates undefined behavior associated with unchecked cast to
LatticePhase*, since, at least in the Li7Si3_ls.xml example file, the
sub-lattices can be represented as other ThermoPhase types,
e.g. StoichSubstance.
This changes the order in which tokens are identified to be strictly
descending in length, so that third bodies are identified correctly
even when the third body expression could potentially be interpreted
as containing a standalone species name.
Reactions of the type
A (+B) <=> C (+B)
ought to work, as long as they are provided a pressure-dependent rate
expression. This commit adds three examples to the test file. The first
works OK, the second two cause problems.
(For what it's worth, this currently crashes the official chemkin.
Or at least the parentheses do; I've not tested the plus.
Ansys have created a defect record and say they will fix the issue.)
If geometry flags are specified rather that can't be cast to integers,
intercept the ValueError raised by Python and raise a more sensible
exception.
Fixes#446
The CounterFlowDiffusionFlame (CFDF) code is able to perform more general cases
of npflame_init for multiple species fuel and oxidizer streams. The
stoichiometric mixture fraction in the CFDF code uses the Bilger definition of
mixture fraction, using the conservation of elements C, H, and O. This method is
used in the python module, but not the MATLAB npflame_init function.
Also, the CFDF code uses the fuel stream density to calculate the fuel stream
velocity and the oxidizer stream density to calculate the oxidizer stream
velocity, where as the npflame_init code uses the fuel density for both velocity
calculations.
The elementMassFraction code is a MATLAB version of the python function:
elemental_mass_fraction, which is needed to run the CFDF code.
Update the diffflame.m example to use the more general CFDF function since the
input parameters are different than the npflame_init function. This example is
the same as the diffusion_flame.py sample in the Python module.
This fixes some platform-specific test failures when compiling in debug mode,
where estimated temperatures during the Newton iterations were too high,
resulting in non-finite reaction rates.
A very small change that allows the user to set the initial location of the flame. The original hard-coded values for "locs" are retained as the default, but the user can now modify locs.
The previous formulation will only consider a rection as electrochemical
if a beta value is supplied for that reaction *and* the reaction is an
'edge_reaction.' This is problematic for two reasons: (1) many/most
charge-transfer reactions of interest occur at two-phase boundaries (see,
for example, Li-ion batteries and PEM fuel cells), not the three-phase-
boundary-like edges (which are most relevant for SOFCs). (2) determining
whether a reaction is electrochemical or not should not rely at all upon
user input - the program itself should check to see whether charge is
transferred between phases, and the appropriate steps should be taken
during rate-of-progress calcuations.
This commit addresses the former issue. Currently, if a charge-transfer
reaction is written as a surface_reaction, the code does not apply the
voltage correction to the forward rate. By default, then, the entire
voltage correction is applied to the reverse reaction, which is the same
as setting beta = 0; not a good 'default' behavior (beta = 0.5 is a more
appropriate default). With this change, surface reactions can now be
supplied with a beta value in cti or xml formats, and will be recognized
as a charge transfer reaction.
Longer term, it would be better to change the constructor routines such
that charge transfer is automatically detected and handled, rather than
relying upon user-specified flags.