Changing the values of the fluid's critical point properties predefined in the CoolProp #2316
Replies: 9 comments 3 replies
-
Intentionally you cannot easily make this change. First off, why do you
want to make this change?
In python the process is relatively simple: you load the JSON from CoolProp
at runtime, change the reducing value, and reload the fluid. I am sure you
can do something similar in MATLAB. Would the Python example help?
|
Beta Was this translation helpful? Give feedback.
-
No, it is more complicated than that. You need to obtain the JSON for the fluid, change the critical temperature everywhere in the JSON file, and reload it, and do that for each critical temperature you want to set. |
Beta Was this translation helpful? Give feedback.
-
Where is the JSON file on the PC?
I don't find that in this path:
C:\Users\Name\miniconda3\Lib\site-packages\CoolProp
…On Mon, Dec 4, 2023 at 1:07 AM Ian Bell ***@***.***> wrote:
No, it is more complicated than that. You need to obtain the JSON for the
fluid, change the critical temperature everywhere in the JSON file, and
reload it, and do that for each critical temperature you want to set.
—
Reply to this email directly, view it on GitHub
<#2316 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKDN4ZTL76LW52SHHEZXO33YHTWJFAVCNFSM6AAAAAA7W54D6GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TONBWGU2TG>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
thanks Jeff
…On Tue, Dec 19, 2023 at 6:49 AM Jeff Henning ***@***.***> wrote:
Try this example on the CoolProp site.
Adding a Fluid
<http://www.coolprop.org/coolprop/HighLevelAPI.html#adding-fluids>
Hope this helps.
—
Reply to this email directly, view it on GitHub
<#2316 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKDN4ZQG4Z72PTIMEV5EFQTYKEBTRAVCNFSM6AAAAAA7W54D6GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TQOJTGA4DS>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
The process works like this as an example of changing the critical temperature for argon +- 1 K: import json
import CoolProp.CoolProp as CP
import numpy as np
fluid = 'Argon'
AS = CP.AbstractState('HEOS', fluid)
CP.set_config_bool(CP.OVERWRITE_FLUIDS, True)
# Get the fluid information in JSON format
# for loaded fluid
jbase = json.loads(AS.fluid_param_string("JSON"))[0]
for Tc in np.linspace(150.687-1, 150.687+1, 7):
# Change the max temperature in ancillary functions
for k in ['pS', 'rhoL', 'rhoV']:
jbase["ANCILLARIES"][k]["T_r"] = Tc
jbase["ANCILLARIES"][k]["Tmax"] = Tc
# Change the reducing temperature for EOS and
# critical temperature at top-level
jbase["EOS"][0]["STATES"]['reducing']['T'] = Tc
jbase["STATES"]['critical']['T'] = Tc
CP.add_fluids_as_JSON('HEOS', json.dumps(jbase))
print(Tc, CP.PropsSI('T','P',101325,'Q',0,fluid)) So the JSON data structure is loaded in memory, the necessary coefficients are perturbed, and the perturbed data structure is reset in CoolProp. I should warn you this is an advanced use case, so you should definitely sanity check that the results are working as expected. On my side, the code yielded:
which seems plausible |
Beta Was this translation helpful? Give feedback.
-
Thanks
that is goood
…On Wed, Dec 20, 2023 at 1:05 AM Ian Bell ***@***.***> wrote:
The process works like this as an example of changing the critical
temperature for argon +- 1 K:
import json import CoolProp.CoolProp as CP import numpy as np
fluid = 'Argon'AS = CP.AbstractState('HEOS', fluid)CP.set_config_bool(CP.OVERWRITE_FLUIDS, True)
# Get the fluid information in JSON format # for loaded fluidjbase = json.loads(AS.fluid_param_string("JSON"))[0]
for Tc in np.linspace(150.687-1, 150.687+1, 7):
# Change the max temperature in ancillary functions
for k in ['pS', 'rhoL', 'rhoV']:
jbase["ANCILLARIES"][k]["T_r"] = Tc
jbase["ANCILLARIES"][k]["Tmax"] = Tc
# Change the reducing temperature for EOS and
# critical temperature at top-level
jbase["EOS"][0]["STATES"]['reducing']['T'] = Tc
jbase["STATES"]['critical']['T'] = Tc
CP.add_fluids_as_JSON('HEOS', json.dumps(jbase))
print(Tc, CP.PropsSI('T','P',101325,'Q',0,fluid))
So the JSON data structure is loaded in memory, the necessary coefficients
are perturbed, and the perturbed data structure is reset in CoolProp.
I should warn you this is an advanced use case, so you should definitely
sanity check that the results are working as expected. On my side, the code
yielded:
149.687 86.78545291004171
150.02033333333335 86.95771642184718
150.35366666666667 87.1299441634586
150.687 87.3021362301716
151.02033333333335 87.4742927168127
151.35366666666667 87.64641371774503
151.687 87.81849932687082
which seems plausible
—
Reply to this email directly, view it on GitHub
<#2316 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKDN4ZRA6LJYDNF77GS34X3YKICBZAVCNFSM6AAAAAA7W54D6GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TSMBSGE2DM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi Ian
Which folder should I put this code in?
test?
thanks alot
…On Wed, Dec 20, 2023 at 3:17 PM Mojtaba Raheli ***@***.***> wrote:
Thanks
that is goood
On Wed, Dec 20, 2023 at 1:05 AM Ian Bell ***@***.***> wrote:
> The process works like this as an example of changing the critical
> temperature for argon +- 1 K:
>
> import json import CoolProp.CoolProp as CP import numpy as np
> fluid = 'Argon'AS = CP.AbstractState('HEOS', fluid)CP.set_config_bool(CP.OVERWRITE_FLUIDS, True)
> # Get the fluid information in JSON format # for loaded fluidjbase = json.loads(AS.fluid_param_string("JSON"))[0]
> for Tc in np.linspace(150.687-1, 150.687+1, 7):
> # Change the max temperature in ancillary functions
> for k in ['pS', 'rhoL', 'rhoV']:
> jbase["ANCILLARIES"][k]["T_r"] = Tc
> jbase["ANCILLARIES"][k]["Tmax"] = Tc
>
> # Change the reducing temperature for EOS and
> # critical temperature at top-level
> jbase["EOS"][0]["STATES"]['reducing']['T'] = Tc
> jbase["STATES"]['critical']['T'] = Tc
>
> CP.add_fluids_as_JSON('HEOS', json.dumps(jbase))
>
> print(Tc, CP.PropsSI('T','P',101325,'Q',0,fluid))
>
> So the JSON data structure is loaded in memory, the necessary
> coefficients are perturbed, and the perturbed data structure is reset in
> CoolProp.
>
> I should warn you this is an advanced use case, so you should definitely
> sanity check that the results are working as expected. On my side, the code
> yielded:
>
> 149.687 86.78545291004171
> 150.02033333333335 86.95771642184718
> 150.35366666666667 87.1299441634586
> 150.687 87.3021362301716
> 151.02033333333335 87.4742927168127
> 151.35366666666667 87.64641371774503
> 151.687 87.81849932687082
>
> which seems plausible
>
> —
> Reply to this email directly, view it on GitHub
> <#2316 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AKDN4ZRA6LJYDNF77GS34X3YKICBZAVCNFSM6AAAAAA7W54D6GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TSMBSGE2DM>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
Beta Was this translation helpful? Give feedback.
-
It shouldn't matter, everything is done in memory.
|
Beta Was this translation helpful? Give feedback.
-
Ok, thanks.
…On Wed, Dec 27, 2023 at 8:40 PM Ian Bell ***@***.***> wrote:
It shouldn't matter, everything is done in memory.
—
Reply to this email directly, view it on GitHub
<#2316 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKDN4ZWMV4F5BATC6TWJMHTYLRJABAVCNFSM6AAAAAA7W54D6GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TSNJYGQ2DS>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I want to change the values of the fluids critical point properties predefined in the coolprop. I have installed it in MATLAB.
For instance the critical Temp for R245 is 427.01, I want to change it to 427.2.
How can I do this?
bests
Beta Was this translation helpful? Give feedback.
All reactions