Hi Lukas,
The best way to create multiple identical ThermoPhase
objects is to initialize them from the same input file, and then set them to the same state. To copy the state information as it is stored by the ThermoPhase
object, you can use the saveState(vector_fp& state)
and restoreState(vector_fp& state)
methods (with the size of the vector needed provided by stateSize()
). For most phase models (including Peng-Robinson and Redlich-Kwong), these variables are the temperature, density, and mass fractions.
The old method of duplicating ThermoPhase
objects using the copy constructor was removed because it was complex to maintain and rarely useful (and because it was rarely used, it was prone to errors that were not easily found). Copying a whole ThermoPhase
object (or worse, a Kinetics
or Transport
object) is an expensive operation compared to just keeping multiple state vectors for different mixture states. This is, for instance, how the 1D flame model uses a single set of ThermoPhase
, Kinetics
, and Transport
objects to represent hundreds of points within the flame. I’m curious about your reason for wanting to duplicate ThermoPhase
objects, to help understand whether there is indeed a use case for this that I haven’t thought of.
Regards,
Ray