Skip to content

Repository files navigation

NuGetNuGetPlatformLicense

SharpFluids

Unit-safe fluid properties using CoolProp and EngineeringUnits

Getting started

Looking up properties for Ammonia

usingEngineeringUnits;usingEngineeringUnits.Units;usingSharpFluids;...FluidR717=newFluid(FluidList.Ammonia);R717.UpdatePT(Pressure.FromBars(10),Temperature.FromDegreesCelsius(100));Console.WriteLine(R717.Density);// 5.751 kg/m³Console.WriteLine(R717.DynamicViscosity);// 1.286e-05 Pa·s

Available properties

  • Compressibility
  • Conductivity (W/m/K)
  • CriticalPressure (Pa)
  • CriticalTemperature (K)
  • Density - (kg/m3)
  • DynamicViscosity (Pa*s)
  • Enthalpy (J/kg)
  • Entropy (J/kg/K)
  • InternalEnergy (J/kg)
  • MolarMass (kg/mol)
  • Phase
  • Prandtl
  • Pressure(Pa)
  • Quality
  • SoundSpeed (m/s)
  • SpecificHeat (J/kg/K)
  • SurfaceTension (N/m)
  • Temperature (K)
  • TriplePressure (Pa)
  • TripleTemperature (K)

What is unit-safety?

"As long as you do all your calculation in SI-units.." is the normal saying but if you have tried spending days debugging code to figure out you 'just' had a wrong unit - then unit-safety is your new friend

This is an example of a common unit mistake - With unit-safety you get an error where you did the mistake.

Massmass=newMass(10,MassUnit.Kilogram);Volumevolume=newVolume(4,VolumeUnit.CubicMeter);DensityD1=mass/volume;// 2.5 kg/m³DensityD2=volume/mass;// WrongUnitException: 'This is NOT a [kg/m³] as expected! Your Unit is a [m³/kg]'

Converting between units is not your headache anymore

You just input the units you have and ask for the units you want:

Lengthlength=newLength(5.485,LengthUnit.Inch);Lengthheight=newLength(12.4,LengthUnit.Centimeter);Areaarea=length*height;// 0.01728 m²Console.WriteLine(area.ToUnit(AreaUnit.SquareFoot));// 0.186 ft²Console.WriteLine(area.ToUnit(AreaUnit.SquareCentimeter));// 172.8 cm²

About

Lightweight CoolProp C# Wrapper - for easy fluid properties lookups

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages