-
-
Notifications
You must be signed in to change notification settings - Fork 409
Description
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.
DeprecationWarning: class ConstDensityThermo: To be removed after Cantera 2.5.0. Consider replacing with LatticePhase or IdealSolidSolnPhase
Beyond, cti2yaml does not appear to recognize the thermo model either, and simply states
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/cantera/cti2yaml.py", line 1567, in convert
exec(code)
File "Mayur.cti", line 81, in <module>
incompressible_solid(
NameError: name 'incompressible_solid' is not defined
(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 recognizing incompressible_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
- Cantera version: 2.5.1 / 2.6.0a0 (which fixes cti2yaml bug cti2yaml failure #996)
Other thoughts
Importing the offending file on the development branch results in the following error:
cantera._cantera.CanteraError:
***********************************************************************
CanteraError thrown by call_ctml_writer:
Error converting input file "./Mayur.cti" to CTML.
Python command was: '/usr/bin/python3'
The exit code was: 4
-------------- start of converter log --------------
/usr/local/lib/python3.6/dist-packages/cantera/ctml_writer.py:2729: ResourceWarning: unclosed file <_io.TextIOWrapper name='./Mayur.cti' mode='r' encoding='ANSI_X3.4-1968'>
text = open(filename, open_mode).readlines()
NameError on line 81 of ./Mayur.cti:
name 'incompressible_solid' is not defined
| Line |
| 76 | initial_state = state( mole_fractions = "electron:1.0")
| 77 | )
| 78 |
| 79 | # SEI - Lithium ethylene dicarbonate LEDC - (CH2OCO2Li)2
| 80 | #------------------------------------------------------------------
> 81 > incompressible_solid(
| 82 | name = "LEDC",
| 83 | elements = "C H O Li",
| 84 | species = "LEDC",
--------------- end of converter log ---------------
***********************************************************************
which could be improved also (e.g. fix the ResoureWarning, and provide clues for the user on how to proceed)