SharpProp 2.0.4
See the version list below for details.
dotnet add package SharpProp --version 2.0.4
NuGet\Install-Package SharpProp -Version 2.0.4
<PackageReference Include="SharpProp" Version="2.0.4" />
paket add SharpProp --version 2.0.4
#r "nuget: SharpProp, 2.0.4"
// Install SharpProp as a Cake Addin #addin nuget:?package=SharpProp&version=2.0.4 // Install SharpProp as a Cake Tool #tool nuget:?package=SharpProp&version=2.0.4
A simple, full-featured, lightweight, cross-platform CoolProp wrapper for C#
Quick start
All calculations of thermophysical properties are performed in SI units.
The Fluid
class is responsible for pure fluids and binary mixtures, the Mixture
class - for mixtures with pure
fluids components, the HumidAir
class - for humid air.
The FluidsList
is an enum of all available fluids.
List of properties
For the Fluid
and Mixture
instances:
Compressibility
- compressibility factor (-)Conductivity
- thermal conductivity (W/m/K)CriticalPressure
- absolute pressure at the critical point (Pa)CriticalTemperature
- absolute temperature at the critical point (K)Density
- mass density (kg/m3)DynamicViscosity
- dynamic viscosity (Pa*s)Enthalpy
- mass specific enthalpy (J/kg)Entropy
- mass specific entropy (J/kg/K)FreezingTemperature
- temperature at freezing point (for incompressible fluids) (K)InternalEnergy
- mass specific internal energy (J/kg)MaxPressure
- maximum pressure limit (Pa)MaxTemperature
- maximum temperature limit (K)MinPressure
- minimum pressure limit (Pa)MinTemperature
- minimum temperature limit (K)MolarMass
- molar mass (kg/mol)Phase
- phasePrandtl
- Prandtl number (-)Pressure
- absolute pressure (Pa)Quality
- mass vapor quality (-)SoundSpeed
- sound speed (m/s)SpecificHeat
- mass specific constant pressure specific heat (J/kg/K)SurfaceTension
- surface tension (N/m)Temperature
- absolute temperature (K)TriplePressure
- absolute pressure at the triple point (Pa)TripleTemperature
- absolute temperature at the triple point (K)
For the HumidAir
instances:
Compressibility
- compressibility factor (-)Conductivity
- thermal conductivity (W/m/K)Density
- mass density per humid air unit (kg/m3)DewTemperature
- dew-point absolute temperature (K)DynamicViscosity
- dynamic viscosity (Pa*s)Enthalpy
- mass specific enthalpy per humid air (J/kg)Entropy
- mass specific entropy per humid air (J/kg/K)Humidity
- absolute humidity ratio (kg/kg d.a.)PartialPressure
- partial pressure of water vapor (Pa)Pressure
- absolute pressure (Pa)RelativeHumidity
- relative humidity ratio (from 0 to 1) (-)SpecificHeat
- mass specific constant pressure specific heat per humid air (J/kg/K)Temperature
- absolute dry-bulb temperature (K)WetBulbTemperature
- absolute wet-bulb temperature (K)
NB. If the required property is not present in the instance of the fluid, then you can add it by extending
the Fluid
, Mixture
or HumidAir
classes.
Examples
Don't forget to add using SharpProp;
at the top of the code.
Pure fluids
To calculate the specific heat of saturated water vapour at 101325 Pa:
var waterVapour = new Fluid(FluidsList.Water);
waterVapour.Update(Input.Pressure(101325), Input.Quality(1));
Console.WriteLine(waterVapour.SpecificHeat); // 2079.937085633241
Incompressible binary mixtures
To calculate the dynamic viscosity of propylene glycol aqueous solution with 60 % mass fraction at 101325 Pa and 253.15 K:
var propyleneGlycol = new Fluid(FluidsList.MPG, 0.6);
propyleneGlycol.Update(Input.Pressure(101325), Input.Temperature(253.15));
Console.WriteLine(propyleneGlycol.DynamicViscosity); // 0.13907391053938847
Mixtures
To calculate the density of ethanol aqueous solution (with ethanol 40 % mass fraction) at 200 kPa and 277.15 K:
var mixture = new Mixture(new List<FluidsList> {FluidsList.Water, FluidsList.Ethanol},
new List<double> {0.6, 0.4});
mixture.Update(Input.Pressure(200e3), Input.Temperature(277.15));
Console.WriteLine(mixture.Density); // 883.3922771627759
Humid air
To calculate the wet bulb temperature of humid air at 99 kPa, 303.15 K and 50 % relative humidity:
var humidAir = new HumidAir();
humidAir.Update(InputHumidAir.Pressure(99e3), InputHumidAir.Temperature(303.15),
InputHumidAir.RelativeHumidity(0.5));
// or use:
// var humidAir = HumidAir.WithState(InputHumidAir.Pressure(99e3), InputHumidAir.Temperature(303.15),
// InputHumidAir.RelativeHumidity(0.5));
Console.WriteLine(humidAir.WetBulbTemperature); // 295.0965785590792
Converting to JSON string
For example, converting the Fluid
instance to indented JSON string:
var refrigerant = new Fluid(FluidsList.R32);
refrigerant.Update(Input.Temperature(278.15), Input.Quality(1));
Console.WriteLine(refrigerant.AsJson(indented: true));
As a result:
{
"Name": "R32",
"Fraction": 1.0,
"Compressibility": 0.8266625877210833,
"Conductivity": 0.013435453854396475,
"CriticalPressure": 5782000.0,
"CriticalTemperature": 351.255,
"Density": 25.89088151061046,
"DynamicViscosity": 1.2606543144761657E-05,
"Enthalpy": 516105.7800378023,
"Entropy": 2136.2654412978777,
"FreezingTemperature": null,
"InternalEnergy": 479357.39743435377,
"MaxPressure": 70000000.0,
"MaxTemperature": 435.0,
"MinPressure": 47.999893876059375,
"MinTemperature": 136.34,
"MolarMass": 0.052024,
"Phase": "TwoPhase",
"Prandtl": 1.2252282243443504,
"Pressure": 951448.019691762,
"Quality": 1.0,
"SoundSpeed": 209.6337575990297,
"SpecificHeat": 1305.7899441785378,
"SurfaceTension": 0.010110117241546162,
"Temperature": 278.15,
"TriplePressure": 47.999893876059375,
"TripleTemperature": 136.34
}
Equality of instances
You can simply determine the equality of Fluid
, Mixture
and HumidAir
instances by its state.
Just use the Equals
method or the equality operators (==
or !=
).
Exactly the same way you can compare inputs (Input
, InputHumidAir
or any IKeyedInput
record).
For example:
var humidAir = HumidAir.WithState(InputHumidAir.Pressure(101325),
InputHumidAir.Temperature(293.15), InputHumidAir.RelativeHumidity(0.5));
var humidAirWithSameState = HumidAir.WithState(InputHumidAir.Pressure(101325),
InputHumidAir.Temperature(293.15), InputHumidAir.RelativeHumidity(0.5));
Console.WriteLine(humidAir == humidAirWithSameState); // true
Console.WriteLine(InputHumidAir.Pressure(101325) == InputHumidAir.Pressure(101.325e3)); // true
Adding other properties
Adding other inputs
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SharpProp:
Package | Downloads |
---|---|
VCRC
Cross-platform vapor-compression refrigeration cycles analysis tool |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
7.3.0 | 407 | 10/3/2024 |
7.2.11 | 830 | 8/29/2024 |
7.2.10 | 784 | 7/2/2024 |
7.2.9 | 418 | 6/11/2024 |
7.2.8 | 875 | 3/19/2024 |
7.2.7 | 589 | 2/21/2024 |
7.2.6 | 310 | 1/19/2024 |
7.2.4 | 203 | 1/16/2024 |
7.2.3 | 305 | 12/27/2023 |
7.2.2 | 234 | 12/20/2023 |
7.2.1 | 303 | 12/10/2023 |
7.2.0 | 275 | 11/30/2023 |
7.1.0 | 315 | 11/15/2023 |
7.0.6 | 190 | 11/10/2023 |
7.0.5 | 363 | 10/11/2023 |
7.0.4 | 356 | 9/26/2023 |
7.0.3 | 351 | 9/6/2023 |
7.0.2 | 347 | 8/31/2023 |
7.0.1 | 226 | 8/30/2023 |
7.0.0 | 394 | 8/4/2023 |
6.0.4 | 1,151 | 3/18/2023 |
6.0.3 | 367 | 3/10/2023 |
6.0.2 | 408 | 3/5/2023 |
6.0.1 | 437 | 2/26/2023 |
6.0.0 | 492 | 2/18/2023 |
5.0.0 | 1,055 | 12/4/2022 |
4.4.1 | 5,302 | 11/21/2022 |
4.4.0 | 473 | 11/15/2022 |
4.3.3 | 636 | 11/7/2022 |
4.3.2 | 533 | 11/2/2022 |
4.3.1 | 690 | 9/12/2022 |
4.2.5 | 615 | 9/5/2022 |
4.2.4 | 646 | 8/17/2022 |
4.2.3 | 642 | 8/5/2022 |
4.2.2 | 634 | 7/22/2022 |
4.2.1 | 668 | 7/4/2022 |
4.2.0 | 667 | 6/29/2022 |
4.1.0 | 459 | 6/27/2022 |
4.0.3 | 871 | 6/22/2022 |
4.0.2 | 644 | 6/14/2022 |
4.0.1 | 663 | 6/7/2022 |
4.0.0 | 557 | 5/27/2022 |
3.2.4 | 579 | 5/7/2022 |
3.2.3 | 726 | 4/24/2022 |
3.2.2 | 864 | 4/6/2022 |
3.2.1 | 711 | 4/4/2022 |
3.2.0 | 735 | 3/22/2022 |
3.1.19 | 680 | 3/11/2022 |
3.1.18 | 685 | 3/4/2022 |
3.1.17 | 652 | 3/1/2022 |
3.1.16 | 668 | 2/17/2022 |
3.1.15 | 656 | 2/12/2022 |
3.1.14 | 728 | 1/29/2022 |
3.1.13 | 410 | 1/10/2022 |
3.1.11 | 559 | 12/8/2021 |
3.1.10 | 477 | 12/5/2021 |
3.1.9 | 1,535 | 11/28/2021 |
3.1.8 | 426 | 11/27/2021 |
3.1.7 | 3,312 | 11/25/2021 |
3.1.6 | 311 | 11/23/2021 |
3.1.4 | 363 | 11/16/2021 |
3.1.3 | 357 | 11/13/2021 |
3.1.2 | 426 | 11/6/2021 |
3.1.1 | 394 | 11/5/2021 |
3.1.0 | 404 | 10/29/2021 |
3.0.4 | 371 | 10/26/2021 |
3.0.3 | 483 | 10/24/2021 |
3.0.2 | 473 | 10/23/2021 |
3.0.1 | 378 | 10/22/2021 |
3.0.0 | 403 | 10/21/2021 |
2.0.4 | 382 | 10/18/2021 |
2.0.3 | 424 | 10/17/2021 |
2.0.2 | 364 | 10/15/2021 |
2.0.1 | 361 | 10/5/2021 |
2.0.0 | 356 | 9/27/2021 |
1.1.0 | 422 | 9/18/2021 |
1.0.6 | 344 | 9/18/2021 |
1.0.5 | 433 | 9/15/2021 |
1.0.4 | 370 | 9/15/2021 |
1.0.3 | 389 | 9/15/2021 |
1.0.2 | 366 | 9/15/2021 |
1.0.1 | 438 | 9/12/2021 |
Added aliases for the FluidsList