Giter VIP home page Giter VIP logo

sharpfluids's Introduction

NuGet NuGet Platform License

SharpFluids

Unit-safe fluid properties using CoolProp and EngineeringUnits

Getting started

Looking up properties for Ammonia

using EngineeringUnits;
using EngineeringUnits.Units;
using SharpFluids;
.
.
.

Fluid R717 = new Fluid(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.

Mass mass = new Mass(10, MassUnit.Kilogram);
Volume volume = new Volume(4, VolumeUnit.CubicMeter);

Density D1 = mass / volume; // 2.5 kg/m³
Density D2 = 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:

Length length = new Length(5.485, LengthUnit.Inch);
Length height = new Length(12.4, LengthUnit.Centimeter);

Area area = length * height; // 0.01728 m²
Console.WriteLine(area.ToUnit(AreaUnit.SquareFoot)); // 0.186 ft²
Console.WriteLine(area.ToUnit(AreaUnit.SquareCentimeter)); // 172.8 cm²

sharpfluids's People

Contributors

jbahraa avatar madsfoged avatar madskirkfoged avatar romarro avatar theodoreonzgit avatar wiwalsh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.