-
-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
addSpecies should be disabled on ThermoPhase objects in use by reactors and flames #1457
Comments
#1663 and #1670/#1685 ensure that individual PS: there still is an issue with PPS: the relevant section describing this is cantera/interfaces/cython/cantera/thermo.pyx Lines 270 to 276 in ed27faf
|
Problem description
The
ThermoPhase::addSpecies
method can be used to add species to a phase dynamically. However, this capability is not compatible with objects such asReactor
orDomain1D
, which set internal array sizes based on the number of species in the phase at the time they are created.In Python, this is protected against by having
Solution
objects hold a weak reference anyReactor
,Domain1D
, orMixture
objects that use thatSolution
. No equivalent exists at the C++ layer, though, and adding species after creating such objects can lead to crashes.Managing this in a similar way in C++ would have been difficult until recently, but I think the transition to having objects like
Domain1D
hold theSolution
as ashared_ptr
(see #1385, for example) should make this more feasible after some of the old routes have been removed following Cantera 3.0. I think one prerequisite will be usingshared_ptr<Solution>
to set upReactor
objects, which have not had this change yet.Steps to reproduce
Replace the integration loop in
samples/cxx/combustor/combustor.cpp
with the following:(also requires adding includes for
cantera/thermo/Species.h
andcantera/thermo/SpeciesThermoFactory.h
)Behavior
The above segfaults after the first timestep.
Additional context
Initially discussed in PR review for #1456.
The text was updated successfully, but these errors were encountered: