MadsKirkFoged / SharpFluids

Lightweight CoolProp C# Wrapper - for easy fluid properties lookups
MIT License
30 stars 9 forks source link

R454B Run An Exception #49

Open JawadJaber opened 1 year ago

JawadJaber commented 1 year ago

Hello When I try get the properties of R454B, the following exception is shown and other properties such as critical temperatures and pressures are very high.

solver_rho_Tp was unable to find a solution for T= 448.369, p=6.31699e+07, with guess value 12028.2 with error: The molar density of -44003.133110 mol/m3 is below the minimum of 0.000000 mol/m3

Here is my code where above exception is raised

var fluid = FluidList.R454B_mix; Fluid test = new Fluid(fluid);

MadsKirkFoged commented 1 year ago

I haven't really worked with mixtures myself, so that why this part of the interface is a bit buggy :-D

I believe I have fixed the error. Fell free to update to the newest nuget and try again.

Fluid Issue49 = new Fluid(FluidList.R454B_mix);

Issue49.SetFraction(0.5);

Pressure P49 = Pressure.FromBar(10);
Temperature T49 = Temperature.FromDegreesCelsius(50);

Issue49.UpdatePT(P49, T49);
JawadJaber commented 1 year ago

Now exception has gone, while the calculations are not yet complete. For example, critical temperature and pressure are zeros.

On the other hand, why you set the fraction as 0.5 what would be the purpose here?

MadsKirkFoged commented 1 year ago

The 'FluidList.R454B_mix' is a mixture of two fluids and you can change fraction of the two. You might want to read up on this fluids in CoolProps docs or their github: https://github.com/CoolProp/CoolProp/issues/2222

The critical temperature and pressure does not work for mixtures

JawadJaber commented 1 year ago

All properties that are calculated are zeros. Not only critical temperature and pressure. If you look at the https://github.com/CoolProp/CoolProp/issues/2222#issuecomment-1470403158 The critical temperature is calculated there.

image