The chemistry model now solves a system of mass fractions, temperature
and pressure, rather than a system of concentrations, temperature and
pressure.
The new form now accounts for the change in reaction rate associated
with thermal expansion. Thermal expansion (or contraction) can dilute
(or concentrate) the species concentrations, thereby reducing (or
increasing) the reaction rates. Previously it was not possible to
include this term because it was not computationally feasible to
evaluate it in a system in which the state variable was concentration.
The reaction rate interface has been simplified with respect to the
generation of derivatives. Reactions are defined as k*C, where k is the
reaction rate and C is the product of concentrations (raised to their
stoichiomentric coefficients and/or specified powers). Reaction rate
classes now provide two logical functions governing the derivatives of
k; i.e., ddT (derivative w.r.t. temperature) and ddc (derivative w.r.t.
concentration). Previously the reaction rate interface was closely
related to the form of third-body reactions, which made it inconvenient
to implement rates that were not very third-body-like.
It is now possible to verify the implementations of the jacobian methods
by comparison with finite-difference based evaluations of the rate
methods. This has been done and a number of bugs have been found and
fixed in the reaction rate classes.
The chemistry models have been corrected so that the temperature
derivative terms in the jacobian are correct and are consistent with the
derivatives method. This has resulted in a modest improvement in the
efficiency of the ODE integration.
A debug checking routine has been added to ODESystem which prints the
correspondence between the implemented jacobian and one constructed from
calling the derivatives method with finite differences. This will
facilitate convenient verification of the implementation in the future.
In addition a clean up of the derivatives and jacobian functions was
performed. Unused code has been removed and variables have been renamed
more meaningfully. Duplicate code has also been removed from the TDAC
chemistry model.
In chemistryModel "li" is set to the current cell index but for other reacting
systems it should be set to the current index of the element for which the
reaction system is being evaluated.
In the ODESolver "li" is the current index of the element for which the ODE
system is being solved if there is a list of related systems being solved,
otherwise it can be set to 0.
Currently these deleted function declarations are still in the private section
of the class declarations but will be moved by hand to the public section over
time as this is too complex to automate reliably.
In constant/chemistryProperties in addition to the specification of the initial
ODE integration time-step used at the start of the run:
initialChemicalTimeStep 1e-12;
this time step may now also be specified for every chemistry integration by
setting the optional entry maxChemicalTimeStep, e.g.
maxChemicalTimeStep 1e-12;
In early versions of OpenFOAM the scalar limits were simple macro replacements and the
names were capitalized to indicate this. The scalar limits are now static
constants which is a huge improvement on the use of macros and for consistency
the names have been changed to camel-case to indicate this and improve
readability of the code:
GREAT -> great
ROOTGREAT -> rootGreat
VGREAT -> vGreat
ROOTVGREAT -> rootVGreat
SMALL -> small
ROOTSMALL -> rootSmall
VSMALL -> vSmall
ROOTVSMALL -> rootVSmall
The original capitalized are still currently supported but their use is
deprecated.
Note: this reuses the existing storage rather than costly reallocation
which requires the initial allocation to be sufficient for the largest
size the ODE system might have. Attempt to set a size larger than the
initial size is a fatal error.