{"id":50160494,"url":"https://github.com/portyanikhin/rfluids","last_synced_at":"2026-05-24T15:01:22.613Z","repository":{"id":270120867,"uuid":"909360436","full_name":"portyanikhin/rfluids","owner":"portyanikhin","description":"🦀 Rusty CoolProp wrapper","archived":false,"fork":false,"pushed_at":"2026-05-22T17:23:25.000Z","size":59327,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-22T21:30:26.223Z","etag":null,"topics":["air","bindings","coolprop","cross-platform","ffi","fluids","humid-air","mixtures","native","properties","psychrometrics","thermodynamics","thermophysical-properties","wrapper"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rfluids","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/portyanikhin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-28T13:22:06.000Z","updated_at":"2026-05-22T17:23:29.000Z","dependencies_parsed_at":"2025-01-11T16:36:37.092Z","dependency_job_id":"56c90e6e-5c18-4788-8080-fff3664f15c6","html_url":"https://github.com/portyanikhin/rfluids","commit_stats":null,"previous_names":["portyanikhin/fluids-rs","portyanikhin/rfluids"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/portyanikhin/rfluids","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portyanikhin%2Frfluids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portyanikhin%2Frfluids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portyanikhin%2Frfluids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portyanikhin%2Frfluids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/portyanikhin","download_url":"https://codeload.github.com/portyanikhin/rfluids/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portyanikhin%2Frfluids/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33438518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T13:13:05.286Z","status":"ssl_error","status_checked_at":"2026-05-24T13:13:03.728Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["air","bindings","coolprop","cross-platform","ffi","fluids","humid-air","mixtures","native","properties","psychrometrics","thermodynamics","thermophysical-properties","wrapper"],"created_at":"2026-05-24T15:00:41.551Z","updated_at":"2026-05-24T15:01:22.592Z","avatar_url":"https://github.com/portyanikhin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# rfluids\n\n[\u003cimg alt=\"GitHub\" src=\"https://img.shields.io/badge/github-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"22\"\u003e](https://github.com/portyanikhin/rfluids)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"22\"\u003e](https://docs.rs/rfluids)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/rfluids?style=for-the-badge\u0026logo=rust\u0026labelColor=555555\u0026color=fc8d62\" height=\"22\"\u003e](https://crates.io/crates/rfluids)\n[\u003cimg alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/portyanikhin/rfluids/ci.yml?style=for-the-badge\u0026logo=githubactions\u0026logoColor=ffffff\u0026label=ci\u0026labelColor=555555\" height=\"22\"\u003e](https://github.com/portyanikhin/rfluids/actions/workflows/ci.yml)\n[\u003cimg alt=\"codecov\" src=\"https://img.shields.io/codecov/c/github/portyanikhin/rfluids?style=for-the-badge\u0026logo=codecov\u0026label=codecov\u0026labelColor=555555\" height=\"22\"\u003e](https://app.codecov.io/gh/portyanikhin/rfluids)\n\n🦀 Rusty [`CoolProp`](https://coolprop.org) wrapper\n\n## Overview\n\n`rfluids` provides a safe, idiomatic Rust interface to [`CoolProp`](https://coolprop.org) —\na comprehensive C++ library for thermophysical property calculations.\nBuilt with type safety and ergonomics in mind, it enables precise fluid property\ncalculations for engineering and scientific applications.\n\n### Key Features\n\n- **Rich substance library**: pure fluids, incompressible fluids, predefined mixtures, binary\n  mixtures, and custom mass- or volume-based mixtures\n- **Comprehensive property calculations**: thermodynamic (e.g., density, enthalpy, entropy,\n  etc.) and transport properties (e.g., viscosity, thermal conductivity, etc.)\n- **Psychrometric calculations**: based on **ASHRAE RP-1485** standard\n- **Flexible backends**: choose between `HEOS`, `IF97`, and other `CoolProp` backends, which\n  determine the underlying equation of state or calculation method used for thermophysical\n  property calculations\n- **Type-safe API**: leverages Rust's type system with the [Typestate Pattern](https://en.wikipedia.org/wiki/Typestate_analysis)\n  to prevent invalid operations at compile time\n- **Configuration management**: flexible control over `CoolProp` configuration via type-safe\n  builder, with optional `serde` support for loading from configuration files\n- **Batteries included**: pre-compiled `CoolProp` dynamic libraries for all supported platforms\n\n### Modules\n\n- [`fluid`](https://docs.rs/rfluids/latest/rfluids/fluid/index.html) – thermophysical properties\n  of substances (pure fluids and mixtures)\n- [`humid_air`](https://docs.rs/rfluids/latest/rfluids/humid_air/index.html) – thermophysical\n  properties of _**real**_ humid air\n- [`substance`](https://docs.rs/rfluids/latest/rfluids/substance/index.html) – types representing\n  `CoolProp` substances\n- [`io`](https://docs.rs/rfluids/latest/rfluids/io/index.html) – input/output parameter types\n  for fluid and humid air calculations\n- [`native`](https://docs.rs/rfluids/latest/rfluids/native/index.html) – low-level and high-level\n  `CoolProp` API bindings\n- [`config`](https://docs.rs/rfluids/latest/rfluids/config/index.html) – global configuration\n  management for `CoolProp`\n- [`prelude`](https://docs.rs/rfluids/latest/rfluids/prelude/index.html) – convenient re-exports\n  of commonly used types and traits\n\n### Feature Flags\n\n- **`regen-bindings`** – regenerates FFI bindings to `CoolProp` (requires `libclang`)\n- **`serde`** – enables serialization and deserialization support for\n  [`Config`](https://docs.rs/rfluids/latest/rfluids/config/struct.Config.html), allowing\n  integration with configuration management crates and file-based configuration\n\n## Supported platforms\n\n- `Linux x86-64`\n- `macOS AArch64`\n- `macOS x86-64`\n- `Windows AArch64`\n- `Windows x86-64`\n\n## MSRV\n\n`rfluids` requires `rustc` 1.85.0 or later.\n\n## How to install\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nrfluids = \"0.4\"\n```\n\nOr via command line:\n\n```shell\ncargo add rfluids\n```\n\n🎁 It comes with native `CoolProp` dynamic libraries for supported platforms. The library\nrequired for your platform will be automatically copied to the target directory during build.\n\nIt also includes pre-generated FFI bindings, so `libclang` is not required for normal builds.\n\n### Regenerating bindings\n\nIf you need to regenerate the FFI bindings (requires `libclang`), enable the\n**`regen-bindings`** feature.\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nrfluids = { version = \"0.4\", features = [\"regen-bindings\"] }\n```\n\nOr via command line:\n\n```shell\ncargo add rfluids --features regen-bindings\n```\n\n## Examples\n\n| ℹ️ All calculations are performed in SI units |\n| :-------------------------------------------: |\n\nSpecific heat **\\[J/kg/K\\]** of saturated water vapor at _1 atm_:\n\n```rust\nuse approx::assert_relative_eq;\nuse rfluids::prelude::*;\n\nlet mut water_vapor = Fluid::from(Pure::Water)\n    .in_state(FluidInput::pressure(101_325.0), FluidInput::quality(1.0))?;\nassert_relative_eq!(water_vapor.specific_heat()?, 2_079.937_085_633_241, max_relative = 1e-6);\n```\n\nDynamic viscosity **\\[Pa·s\\]** of propylene glycol aqueous solution\nwith _60 %_ mass fraction at _100 kPa_ and _-20 °C_:\n\n```rust\nuse approx::assert_relative_eq;\nuse rfluids::prelude::*;\n\nlet mut propylene_glycol = Fluid::from(BinaryMixKind::MPG.with_fraction(0.6)?)\n    .in_state(FluidInput::pressure(100e3), FluidInput::temperature(253.15))?;\nassert_relative_eq!(\n    propylene_glycol.dynamic_viscosity()?,\n    0.139_073_910_539_388_78,\n    max_relative = 1e-6\n);\n```\n\nDensity **\\[kg/m³\\]** of ethanol aqueous solution\n(with ethanol _40 %_ mass fraction) at _200 kPa_ and _4 °C_:\n\n```rust\nuse approx::assert_relative_eq;\nuse rfluids::prelude::*;\n\nlet mut mix =\n    Fluid::try_from(CustomMix::mass_based([(Pure::Water, 0.6), (Pure::Ethanol, 0.4)])?)?\n        .in_state(FluidInput::pressure(200e3), FluidInput::temperature(277.15))?;\nassert_relative_eq!(mix.density()?, 883.392_277_162_775_9, max_relative = 1e-6);\n```\n\nWet-bulb temperature **\\[K\\]** of humid air at _300 m_ above sea level,\n_30 °C_ and _50 %_ relative humidity:\n\n```rust\nuse approx::assert_relative_eq;\nuse rfluids::prelude::*;\n\nlet mut humid_air = HumidAir::new().in_state(\n    HumidAirInput::altitude(300.0)?,\n    HumidAirInput::temperature(303.15),\n    HumidAirInput::rel_humidity(0.5),\n)?;\nassert_relative_eq!(\n    humid_air.wet_bulb_temperature()?,\n    295.067_569_033_474_57,\n    max_relative = 1e-6\n);\n```\n\n[`Fluid`](https://docs.rs/rfluids/latest/rfluids/fluid/struct.Fluid.html)\nand [`HumidAir`](https://docs.rs/rfluids/latest/rfluids/humid_air/struct.HumidAir.html)\nimplement the [`PartialEq`](https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html) trait.\nEquality is checked by the thermodynamic state:\n\n```rust\nuse rfluids::prelude::*;\n\nlet mut humid_air = HumidAir::new().in_state(\n    HumidAirInput::altitude(0.0)?,\n    HumidAirInput::temperature(293.15),\n    HumidAirInput::rel_humidity(0.5),\n)?;\nlet mut another_humid_air = HumidAir::new().in_state(\n    HumidAirInput::pressure(101_325.0),\n    HumidAirInput::temperature(293.15),\n    HumidAirInput::rel_humidity(0.5),\n)?;\nassert_eq!(humid_air, another_humid_air);\n\nanother_humid_air.update(\n    HumidAirInput::pressure(101_325.0),\n    HumidAirInput::temperature(303.15),\n    HumidAirInput::rel_humidity(0.5),\n)?;\nassert_ne!(humid_air, another_humid_air);\n```\n\nYou can also specify a `CoolProp` backend for\n[`Fluid`](https://docs.rs/rfluids/latest/rfluids/fluid/struct.Fluid.html)\ninstead of the default one using\n[`Fluid::builder`](https://docs.rs/rfluids/latest/rfluids/fluid/struct.Fluid.html#method.builder):\n\n```rust\nuse rfluids::prelude::*;\n\nlet mut water = Fluid::from(Pure::Water)\n    .in_state(FluidInput::pressure(101_325.0), FluidInput::temperature(293.15))?;\nlet mut if97_water = Fluid::builder()\n    .substance(Pure::Water)\n    .with_backend(BaseBackend::If97)\n    .build()?\n    .in_state(FluidInput::pressure(101_325.0), FluidInput::temperature(293.15))?;\n\n// Same fluids with different backends are never equal\nassert_ne!(water, if97_water);\n\n// Different backends may yield slightly different results for the same property\nassert!((water.specific_heat()? - if97_water.specific_heat()?).abs() \u003e 1e-6);\n```\n\n#### License\n\n\u003csup\u003e\nThis project is licensed under\n\u003ca href=\"https://github.com/portyanikhin/rfluids/blob/main/LICENSE\"\u003eMIT License\u003c/a\u003e.\n\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportyanikhin%2Frfluids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportyanikhin%2Frfluids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportyanikhin%2Frfluids/lists"}