Skip to content

Minor parsing change to improve backward compatibility#82

Open
MarcoGrossi92 wants to merge 4 commits into
nasa:mainfrom
MarcoGrossi92:main
Open

Minor parsing change to improve backward compatibility#82
MarcoGrossi92 wants to merge 4 commits into
nasa:mainfrom
MarcoGrossi92:main

Conversation

@MarcoGrossi92

Copy link
Copy Markdown

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

  • Several tests were successfully run
  • Added a new test to validate the changes (example15.inp). The expected output added for regression tests.

Compatibility / Numerical behavior

  • No expected changes to numerical results

Copilot AI review requested due to automatic review settings May 15, 2026 12:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_token now upper-cases the token before validating, so element symbols like AL, al, or Al are all accepted.
  • parse_formula is refactored to reuse is_formula_element_token for boundary detection and stores element symbols in upper case, ensuring consistent matching against element_names.
  • New to_upper helper added; new test fixture example15.inp and reference output added, and example15 registered 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.

@markleader

Copy link
Copy Markdown
Contributor

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.

IF ( lcin(i).EQ.-2 ) THEN
  ix = INDEX(lc,cx2(2:2))
  IF ( ix.GT.0 ) cx2(2:2) = uc(ix:ix)
ENDIF

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 example15.inp file - this test only shows upper-case elements anyway, but I want to keep the current test_main.py test set as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants