Minor parsing change to improve backward compatibility#82
Minor parsing change to improve backward compatibility#82MarcoGrossi92 wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a backward-compatibility issue when parsing CEA reactant formulas: element symbols are now treated case-insensitively (uppercase, lowercase, and mixed-case all accepted), matching the behavior of the original CEA program. A regression test (example15) is added.
Changes:
is_formula_element_tokennow upper-cases the token before validating, so element symbols likeAL,al, orAlare all accepted.parse_formulais refactored to reuseis_formula_element_tokenfor boundary detection and stores element symbols in upper case, ensuring consistent matching againstelement_names.- New
to_upperhelper added; new test fixtureexample15.inpand reference output added, andexample15registered in the test list.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| source/input.f90 | Case-insensitive parsing of formula element tokens; new to_upper helper; refactor of parse_formula loop |
| test/main_interface/example15.inp | New CEA input with mixed-case element symbols (e.g. CL, AL) for regression coverage |
| test/main_interface/reference_output/example15.out | Expected reference output for the new example15 test |
| test/main_interface/test_main.py | Registers example15 under the rocket problems test list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @MarcoGrossi92 , thanks for the PR. Upper-casing all input elements is too restrictive. In CEA2, the only case handling is for a two-character symbol’s second character: Cl becomes CL, Fe becomes FE, etc. So accepted forms include C, H, O, S, Cl, CL, Fe, FE. Rejected/misparsed forms include c, h, cl, fe. If you update the parser to more closely match this behavior, I can accept the PR. For testing: please remove the |
Summary
Changes
Found a backward compatibility issue reading an old CEA input file that worked with the old CEA program. The problem was related to the parsing of the input file. Minor changes were committed to ensure the full and proper reading.
Testing
Compatibility / Numerical behavior