Expanding Property Packages #375
-
Hello! I have been trying to develop my own property package (cubic EoS). I initially began following the IDAES documentation, only to find that a lot of it is very close to the generic BT one available. Therefore, I opted to modify the already existing BT one to include my components of interest (CO2, H2, etc.). I thus gathered all the required parameters for these species. Initially I had errors with allowing CO2 and H2 to exist in anything other than the vapor phase. When I removed this, the error changed, and now the final error statement goes like: I have a few questions: Thanks in advance for your help. I am willing and ready to share with you the files I am using. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
Hi @dimi3saad, a If you want to model dissolution of thee species in the liquid phase, you would need to use Henry's Law instead. However, the existing property package do not support Henry's Law yet, so you would need to custom code this yourself for now (we are looking at adding Henry's Law to the generic property framework in the upcoming month). If you do chose to write your own property package, I would suggest not starting with the generic framework - there is far to much complexity in there to make it easy to modify. Instead, you could look at the older Cubic EoS model (https://github.com/IDAES/idaes-pse/tree/main/idaes/generic_models/properties/cubic_eos) as a starting point. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply @andrewlee94 ! I have no interest in modeling CO2 and H2 as liquids (feed is at atmospheric temperature and pressure). Because of that, I have assigned in the package I developed that CO2 and H2 only exist in the vapor phase. Doing so however still leads to the math domain error. Do you think it could be caused by something else in the package? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
We would need more information on the code and actual error to give you anything more specific. Given that this is a math domain error and not a solver error, it implies that this is occurring during evaluation of an expression during code execution. This could theoretically happen for any expression, so there is no way to narrow it down without more information. Could you provide us with the full stack trace for the error message, as well as the files you are using? |
Beta Was this translation helpful? Give feedback.
-
Definitely. I have attached the files here in a ZIP file. The .py file is the actual property package code, which should be put in the cubic EoS folder on your PC. The 2nd (.ipynb) is the one I was running, which is a modified version of the heater example. Thank you so much. Please let me know if you need anything else. |
Beta Was this translation helpful? Give feedback.
-
@dimi3saad I think you sent the wrong Jupyter notebook; the one you attached appears to be the standard Heater example and uses the benzene-toluene property package instead of your custom one. Also, could you please include the full error traceback so that we can see what is going wrong for you and where - this can be important in case we cannot reproduce the error ourselves. I had a quick look at your property package and did not see any obvious issues. However, I would suggest you consider using the newer Generic Properties Framework instead; it is much easier to use and hopefully more robust. |
Beta Was this translation helpful? Give feedback.
-
Hi again, I just had a look through the lines of code that were failing, and the problem lies in the Cubic EoS model. It was written before we included support for non-condensable components and assumes that all components exist in the liquid phase. Thus, it includes the non-condensable species when trying to calculate initial values for the bubble and dew points - as these are well above their critical points, the resulting vapour pressure is extremely large which results in the math domain errors. So, what are the possible fixes:
I will also talk to the other developers and see if we want to update the Cubic EoS model, although I think we are gradually trying to deprecate it. |
Beta Was this translation helpful? Give feedback.
Hi again,
I just had a look through the lines of code that were failing, and the problem lies in the Cubic EoS model. It was written before we included support for non-condensable components and assumes that all components exist in the liquid phase. Thus, it includes the non-condensable species when trying to calculate initial values for the bubble and dew points - as these are well above their critical points, the resulting vapour pressure is extremely large which results in the math domain errors.
So, what are the possible fixes: