Closed yoelcortes closed 4 years ago
@CalebBell, I added the combustion module plus the tests. I hope you're OK with using python's dataclass decorator, but we can always change this if not. It would be easy to change since the code is function oriented. I also added tests for each method and the scenarios I could think of, but I only directly test the combustion_data
function. I plan on adding a few tests later for the lower level functions. I'll also add tests later for possible exceptions.
I added Perry's handbook as a reference (where I got the Dulong equation from) and made sure to add examples and units for each function. Let me know if I missed anything.
Also, I came across this warning:
tests\test_numba.py:162
C:\Users\Yoel\OneDrive\Code\chemicals\tests\test_numba.py:162: PytestUnknownMarkWarning: Unknown pytest.mark.numba - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/latest/mark.html
@pytest.mark.numba
I think you probably forgot to register the mark somewhere.
Thanks!
I'll change the Dulong equation to not use molecular weight. Since it's used for coal, it doesn't make much sense to return hhv on a molar basis
I'll remove the classes and just use dictionaries. I realized this is probably better on the long run
This module is done! Tests and documentation are finished
The
Hcombustion
function right now does 2 things: find the stoichiometry, and calculate the higher heating value (HHV). Here are the enhancements I believe we could make:combustion_stoichiometry(formula, MW=None)
andHHV_stoichiometric(stoichiometry, Hf)
. The formula can be either a dictionary of elemental coefficients, or a string which would be parsed.HHV_modified_Dulong(formula, MW)
)LHV_from_HHV(HHV, N_H2O)
)In addition, we could make a lightweight CombustionData and CombustionStoichiometry object to store all the data generated to get HHV and leave LHV as a property (or not, the overhead almost unnoticeable ). For example:
Let me know what you think. I personally like how the data is frozen and there is no confusion with working with these classes, which are simply meant to hold data. Not sure if you've worked with
dataclass
, but there is always the asdict and astuple functions from thedataclasses
library that make these easy to work with (although asdict and astuple are a little slow).