CalebBell / thermo

Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)
MIT License
594 stars 114 forks source link

TDependentProperty Integrals, possible improvement #85

Closed yoelcortes closed 2 years ago

yoelcortes commented 2 years ago

Hi Caleb,

Hope you're doing well! I'd like to discuss with you some possible improvements to the behavior of TDependentProperty integrals when the temperature is outside the valid temperature range.

In particular, for heat capacity, there are checks inside of the Zabransky methods, but none in the other integral methods. It would be nice to enforce these checks in the T_dependent_property_integral method when extrapolation is not set. This would be possible my simply using the already available T_limits dictionary.

When extrapolation is set, we could do piece-wise integrals for the segments outside the valid temperature range. We would also need to code in the right extrapolation formula for each available extrapolation option.

How would you feel about a "extrapolate_integral" and "extrapolate_integral_over_T" methods that get called in "T_dependent_property_integral" and "T_dependent_property_integral_over_T" methods when a T falls outside the valid range?

~I also think we should switch to use the "force_calculate" methods of the Zabransky objects, so that the checks all happen outside the function call just once. I can take care of this in the near future.~

Let me know your thoughts, but no rush! Thanks!

CalebBell commented 2 years ago

Hi Yoel! This all sounds good to me. The same applies to the derivative calls as well. It's hard to get everything all the way there. Please note that some of the extrapolation methods probably may not have analytical integrals, so will still need to be evaluated numerically.

Sincerely, Caleb