Closed MaxD404 closed 1 year ago
Please provide a more complete example. What is in z, for instance? How is MASS_SI obtained?
Also, you should be checking the error code ierr, which indicates that your inputs are invalid:
[TRNPRP error 541] Transport equations are not available for mixtures with water at molar concentrations greater than 5%.
iMass = int8(1); % 0: molar fractions; 1: mass fractions iFlag = int8(0); % 0: don't call SATSPLN; 1: call SATSPLN MASS_SI = RP.GETENUMdll(int8(0),'MASS BASE SI').iEnum; z = {1.0};
I saw that error code, but that error code does not change the fact that the 90/10 mixture worked, then I called a 50/50 mixture, then a new call for the 90/10 mixture no longer worked
On my side, I get the same results each time. I set z to {0,0} which I think is needed when you specify composition both in string and in the z array. That's what my bug report I linked is all about. I recommend to NEVER specify the composition in the string; I never do.
From my understanding, z={1.0} sets the fluid string composition to be in mass fraction, and z={0.0} sets the fluid string composition to be in molar fraction, is that incorrect and/or should I avoid using mass fraction for mixtures? I am confused by what I understand you to be saying that I can set the fluid mixture composition in the z array.
jun = RP.REFPROPdll('WATER;PROPYLENEGLYCOL','PT','KV',MASS_SI,iMass,iFlag,P,T,{0.9,0.1}); junk=double(jun.Output); KV(1)=junk(1).*0.01
When I try to run this line I still get a negative answer, but I am trying to avoid setting the composition in the fluid string and instead using the z array.
In your previous code, you have effectively confused REFPROP because you provided a z of {1.0}, which gets padded to z={1,0,0,0,...} by the Python code. But you also specified the composition in the string, which wins. This is the bug I referred to above.
In your latest attempt, the negative result is to be expected. You are outside the range of validity of the model (see the error message above) and the extrapolation of this model is poor.
OK that makes sense, I am still not understanding the issue where the 90/10 mixture worked (string composition wins so REFPROP ran with the 90/10 mixture). then the 50/50 call didn't (expected because it is outside of the validity of the model) and then the 90/10 mixture did not work (still outside the range of the model but it worked previously).
There seems to be a bug relating to compositions. I am digging into it with our team.
This may have caused another issue. I am iterating through several internal energies of the mixture, and right now my iteration value is different than if I write the same code in the command window. For example, my code looks something like
iMass = int8(1); % 0: molar fractions; 1: mass fractions iFlag = int8(0); % 0: don't call SATSPLN; 1: call SATSPLN MASS_SI = RP.GETENUMdll(int8(0),'MASS BASE SI').iEnum; z = {0.5,0.5}; hfld='PROPYLENEGLYCOL;0.5;WATER;0.5'; P_c= 1.0135e+05; E_c(1)=146617.931569395; T_c(1)=35+273.15; i=1; while T_c(end)<500 E_c(i+1)=E_c(i)+23; jun = RP.REFPROPdll(hfld,'PE','T',MASS_SI,iMass,iFlag,P_c,E_c(i+1),z_c); junk=double(jun.Output); T_c(i+1)=junk(1); i=i+1; end
Here is my command window:
As you can see, in the iteration the third temperature value is around 130C (it shouldn't be), but when I directly input into the command window the same lines of code that the iteration has then the output of those exact same lines of code is around 35C (which is the expected answer)
Edit: Important note that this same code was working fine yesterday, before the issues with running the transport properties at higher percentages than allowed. Also, I have used the MATLAB debugger to pinpoint exactly when the temperature value shoots up unexpectedly and it happens in the block of code that I posted in this comment, while still using the debugger I copied that block of code into the command window and tried manually entering the "i+1" values and the function call outputted the expected answer. in this case, "i+1" was 3.
Please try to do all your calculations with compositions as molar compositions and see what happens. I think I have identified another bug with mass compositions in the REFPROP function.
I tried it with molar fraction and the results look way better, but still different than yesterday. Running this analysis yesterday the final temperature of the coolant was around 77C, but now they are 86C. The changes between yesterday and today: yesterday: hfld='PROPYLENEGLYCOL;0.5;WATER;0.5'; z={1.0};, iMass=int8(1); today: hfld='PROPYLENEGLYCOL;WATER'; z={0.19, 1-0.19}; iMass=int8(0); REFPROP was run with incorrect percentages for transport property calculations with a water mixture this morning
This increase in final temperature will change our design, so I'm not sure which to believe.
Don't trust the mass-based results, trust (more) the molar ones. Do the transport property routines give sensible errors and outputs now?
But that said, the model in REFPROP for PG+water is only a placeholder, so you should not be basing engineering calculations on it. I think a better choice, if you are considering only the liquid phase, is to use the incompressible models implemented in CoolProp: http://www.coolprop.org/fluid_properties/Incompressibles.html#id123
Yes, running a REFPROP call for thermal conductivity with molar concentrations are giving expected and repeatable results now. it errors at concentrations >5% water, and it outputs a real number for concentrations<5% water. Thank you very much for all the help today.
But all of that still hinges on my previous comment: the thermodynamic model itself is a placeholder and you shouldn't be designing based upon it.
Well, that is unfortunate to hear. Is there an estimate for when it won't be a placeholder?
No, I am afraid not. For that reason I again recommend the incompressible properties in CoolProp.
We could develop such a model if there was sufficient interest in the engineering community.
Description
I am trying to find the kinematic viscosity of a 50/50 mixture of propylene glycol and water. The 50/50 call gives me a negative kinematic viscosity. I tried a 90/10 water/PG mixture, and my kinematic viscosity was still negative. However, if I clear everything in MATLAB, force REFPROP to reload, and try the 90/10 mixture again I get 1.0034e-4 as my kinematic viscosity. Then I try to tun 50/50 and the answer is negative, then I try the 90/10 again and that answer is negative.
Steps to Reproduce
Expected behavior: I expected one of two things. Either the call for a 50/50 mixture would give a positive answer, or calling for a 90/10 mixture would be consistent regardless of the previous calls.
Actual behavior: 50/50 mixture is negative and the 90/10 mixture answer changes.
Versions
REFPROP Version: 10 Operating System and Version: Windows 11 Access Method: MATLAB
Additional Information
P=101325; T=20+273.15;
%% REFPROP Properties jun = RP.REFPROPdll('WATER;0.9;PROPYLENEGLYCOL;0.1','PT','KV',MASS_SI,iMass,iFlag,P,T,z); junk=double(jun.Output); KV(1)=junk(1).*0.01;
jun = RP.REFPROPdll('WATER;0.5;PROPYLENEGLYCOL;0.5','PT','KV',MASS_SI,iMass,iFlag,P,T,z); junk=double(jun.Output); KV(2)=junk(1).*0.01;
jun = RP.REFPROPdll('WATER;0.9;PROPYLENEGLYCOL;0.1','PT','KV',MASS_SI,iMass,iFlag,P,T,z); junk=double(jun.Output); KV(3)=junk(1).*0.01;
KV=KV
%When lines 35 to 41 are commented out my output is Kv=1.0034e-06, but when %lines 35 to 41 are not commented out my output is: [1.0034e-06, -0.0095, %-0.0097], and if the same code is run a second time my output is: %[KV=-0.0097, -0.0095, -0.0097] %Lines 39-41 is a duplicate of lines 31-33, but for some reason the call %for a 50/50 mixture changes the output for the proceeding duplicate