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

Correct_atomic_balance does not work on methane combustion equation #28

Closed
fwitte opened this issue Nov 17, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@fwitte
Copy link
Contributor

fwitte commented Nov 17, 2020

Hi Yoel,
I always like to try and fiddle with new code/software and wanted to create something I am more familiar with than biodiesel reactions :), a combustion reaction of methane with auto correcting the atomic balance. Unfortunately, I do not really know what I am doing wrong here, can you help me? I would expect, that the atomic balance can be solved here.

import thermosteam as tmo
from thermosteam import reaction as rxn

chemicals = tmo.Chemicals(['Water', 'Methane', 'CO2', 'O2'])
tmo.settings.set_thermo(chemicals)
combustion = rxn.Reaction('Methane + O2 -> Water + CO2',
                                   reactant='Methane', X=1,
                                   correct_atomic_balance=True)

Thanks and best regards
Francesco

@yoelcortes
Copy link
Member

yoelcortes commented Nov 17, 2020

Thanks so much for testing this out. I enhanced the correct_atomic_balance method to be more flexible (check out the latest git version or "pip install thermosteam==0.21.8). Your test should work now:

>>> import thermosteam as tmo
>>> from thermosteam import reaction as rxn
>>> chemicals = tmo.Chemicals(['Water', 'Methane', 'CO2', 'O2'])
>>> tmo.settings.set_thermo(chemicals)
>>> combustion = rxn.Reaction('Methane + O2 -> Water + CO2',
...                                reactant='Methane', X=1,
...                                correct_atomic_balance=True)
>>> combustion.show()
Reaction (by mol):
 stoichiometry                    reactant    X[%]
 Methane + 2 O2 -> 2 Water + CO2  Methane   100.00

I updated the documentation with more details too:
https://thermosteam.readthedocs.io/en/latest/reaction/Reaction.html#thermosteam.reaction.Reaction.correct_atomic_balance

Let me know if you have any further questions!

@yoelcortes yoelcortes added the bug Something isn't working label Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants