Peng Robinson EOS - Сообщения
Alvaro.
PR_work.sm (102 КиБ) скачан 93 раз(а).
I wanted to notice that this and other EOSs are available as CoolProp Wrapper extension. CoolProp library contains its own implementation of multiple substances properties (Propane is here), and their mixtures, but also provides access to REFPROP if installed.
Nevertheless, writing EOS implementations yourself is a great excercise. My notice isn't meant to discourage you; I myself used to implement IAPWS IF97 EOS formulations (IAPWS-IF97.sm (508 КиБ) скачан 80 раз(а).) some time ago.
Wrote
I wanted to notice that this and other EOSs are available as CoolProp Wrapper extension. CoolProp library contains its own implementation of multiple substances properties
Sure. Are for teach only, CoolProp can be used, with the same precautions of RefProp for real world problems. Check the las exercise, taken from Cengel (and EES software): CoolProp (and others) fails, and need to downgrade to some more simple model.
MassAndEnergyInCV.sm (206 КиБ) скачан 80 раз(а).
Best regards.
Alvaro.
WroteI myself used to implement IAPWS IF97 EOS formulations (IAPWS-IF97.sm (508 КиБ) скачан 80 раз(а).) some time ago.
Really like the organization on the sheet. I can learn from it just by looking at the title of the collapsed region and the equations that follow.
WroteWroteI myself used to implement IAPWS IF97 EOS formulations (IAPWS-IF97.sm (508 КиБ) скачан 80 раз(а).) some time ago.
Really like the organization on the sheet. I can learn from it just by looking at the title of the collapsed region and the equations that follow.
All my respect for this extensive file.
By the way, in SM build 5990 the viscosity calculations under Временные расчёты will throw an error(Units don't match) although units are correct (put them manually and the result is Ok). This error is not present in the previous SM build.
Regards,
Radovan
Actually, it wasn't touched for very long time, and wasn't completed. I only attached it in case if someone finds it useful demo. Of course, it could have bit-rotten. But I won't update it, because I don't use it anymore.
Razonar, I hope that you, of course, expressed your appreciation to those who give us their knowledge, time and energy for free, by filing a bug report about those problems you found at library issues tracker?
Actually, I haven't yet looked into your calculations deeply, but I feel it strange that you look for pressure of Tetrafluoroethane with T=-20°C and enthalpy=234.55 kJ/kg, the same as at +20°C and P=800 kPa. You marked it "FAILS", and provided manual value of 150.8 kPa, but it cannot be that: how can a liquid at lower temperature AND pressure have the same energy as at higher temperature and pressure? Actually, interpolation says it should be about 140 MPa, far higher than upper limit of EOS (70 MPa).
Wrote
Razonar, I hope that you, of course, expressed your appreciation to those who give us their knowledge, time and energy for free, by filing a bug report about those problems you found at library issues tracker?
Actually, I haven't yet looked into your calculations deeply, but I feel it strange that you look for pressure of Tetrafluoroethane with T=-20°C and enthalpy=234.55 kJ/kg, the same as at +20°C and P=800 kPa. You marked it "FAILS", and provided manual value of 150.8 kPa, but it cannot be that: how can a liquid at lower temperature AND pressure have the same energy as at higher temperature and pressure? Actually, interpolation says it should be about 140 MPa, far higher than upper limit of EOS (70 MPa).
Yes, I say thanks last week in the post of CoolProps. It's a big effort, and they share they knowdalge and expertise, which is very preciate.
About the fail, which fail is air. And isn't a bug in CoolProps or the wrapper, it's a failure of the model in general: can't derive a dependence between Cp and T, P at the same time. For this reason, which is used is a more simple model for the Cp with a dependence only for the temperature. So, there are no need for poste any issue with CoolProp, because there are not one. Eventually, ask for a new utility: provide ideal gas equations too.
Attached, a capture screen from EES showing u evaluated only as funcion of T.
WroteAbout the fail, which fail is air. And isn't a bug in CoolProps or the wrapper, it's a failure of the model in general: can't derive a dependence between Cp and T, P at the same time. For this reason, which is used is a more simple model for the Cp with a dependence only for the temperature.
Actually, I couldn't see this in the sheet you've attached earlier: there seem to be a number of problems in the Air section, including using T[1 and P[1 (extracting elements) where T and P are set to be scalar, and it seems T.air and P.air should be used.
Could you please clean up, refine and annotate your example so that your point would be clear, so that I could try to come up with a workaround? Just out of curiosity.

EDIT: If my presumptions are right, then there's no fundamental model shortage in your Air sample, only not-yet-implemented input pair:
MassAndEnergyInCV-air.sm (25 КиБ) скачан 36 раз(а).
What is wrong here is trying to use two different models in one solution. You use more precise real-gas model for some system properties, and at the same time want to use simpler ideal-gas model for other properties of the same process. This approach is fundamentally wrong, and cannot give you sensible results.
But now I don't understand this:
WroteSure. Are for teach only, CoolProp can be used, with the same precautions of RefProp for real world problems. Check the las exercise, taken from Cengel (and EES software): CoolProp (and others) fails, and need to downgrade to some more simple model.
This was the response to me informing you that there is an implementation of EOS you shared in the first message. You implemented not a simpler model, so I cannot see an interconnection between my message and your objection. Yes, CoolProp cannot be used for any possible task in life, and it prepares poor coffee, too, but it is suitable for the task that you implemented in the first place.
Wrote
Actually, I couldn't see this in the sheet you've attached earlier: there seem to be a number of problems in the Air section, including using T[1 and P[1 (extracting elements) where T and P are set to be scalar, and it seems T.air and P.air should be used.
Could you please clean up, refine and annotate your example so that your point would be clear, so that I could try to come with a workaround? Just out of curiosity.
T, P are vectors. CoolProp can't work in that region for air, but isn't alone, there are others (like EES, for example).
Refprop can handle this problem, but with Cp(T) (or Cv for u) I guess.
Attached the workaround: use IG equations (Constant K = P1 V1 / T1 = P2 V2 / T2 ) which give very close solutions.
So, attached, the "clean" implementation.
Best regards.
Alvaro.
Air in piston-cylinder fitted with stops.sm (34 КиБ) скачан 43 раз(а).
WroteT, P are vectors.
They are not in your MassAndEnergyInCV.sm (206 КиБ) скачан 80 раз(а).
There you re-define them to be scalars right above the Air calculations, and then define other vectors: T.air and P.air.
WroteCoolProp can't work in that region for air
Well, this is already fixed in CoolProp version 6.0.0, but the wrapper isn't yet updated, because in 6.0.0, they broke their get_parameter_information_string.
So, there WAS something to submit to them as an issue.
"Liquid Air, Encyclopedia of gases" I can see some non convenient items in
the "Utilities PR". Essentaially, it is a missconcept attempting to instruct
Smath to be algo style "Unary A(f,x)". Smath is already coded algo style.
That's what makes it a powerful calculator/solver... just like this
That's too simple. Revisit the attached example, several instances algo style.
Can't be simpler in concept, works logical simple from native coding, easy to
design ... works as designed, easy to debug.
Model Chemist Genfit.sm (56 КиБ) скачан 33 раз(а).
Wrote
What is wrong here is trying to use two different models in one solution. You use more precise real-gas model for some system properties, and at the same time want to use simpler ideal-gas model for other properties of the same process. This approach is fundamentally wrong, and cannot give you sensible results.
Oh! My bug. Please, add that as an issue in the svn server.
Regards.
Alvaro.
WroteWroteT, P are vectors.
They are not in your MassAndEnergyInCV.sm (206 КиБ) скачан 80 раз(а).
There you re-define them to be scalars right above the Air calculations, and then define other vectors: T.air and P.air.
So ... T, P are vectors. T.air, P.air too. Assign's at the left margin like T=0, h=0 as null scalars are usual practice in math cad programs for ensure that redefinitions, like T[2 = xx, don't carry up old values.
Alvaro.
WroteSo ... T, P are vectors. T.air, P.air too. Assign's at the left margin like T=0, h=0 as null scalars are usual practice in math cad programs for ensure that redefinitions, like T[2 = xx, don't carry up old values.
No.
When you assign T:=0, in SMath you actually do set T to be scalar 0.
If you then try to use el() on it, like in t:=el(T,1), then you will get an error that argument is not proper.
It doesn't matter that in some other program it may be another way.
Please re-examine again your file, before further doubting my words.
You assigned P and T to be 0, didn't fill them to be vectors again, and used their non-existing elements in Prop() functions. That gave errors.
If you would assign them values like you shown in your previous post, then it would be a different story.
WroteYou used it in assignment, while I explicitly noted that it gives error when used to get value of an element.
And that is about of what of my bugs?
Alvaro.
Wrote
Please re-examine again your file, before further doubting my words.
You assigned P and T to be 0, didn't fill them to be vectors again, and used their non-existing elements in Prop() functions. That gave errors.
If you would assign them values like you shown in your previous post, then it would be a different story.
I chek the attach: Just usual develop strategies for isolate real cause of issues.
Best regards.
Alvaro.
In the last screenshot, where you do re-define T and P as vectors after defining T.air and P.air, the T:=0 and P:=0 are redundant.
-
Новые сообщения
-
Нет новых сообщений