This will prevent floating point exceptions (sometimes enabled by third-party
codes) in case c[1] or c[2] are zero but will not change the current behaviour
if c[1] and c[2] are not zero.
In the case where temperature changes but the mole fractions are the same, we
still need to apply the enthalpy and entropy offsets to the tabulated species.
Since IdealSolidSolnPhase::_updateThermo wasn't a virtual method, and
the signatures didn't match (const vs non-const), calls to this method
from IdealSolidSolnPhase weren't being overridden by
BinarySolutionTabulatedThermo::_updateThermo as expected.
If Sundials tries to create an excessively large matrix, it returns a null
pointer. To avoid a subsequent segfault, throw an exception which makes the
cause of the error clear.
WIP: Better error message for too-large Sundials matrix
TEMP: fixup for cvodes error messages
The density of IdealSolidSolnPhase and BinarySolutionTabulatedThermo objects was
not being computed as part of construction, causing code that interacted with
them using setState/restoreState, such as the 'Solution' constructors in Matlab
and Python, to fail.
Previously, BinarySolutionTabulatedThermo::_updateThermo created a new
`speciesThermoInterpType` intance every time the thermo was updated,
storing the tabulated thermo lookups as the reference state thermo.
This has now been changed such that the reference state is used only
to represent the temperature effects on the thermo, with the tabulated
terms added to this reference state. This should be a more efficient
implementation.
Previously the model imported the tabulated data assuming it was given
in J, mol, K units, and ignoring any user input in the cti file, w/r/t
units. This fixes that, by amending the `getFloatArray` calls in
thermo/BinarySolutionTabulatedThermo.cpp
-Fixes small typo id incclude/cantera/base/utilities.h docstring
-Removes `m_formGC` from BinarySolutionTabulatedThermo class, and
instead utilizes version and functionality inherited from parent
class `IdealSolidSolnPhase`.
-Moves samples/matlab/lithium_ion_battery/lithium_ion_battery.cti
to data/inputs/lithium_ion_battery.cti
-Fixes typo in test/data/BinarySolutionTabulatedThermo.cti
-Updates expected_result values in several test cases in
test/thermo/BinarySolutionTabulatedThermo_Test.cpp
Standard concentrations in the IdealMolalSolution phase depend on
a user-specified m_formGC parameter, where m_formGC=0 results in a
standard concentration of 1.0, m_formGC = 1 is supposed to result in
a standard concentration for species k equal to 1 divided by the
molar volume of species k, and m_formGC = 2 is supposed to result in
a standard concentration equal to 1 divided by the molar volume of the
solvent species (which is species 0).
Current behavior is that m_formGC = 1 and m_formGC = 2 *both* result
in a standard concentration of 1 divided by molar vlume of the solvent.
This commit fixes how this is handled, cleans up the switch statement
(the three cases were written somewhat inconsistently), and throws
an error if m_formGC is set < 0 or > 2.
Using negative values to indicate unspecified parameters doesn't work, since
either constant in "a = a0 + a1*T" can be negative and still produce a positive
value for "a". Instead, NaN can be used for this purpose.
Since VPStandardStateTP and derived classes do not use the reference state
thermodynamic properties in the m_spthermo object, we can just install
placeholder objects there, and eliminate the wrapper clas STITbyPDSS.
In some models, SpeciesThermoInterpType objects on individual species are not
used. Instead of requiring the specification of placeholder thermo data, this
allows the base SpeciesThermoInterpType class to be used, which will throw an
exception if it is inadvertently used.
Eliminate several member variables which shadow variables of the
VPStandardState class, and actually contained the same information
calculated a different way.
Adds capability for RedlichKwongMFTP to read a database of critical properties
for Tc and Pc of common species, so that users do not need to input pureFluidParameters
for every single species, thereby reducing burden during creation of new cti files.
For any species where pureFluidParameters are not provided by the user, function
getCoeffs scans the database looking for matches. Any unmatched species will throw
an error. Currently only scans by species name string, and is only intended for
common species with well-known critical properties.
Current operation is quite slow if the table is consulted for a large number of
species. In the future, should also implement the capability to write the updated
pureFluidParameters back into the xml file, so the user only has to perform the lookup
once.
When the nonreactant_orders option was enabled, specifying reactant orders for
species which were not present in the phase previously resulted in out-of-bounds
memory access.
Discontinuities in heat capacity, in contrast to enthalpy and entropy, are less
of a problem and are not always indicative of problems with a mechanism. As
such, a looser tolerance on this quantity is reasonable.
This threshold eliminates warnings from the nDodecane_Reitz.cti input file included with Cantera.
Looser tolerances can lead to instabilities, especially in cases where negative
concentrations of charged species are found at the end of the first solving
stage.