Skip to content
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

Documentation bug for YAML format #1001

Closed
leesharma opened this issue Mar 26, 2021 · 0 comments · Fixed by #1002
Closed

Documentation bug for YAML format #1001

leesharma opened this issue Mar 26, 2021 · 0 comments · Fixed by #1002

Comments

@leesharma
Copy link
Contributor

One of the documentation examples in Solution (link to code | link to site) demonstrating that Species and Reactions can be imported from input files to construct Solutions appears to be invalid in 2.5. When using yaml inputs, ct.Reaction.listFromFile needs a Kinetics object as the second argument.

Solution objects can also be constructed using Species and Reaction objects which can themselves either be imported from input files or defined directly in Python:

spec = ct.Species.listFromFile('gri30.yaml')
rxns = ct.Reaction.listFromFile('gri30.yaml')  ## broken ##
gas = ct.Solution(thermo='IdealGas', kinetics='GasKinetics',
                  species=spec, reactions=rxns, name='my_custom_name')

The example should probably be corrected (either adding the second argument or switching back to cti/xml) or removed. The issue was introduced in #696, which updated a bunch of *.cti to *.yaml in the docstrings.

leesharma added a commit to leesharma/cantera that referenced this issue Mar 26, 2021
Makes the `Reaction.listFromFile` example valid by adding the required
Kinetics object as the second argument (`gas`, created in the example
above.)

I'm not sure if this is the best solution: it has the major downside of
requiring `gas` to already be initialized to a `Kinetics` object with
the appropriate species. I'm new to Cantera, but I couldn't find an easy
way to make a "dummy" Kinetics object. Is there a better way to do this?

Maybe the example should just be removed?
speth pushed a commit that referenced this issue Mar 27, 2021
Makes the `Reaction.listFromFile` example valid by adding the required
Kinetics object as the second argument. Now the example will run as-is and
includes a sentence stating that the `Kinetics` object is required with YAML.

Fixes #1001
bryanwweber pushed a commit to bryanwweber/cantera that referenced this issue Apr 20, 2021
Makes the `Reaction.listFromFile` example valid by adding the required
Kinetics object as the second argument. Now the example will run as-is and
includes a sentence stating that the `Kinetics` object is required with YAML.

Fixes Cantera#1001
bryanwweber pushed a commit to bryanwweber/cantera that referenced this issue Apr 20, 2021
Makes the `Reaction.listFromFile` example valid by adding the required
Kinetics object as the second argument. Now the example will run as-is and
includes a sentence stating that the `Kinetics` object is required with YAML.

Fixes Cantera#1001
bryanwweber pushed a commit that referenced this issue Apr 24, 2021
Makes the `Reaction.listFromFile` example valid by adding the required
Kinetics object as the second argument. Now the example will run as-is and
includes a sentence stating that the `Kinetics` object is required with YAML.

Fixes #1001
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 a pull request may close this issue.

1 participant