BioSTEAMDevelopmentGroup / thermosteam

BioSTEAM's Premier Thermodynamic Engine
Other
57 stars 12 forks source link

Add enthalpy calculation in thermosteam.reaction? #15

Closed yalinli2 closed 4 years ago

yalinli2 commented 4 years ago

Description I'm wondering whether it makes sense to automatically calculate reaction enthalpy in stoichiometric reactions? Basically calculate the Hrxn based on Hf of reactants/products and reaction conversions, then when performing the reaction, have the Hrxn added to the H of product streams (this can be optional), thanks!

yoelcortes commented 4 years ago

Thanks for the request. I've thought about this before, but realized that it may be more transparent to let the user add this calculation for a couple of reasons:

yalinli2 commented 4 years ago

Thanks for the reply!

I agree that it's more transparent for the users to decide whether to add the calculation. However I'm having trouble wrapping my head around whether we need to calculate H_rxn at all - since stream.H is automatically calculated, does the new stream.H after reaction already include H_rxn?

Thanks!

yoelcortes commented 4 years ago

So stream.H is the enthalpy without heats of formation. An energy balance assuming adiabatic conditions would say:

(H_out + Hf_out) - (H_in + Hf_in) = 0 H_out = H_in + Hf_in - Hf_out

An this is what is going in: stream.H = Hnet_0 - stream.Hf

I made a mistake of assuming the H_in is equal to H_out after the reaction (which is only true if the heat capacity flow rate is the same). I corrected it in my first post. I think it would be helpful to add a method for this... Even I made a mistake initially jaja

yalinli2 commented 4 years ago

Cool! I just sent a pull request, I only add one adiabatic_reaction function in _reactions.py, but github shows that I made a lot of changes in the last commit, probably because I pasted my local file there instead of editing the original file. Feel free to edit/let me know what test I should run to make it work (as a learning experience), thanks!

BTW, I didn't know thermosteam is this big, there seems to be 1.5+ G hidden files, what are those?

yoelcortes commented 4 years ago

Awesome! Please see my comments on the pull requests. The 1.5 G is mostly github, which saves all the branches and commits (so you can always go back to alternative versions).