Closed yoelcortes closed 1 year ago
This pull gives a bit more consistency between add and subtract methods in Reaction objects so that they work with zeros and None values. The following now works:
import thermosteam as tmo tmo.settings.set_thermo(['H2O', 'H2', 'O2'], cache=True) reaction = tmo.Reaction('2H2O -> 2H2 + O2', reactant='H2O', X=0.4) # add new_reaction = (reaction + None) # This was already added by a recent commit assert new_reaction.X == reaction.X new_reaction = (reaction + 0) assert new_reaction.X == reaction.X # sub new_reaction = (reaction - None) assert new_reaction.X == reaction.X new_reaction = (reaction - 0) assert new_reaction.X == reaction.X # iadd reaction += 0 assert new_reaction.X == reaction.X reaction += None assert new_reaction.X == reaction.X # isub reaction -= 0 assert new_reaction.X == reaction.X reaction -= None assert new_reaction.X == reaction.X
Thanks!
I went ahead and merged to mark long-term support for this math behavior with reaction objects and None types (which some old biorefineries rely on).
This pull gives a bit more consistency between add and subtract methods in Reaction objects so that they work with zeros and None values. The following now works:
Thanks!