ibell / coolprop

Deprecated version - go to
https://github.com/CoolProp/CoolProp
MIT License
24 stars 16 forks source link

Two-phase properties (Modelica Wrapper) #21

Closed kaern closed 11 years ago

kaern commented 11 years ago

Two-phase properties such as specific heat capacity at constant volume and speed of sound is missing compared to e.g. Modelica.Media.Water.StandardWater or ExternalMedia.Media.FluidPropMedium.

I need cv to get state properties from internal energy and density. I iterate for temperature such that Residual = u_known - Medium.specificInternalEnergy(Medium.setState_dT(d_known,T))
using newton raphson and differentiating internal energy wrt temperature at const density is cv.. Also, I use the speed of sound to limit the numerical flux using flux/slope limiters.. even though I know speed of sound is undefined for two-phase flow, the reference definition is missing..

Is it possible to update the computation of these properties.. I find your library very fast and promising!! The TTSE is really fast :-)

ibell commented 11 years ago

Those properties are not included in the two phase region because they are not defined for quality in the open interval (0,1). At the phase boundaries they should be fine.

There are alternative definitions of these parameters in the two-phase region, but there are no thermodynamically consistent ways to define them in the two-phase region. If you could direct me to a reference that shows how to define them in the two-phase region, fire away.

And yes, CoolProp + TTSE is extremely fast. Once I fix it, you will be able to use bicubic interpolation as well, which is much more accurate, and I think that it will result in some speed improvement in Modelica because it uses an adaptive integrator.

On Mon, Sep 16, 2013 at 5:00 PM, kaern notifications@github.com wrote:

Two-phase properties such as specific heat capacity at constant volume and speed of sound is missing compared to e.g. Modelica.Media.Water.StandardWater or ExternalMedia.Media.FluidPropMedium.

I need cv to get state properties from internal energy and density. I iterate for temperature such that Residual = u_known - Medium.specificInternalEnergy(Medium.setState_dT(d_known,T))

using newton raphson and differentiating internal energy wrt temperature at const density is cv.. Also, I use the speed of sound to limit the numerical flux using flux/slope limiters.. even though I know speed of sound is undefined for two-phase flow, the reference definition is missing..

Is it possible to update the computation of these properties.. I find your library very fast and promising!! The TTSE is really fast :-)

— Reply to this email directly or view it on GitHubhttps://github.com/ibell/coolprop/issues/21 .

kaern commented 11 years ago

I believe these partial derivatives are well defined at least in Modelica related literature, such as the phd thesis of Hubertus Tummescheit or Christoph Richter. However, I say our friend Matthis Thorade gives the best explanation of how to establish partial derivatives in the two-phase region: http://rd.springer.com/article/10.1007%2Fs12665-013-2394-z He explicitly shows how to compute cv. It is quite similar to the partial derivative of density wrt pressure at constant enthalpy (which is already included in Coolprop2Modelica). Speed of sound is computed in similar way using triple product rule. see his article for further info..

If it is not clear I will be happy to help with code that also illustrates things...

kaern commented 11 years ago

By the way.. I would really appreciate A LOT to have these derivatives available, such that I can use TTSE for my two-phase flow modeling.. I believe the derivatives are most easily computed in the Modelica Wrapper, rather than in Modelica it self, and should be of no additional overload... Hope to hear from you soon..! Thanks in advance..!

ibell commented 11 years ago

Ok, I'll see about implementing them - if you wanted to help with the coding in c++ that would be good. Check out the CPState.h header and the CPState.cpp file in the CoolProp folder. You'll see the other nasty derivatives of drhodp_consth and drhodh_constp in the two-phase region. I have no objection to implementing these derivatives, but I have a lot of my plate right now.

On Mon, Sep 16, 2013 at 11:23 PM, kaern notifications@github.com wrote:

By the way.. I would really appreciate A LOT to have these derivatives available, such that I can use TTSE for my two-phase flow modeling.. I believe the derivatives are most easily computed in the Modelica Wrapper, rather than in Modelica it self, and should be of no additional overload... Hope to hear from you soon..! Thanks in advance..!

— Reply to this email directly or view it on GitHubhttps://github.com/ibell/coolprop/issues/21#issuecomment-24545868 .

kaern commented 11 years ago

Hi Again, I have shown how to compute these analytical derivatives in Modelica and I will get help from Jorrit to implement them in C++ quite soon I think...

ibell commented 11 years ago

That's good - the best would be if you were to open a branch for your code and then we can pull it back into the master when we've taken a look. Jorrit will know what the things I just said mean :)

On Wed, Sep 18, 2013 at 10:42 AM, kaern notifications@github.com wrote:

Hi Again, I have shown how to compute these analytical derivatives in Modelica and I will get help from Jorrit to implement them in C++ quite soon I think...

— Reply to this email directly or view it on GitHubhttps://github.com/ibell/coolprop/issues/21#issuecomment-24649390 .

jowr commented 11 years ago

I guess this is solved.