SharpProp 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpProp --version 1.0.3                
NuGet\Install-Package SharpProp -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpProp" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpProp --version 1.0.3                
#r "nuget: SharpProp, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SharpProp as a Cake Addin
#addin nuget:?package=SharpProp&version=1.0.3

// Install SharpProp as a Cake Tool
#tool nuget:?package=SharpProp&version=1.0.3                

SharpProp

License Coverage

A simple, full-featured, lightweight CoolProp wrapper for C#

NuGet

The project gets published on NuGet.

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 - phase
  • Prandtl - 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 below.

Examples

Pure fluids

To calculate the specific heat of saturated water vapour at 101325 Pa:

using System;
using SharpProp;

namespace TestProject
{
    internal static class Program
    {
        private static void Main()
        {
            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:

using System;
using SharpProp;

namespace TestProject
{
    internal static class Program
    {
        private static void Main()
        {
            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:

using System;
using System.Collections.Generic;
using SharpProp;

namespace TestProject
{
    internal static class Program
    {
        private static void Main()
        {
            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:

using System;
using SharpProp;

namespace TestProject
{
    internal static class Program
    {
        private static void Main()
        {
            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
        }
    }
}
Adding other properties or inputs

See an examples in SharpProp.Tests/Fluids and SharpProp.Tests/HumidAir.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

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.2.11 457 8/29/2024
7.2.10 747 7/2/2024
7.2.9 345 6/11/2024
7.2.8 765 3/19/2024
7.2.7 539 2/21/2024
7.2.6 266 1/19/2024
7.2.4 166 1/16/2024
7.2.3 269 12/27/2023
7.2.2 214 12/20/2023
7.2.1 269 12/10/2023
7.2.0 238 11/30/2023
7.1.0 280 11/15/2023
7.0.6 153 11/10/2023
7.0.5 342 10/11/2023
7.0.4 317 9/26/2023
7.0.3 315 9/6/2023
7.0.2 294 8/31/2023
7.0.1 194 8/30/2023
7.0.0 361 8/4/2023
6.0.4 1,116 3/18/2023
6.0.3 334 3/10/2023
6.0.2 373 3/5/2023
6.0.1 404 2/26/2023
6.0.0 456 2/18/2023
5.0.0 1,019 12/4/2022
4.4.1 5,270 11/21/2022
4.4.0 459 11/15/2022
4.3.3 598 11/7/2022
4.3.2 503 11/2/2022
4.3.1 660 9/12/2022
4.2.5 600 9/5/2022
4.2.4 616 8/17/2022
4.2.3 614 8/5/2022
4.2.2 604 7/22/2022
4.2.1 637 7/4/2022
4.2.0 635 6/29/2022
4.1.0 441 6/27/2022
4.0.3 822 6/22/2022
4.0.2 613 6/14/2022
4.0.1 633 6/7/2022
4.0.0 537 5/27/2022
3.2.4 564 5/7/2022
3.2.3 696 4/24/2022
3.2.2 827 4/6/2022
3.2.1 676 4/4/2022
3.2.0 702 3/22/2022
3.1.19 648 3/11/2022
3.1.18 662 3/4/2022
3.1.17 638 3/1/2022
3.1.16 635 2/17/2022
3.1.15 643 2/12/2022
3.1.14 697 1/29/2022
3.1.13 380 1/10/2022
3.1.11 523 12/8/2021
3.1.10 448 12/5/2021
3.1.9 1,504 11/28/2021
3.1.8 394 11/27/2021
3.1.7 3,291 11/25/2021
3.1.6 307 11/23/2021
3.1.4 341 11/16/2021
3.1.3 343 11/13/2021
3.1.2 410 11/6/2021
3.1.1 393 11/5/2021
3.1.0 368 10/29/2021
3.0.4 351 10/26/2021
3.0.3 481 10/24/2021
3.0.2 454 10/23/2021
3.0.1 360 10/22/2021
3.0.0 380 10/21/2021
2.0.4 378 10/18/2021
2.0.3 420 10/17/2021
2.0.2 343 10/15/2021
2.0.1 337 10/5/2021
2.0.0 335 9/27/2021
1.1.0 406 9/18/2021
1.0.6 326 9/18/2021
1.0.5 413 9/15/2021
1.0.4 352 9/15/2021
1.0.3 373 9/15/2021
1.0.2 344 9/15/2021
1.0.1 421 9/12/2021