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
Improve guidance for transition of deprecated thermo models #1008
Comments
This also affects one of the Jupyter examples, the 1-D PFR example that uses this input file: https://github.com/Cantera/cantera-jupyter/blob/main/reactors/data/SiF4_NH3_mec.cti |
I think the behavior in the development version is basically what should be expected - there's no trace of classes/models that have been previously deprecated and removed. The 2.5 release can and does issue deprecation warnings, although I'll certainly agree that in this case, some more guidance on how to adapt input files should be provided, since it requires moving the density information from the phase to the species definition. Also, I'm not quite sure where to put this on the website. For CTI, the input modifications are a little bit annoying, given the way density information gets embedded in the species entry and the fact that the density can only be expressed as a molar volume. The phase definition should be changed as follows: incompressible_solid(
name = "LEDC",
elements = "C H O Li",
species = "LEDC",
density = (1300, 'kg/m3'),
initial_state = state( pressure = OneAtm, mole_fractions = "LEDC:1.0")
) becomes: IdealSolidSolution(
name = "LEDC",
elements = "C H O Li",
species = "LEDC",
standard_concentration = "molar_volume",
initial_state = state( pressure = OneAtm, mole_fractions = "LEDC:1.0")
) And the species definition should be changed to add the species(
name = "LEDC",
atoms = "C:4 H:4 O:6 Li:2",
thermo = const_cp(h0 = (-1374.288, 'kJ/mol'), s0 = (88.78, 'J/mol/K')),
standardState = constantIncompressible(molarVolume=((4*12.011+4*1.00794+6*15.9994+2*6.941)/1300))
) For YAML input files, this is considerably simpler. The phase definition just needs to change the - name: LEDC
composition: {C: 4, H: 4, O: 6, Li: 2}
thermo:
model: constant-cp
h0: -1374.288 kJ/mol
s0: 88.78 J/mol/K
equation-of-state:
model: constant-volume
density: 1300 kg/m^3 I haven't seen that To be able to run the version of |
Thank you, @speth - this is a nice description of how to fix the problem reported in the group posting that prompted this issue.
I do agree that the current behavior is not unexpected and perfectly fine from a development point of view. However, I am more concerned about future questions about why cantera doesn't recognize a model in an input file that appears to be perfectly fine, and has an associated publication (as in the mayur case failing with a relatively unhelpful message |
I think you're right for cases where they can be caught in the C++ layer, where at it's simplest this would just require keeping a list of obsolete model names in the corresponding factory class. But in the case of |
👍 Really like the idea of handling this via factory classes for the C++ case |
Problem description
As illustrated in a recent UG post, the deprecation of some thermo models in 2.5 (e.g.
incompressible_solid
) does not provide sufficient feedback on details how those old models should be replaced, i.e.Beyond,
cti2yaml
does not appear to recognize the thermo model either, and simply states(note: this requires the development version due to #996)
Steps to reproduce
see UG post
Possible Solutions
As the phases are already marked for deprecation (and are already removed from the development version), there isn't much that can be done for 2.6. The main alternative would be to provide some guidance for transitions from CTI to YAML on the website.
The issue with
cti2yaml
not recognizingincompressible_solid
should be addressed, however. One solution would be to raise an error, and explicitly direct the user to the webpage that provides information on recommended steps.Behavior
System information
Other thoughts
Importing the offending file on the development branch results in the following error:
which could be improved also (e.g. fix the
ResoureWarning
, and provide clues for the user on how to proceed)The text was updated successfully, but these errors were encountered: