{"id":141,"date":"2015-11-01T16:28:37","date_gmt":"2015-11-01T15:26:16","guid":{"rendered":"http:\/\/pythoncvc.net\/?p=141"},"modified":"2015-11-01T17:08:11","modified_gmt":"2015-11-01T16:08:11","slug":"working-with-fluid-properties-12-using-coolprop-in-a-standard-python-environment","status":"publish","type":"post","link":"https:\/\/pythoncvc.net\/?p=141","title":{"rendered":"Working with fluid properties 1\/2 : Using CoolProp in a standard python environment"},"content":{"rendered":"<p>When you work in HVAC, you always need fluid properties in your calculations. The most common property you need for pipe work is heat capacity Cp,\u00a0 mass density \u03c1 and dynamic viscosity \u00b5. We will use <a href=\"http:\/\/www.coolprop.org\" target=\"_blank\">CoolProp<\/a> which is an awesome open source cross-platform library developed in C++ with <a href=\"http:\/\/www.coolprop.org\/coolprop\/wrappers\/index.html#wrapper-common-prereqs\" target=\"_blank\">wrappers available<\/a> for most common languages and environment (including python, Libre Office, Excel, shared library dll). You can thank <a href=\"http:\/\/www.coolprop.org\/index.html#main-developers\" target=\"_blank\">developers and their supporters<\/a> for this great library.<\/p>\n<p>You may install CoolProp for python by typing \u00ab\u00a0pip install CoolProp\u00a0\u00bb in your command line (cmd.exe on windows) or with <a href=\"https:\/\/www.continuum.io\/downloads\" target=\"_blank\">Anaconda<\/a>.<\/p>\n<p>You can then use it in a python script. Here is an example for Pure Fluid :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#Add CoolProp to your pythonpath\r\nimport sys\r\nsys.path.append(r\"PathToTheCoolPropFolder\")\r\n#Example, for me it is : sys.path.append(r\"C:\\Anaconda\\Lib\\site-packages\\CoolProp-5.1.1-py2.7-win-amd64.egg\")\r\n\r\n#Import PropsSI function which will be used from CoolProp\r\nfrom CoolProp.CoolProp import PropsSI\r\n\r\n#Ask CoolProp water's heat capacity at 275.15 K (2\u00b0C) and common Earth pressure 101325 Pa\r\nPropsSI('C','T',275.15,'P',101325,'INCOMP::Water') #return 4182.587592215201\r\n\r\n#Ask CoolProp water's mass density and viscosity with same conditions\r\nPropsSI('D','T',275.15,'P',101325,'INCOMP::Water') #return 1003.076063639064\r\nPropsSI('C','T',275.15,'P',101325,'INCOMP::Water') #return 0.0016507819947969692<\/pre>\n<p>INCOMP stands for incompressible fluids, you can also work with Humid Air Properties for example with <a href=\"http:\/\/www.coolprop.org\/fluid_properties\/HumidAir.html\" target=\"_blank\">another function<\/a> from CoolProp. <a href=\"http:\/\/www.coolprop.org\/fluid_properties\/Incompressibles.html#the-different-fluids\" target=\"_blank\">Click to see list of available fluids<\/a>.<\/p>\n<p>We often need mixture properties (ethylen or propylen glycol, ethanol etc&#8230;). Here is an example :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#Ask CoolProp the heat capacity of mixture Water\/ASHRAE, Ethylene Glycol 25% (volume based)  at 275.15 K (2\u00b0C) and common Earth pressure 101325 Pa\r\nPropsSI('C','T',275.15,'P',101325,'INCOMP::AEG[0.25]') #return 3684.7400408010444\r\n#Ask CoolProp ASHRAE, Ethylene Glycol's mass density, heat capacity and freezing temperature with same conditions\r\nPropsSI('D','T',275.15,'P',101325,'INCOMP::AEG[0.25]') #return 1043.3307802810543\r\nPropsSI('V','T',275.15,'P',101325,'INCOMP::AEG[0.25]') #return 0.0032736727033664615\r\nPropsSI('T_FREEZE','T',275.15,'P',101325,'INCOMP::AEG[0.25]') #return 261.0307763027968 (~ -12\u00b0C)<\/pre>\n<p><a href=\"http:\/\/www.coolprop.org\/coolprop\/HighLevelAPI.html#table-of-string-inputs-to-propssi-function\" target=\"_blank\">Click here to see inputs available for PropsSI function and units used<\/a> (SI as said in the function name).<\/p>\n<p>Enjoy !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you work in HVAC, you always need fluid properties in your calculations. The most common property you need for pipe work is heat capacity Cp,\u00a0 mass density \u03c1 and dynamic viscosity \u00b5. We will use CoolProp which is an awesome open source cross-platform library developed in C++ with wrappers available for most common languages [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[80],"tags":[84,44,82],"class_list":["post-141","post","type-post","status-publish","format-standard","hentry","category-python","tag-fluids","tag-hydraulic","tag-python"],"_links":{"self":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts\/141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=141"}],"version-history":[{"count":3,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions"}],"predecessor-version":[{"id":144,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=\/wp\/v2\/posts\/141\/revisions\/144"}],"wp:attachment":[{"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythoncvc.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}