FlameBase.set_initial_guess calls removed SolutionArray.read_hdf without HDF support

Open Beginner friendly
#2,199 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Start in interfaces/cython/cantera/onedim.py at FlameBase.set_initial_guess, in the else branch after the if "native" in hdf_support() check, where SolutionArray.read_hdf is still called. Read how neighbouring code in the same file raises CanteraError for unsupported features so the wording matches. Done means the data="file.h5" path raises a CanteraError about needing HDF support instead of AttributeError; exercise it with the reproduction snippet and the onedim tests under test/python/.

Written by the indexing model from the issue text.

Description

Problem description

In a build without native HDF support, FlameBase.set_initial_guess(data="file.h5") calls SolutionArray.read_hdf (onedim.py, the else branch after if "native" in hdf_support()). That method no longer exists, so the call fails with AttributeError instead of a message that HDF support is required.

Steps to reproduce

Simulated with a native-HDF build:

import cantera as ct
import cantera.onedim
cantera.onedim.hdf_support = lambda: set()   # as in a build without HDF support
gas = ct.Solution("h2o2.yaml")
f = ct.FreeFlame(gas, width=0.03)
f.set_initial_guess(data="restart.h5", group="restart")

Behavior

AttributeError: 'SolutionArray' object has no attribute 'read_hdf'. Expected: a CanteraError saying that HDF input requires Cantera compiled with HDF support.

System information

  • Cantera version: 4.0.0a2, main at 25c1ab1 (built from source); also seen in 3.2.0
  • OS: Linux x86_64 (glibc 2.43)
  • Python 3.13.16, NumPy 2.5.4, Cython 3.3.1, SUNDIALS 7.2.0

Additional context

Found while writing tests for our own use of Cantera; the example was reduced and run by an AI coding agent (Claude Code), and checked against existing issues.

Dominant language
C++
Stars
885
Forks
438
Avg merge
3h 41m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Cantera/cantera

All issues in Cantera/cantera

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.