{"id":18576637,"url":"https://github.com/mmomtchev/velitherm","last_synced_at":"2026-03-11T14:13:38.010Z","repository":{"id":57391451,"uuid":"467943963","full_name":"mmomtchev/velitherm","owner":"mmomtchev","description":"A library of basic thermodynamics equations for soaring flight","archived":false,"fork":false,"pushed_at":"2026-03-06T02:03:04.000Z","size":1613,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-06T06:33:06.218Z","etag":null,"topics":["flight","soaring","thermodynamics","weather"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmomtchev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING","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":"2022-03-09T13:43:45.000Z","updated_at":"2026-03-06T02:03:01.000Z","dependencies_parsed_at":"2024-01-15T18:45:30.216Z","dependency_job_id":"d21f7b8e-3a52-4cdf-812d-da3e7eeefc6a","html_url":"https://github.com/mmomtchev/velitherm","commit_stats":{"total_commits":176,"total_committers":2,"mean_commits":88.0,"dds":"0.26136363636363635","last_synced_commit":"ae5956583d18c1b696b706697d660c352192a0fd"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mmomtchev/velitherm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmomtchev%2Fvelitherm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmomtchev%2Fvelitherm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmomtchev%2Fvelitherm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmomtchev%2Fvelitherm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmomtchev","download_url":"https://codeload.github.com/mmomtchev/velitherm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmomtchev%2Fvelitherm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30383458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T14:10:17.325Z","status":"ssl_error","status_checked_at":"2026-03-11T14:09:37.934Z","response_time":84,"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":["flight","soaring","thermodynamics","weather"],"created_at":"2024-11-06T23:25:45.985Z","updated_at":"2026-03-11T14:13:38.004Z","avatar_url":"https://github.com/mmomtchev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Velitherm\n\n[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)\n[![Node.js CI](https://github.com/mmomtchev/velitherm/actions/workflows/node.js.yml/badge.svg)](https://github.com/mmomtchev/velitherm/actions/workflows/node.js.yml)\n[![npm version](https://img.shields.io/npm/v/velitherm)](https://www.npmjs.com/package/velitherm)\n[![codecov](https://codecov.io/gh/mmomtchev/velitherm/branch/main/graph/badge.svg?token=aU1ATy8HKv)](https://codecov.io/gh/mmomtchev/velitherm)\n\nA library of basic thermodynamics equations for soaring flight.\n\nAs used by the weather site https://www.velivole.fr / https://www.meteo.guru\n\nZero-dependency!\n\nIf you are new to weather thermodynamics, you should probably start here: [Basic Concepts of Thermodynamics for Soaring Flight](https://github.com/mmomtchev/velivole/blob/main/THERMODYNAMICS.md)\n\n*Si vous n'êtes pas à l'aise en thermodynamique appliquée à la météorologie, vous devriez peut-être commencer ici: [Bases de la thermodynamique pour le vol libre et le vol à voile](https://github.com/mmomtchev/velivole/blob/main/THERMODYNAMIQUE.md)*\n\n# Installation\n\n```bash\nnpm install --save velitherm\n```\n\n# Usage\n\nKeep in mind that some equations are numerical approximations of differential equations that have no analytic solutions. The approximations used are the typical weather science approximations which produce good results for temperatures in the range of -40°C to +40°C and air pressures in the range of 1050hPa to 200hPa - which are the typical values in the troposphere - but often lack precision outside this range.\n\nYou can check [velitherm-visu](https://github.com/mmomtchev/velitherm-visu) for a real-world example of using this library. It is hosted at [aircalc.velivole.fr](https://aircalc.velivole.fr).\n\n## Common JS\n\n```js\nconst velitherm = require('velitherm');\n\n// must be very close to 1000\nconst alt = velitherm.altitudeFromPressure(898.746);\n```\n\n## ECMAScript 6\n\n```js\nimport * as velitherm from 'velitherm';\n\n// must be very close to 1000\nconst alt = velitherm.altitudeFromPressure(898.746);\n```\n\n## TypeScript\n\n```js\nimport * as velitherm from 'velitherm';\n\n// must be very close to 1000\nconst alt = velitherm.altitudeFromPressure(898.746);\n```\n\n## C++\n\n```cpp\n#include \"node_modules/velitherm/include/velitherm.h\"\n\n// must be very close to 1000\ndouble alt = velitherm::altitudeFromPressure(898.746);\n```\n\n## C\n\n```c\n#include \"node_modules/velitherm/include/velitherm.h\"\n\n// must be very close to 1000\ndouble alt = altitudeFromPressure(898.746, P0, T0);\n```\n\nWhen using plain old C, you should be using C99 (otherwise `gcc` may include a deprecated and non-standard math function called `gamma`) and you should link the math library if it is not already linked.\n\n## Barometric and hypsometric equations\n\nThere is no single analytical equation that can be used to give a precise value for the altitude / pressure relationship. In fact, this relationship depends on the full vertical temperature and humidity profile and it is impossible to reduce to a single formula. There are two levels of approximation that are widely used:\n\n*   The barometric formula, which is an ICAO standard and gives a rough value that does not take into account the pressure or the temperature of the day and it is always constant - in aviation it is referred by the callsign **QNH**\n*   The hypsometric formula, which is commonly used in weather science and it is a better estimation that takes into account the pressure and the temperature of the day - so it varies from one day to another - in aviation it is referred by the callsign **QFF**\n\nIf you are coming from an aviation background, and **QNH**, **QFF** and **QFE** are altimeter settings to you, then you should know that they actually refer to different equations for calculating the altitude from the pressure. **QFE** refers to the surface pressure of a given site - airport or weather station - and not an equation. If you want to use `velitherm` to convert between altimeter settings, the right way to do it would be to convert the pressure to altitude using the input setting and then convert it back to pressure using the output setting.\n\n# Examples\n\n## General weather science\n\nAn air parcel with relative humidify of 75% and temperature of 25°C rises from 0m AMSL to 500m AMSL where the surrounding temperature is 20°C. What is its new relative humidity? What is its new temperature? Has there been condensation and did it form a cloud? Has the convective top (ceiling) been reached or will the air parcel continue to rise? The pressure of the day is 1017hPa and the relative humidity at 500m AMSL is 50%.\n\nSolution:\n\n```ts\nimport * as velitherm from 'velitherm';\n\n// When the air rises, its specific humidity remains constant\nconst q = velitherm.specificHumidity(75, 1017, 25);\nconsole.log('Specific humidity = ', Math.round(q), 'g/kg');\nconsole.log('Dew point = ', velitherm.dewPoint(75, 25).toFixed(2), '°C');\n\n// Find the current pressure at 500m AMSL\nconst P1 = velitherm.pressureFromAltitude(500, 1017, 25);\nconsole.log('Pressure at 500m = ', Math.round(P1), 'hPa');\n\n// Take into account the dry adiabatic cooling over 500m\nconst T1 = 25 - 500 * velitherm.gamma;\nconsole.log('The new temperature of the air parcel at 500m = ', T1, '°C');\n\n// Compute the new relative humidity of the air parcel at this pressure and\n// temperature\nconst w1 = velitherm.relativeHumidity(q, P1, T1);\nconsole.log('Relative humidity after rising to 500m = ', Math.round(w1), '%');\n\n// If the air parcel has reached 100% relative humidity, then there is\n// condensation\nif (w1 \u003c 100) {\n  console.log('No, it did not form a cloud');\n} else {\n  console.log('Yes, it did form a cloud');\n}\n\n// If the density of the air parcel is still lower than the\n// surrounding air at 500m AMSL, then it will continue to rise\nconst rhoParcel = velitherm.airDensity(w1, P1, T1);\nconst rhoAir500 = velitherm.airDensity(50, P1, 20);\nif (rhoParcel \u003c rhoAir500) {\n  console.log('The air parcel will continue to rise');\n} else {\n  console.log('The ceiling has been reached');\n}\n```\n\nYou can run the example program with\n\n```shell\nnpx tsx examples/risingAir.ts\n```\n\n*Note that the dew point of the air parcel at sea level is 20.26°C, yet it does not form a cloud when cooled down to 20.12°C at 500m AMSL. The reason is that a dew point is valid only for a given pressure. At a lower pressure, the dew point will also be lower.*\n\n## Flight instruments\n\nI know that the surrounding air pressure is 821 hPa. How can I tell what is my current altitude? How can I tell what is my current flight level and how far I am from FL115?\n\nMy local weather information provider tells me that the mean sea level pressure of the day at my location is 1017 hPa. How can I improve the accuracy of my height estimate? And if I know that the mean temperature of the air below me is 23°C? How can I get an even better estimate?\n\nWhat should I do if I don't have any idea about today's pressure and temperature of the air near the ground? How can I be sure to stay below FL115?\n\nSolution:\n\n```ts\nimport * as velitherm from 'velitherm';\n\nconst barometerInput = 821;\nconst pressureMSL = 1017;\nconst temperatureBelow = 23;\n\n// Rough estimate of the height using only the pressure\n// We round it to 50m because it is a rough estimate\nconst alt = Math.round(velitherm.altitudeFromStandardPressure(barometerInput) /\n  50) * 50;\nconsole.log('Rough estimate of the altitude is', alt, 'm');\n\n// Better estimate of the height using the ground pressure\nconst alt2 = Math.round(velitherm.altitudeFromPressure(barometerInput,\n  pressureMSL));\nconsole.log('Better estimate of the altitude is', alt2, 'm');\n\n// Even better estimate of the height using the temperature\nconst alt3 = Math.round(velitherm.altitudeFromPressure(barometerInput,\n  pressureMSL, temperatureBelow));\nconsole.log('Even better estimate of the altitude is', alt3, 'm');\n\n// Flight levels are in pressure-feet, so we do not need\n// anything but the barometer input (this is the very reason for this)\nconst fl = velitherm.FLFromPressure(barometerInput);\nconsole.log('The current closest flight level is FL', fl);\n\n// What is the current altitude for FL115?\n// FL115 means 11500 feet measured at pressure at standard atmospheric\n// conditions\nconst pressureFL115 = velitherm.pressureFromFL(115);\nconsole.log('FL115 means the altitude at which the pressure is',\n  Math.round(pressureFL115), 'hPa');\n\n// Get the actual altitude for today\nconst altitudeFL115 = Math.round(velitherm.altitudeFromPressure(\n  pressureFL115, pressureMSL, temperatureBelow));\nconsole.log('Today FL115 is at', altitudeFL115, 'm');\nconsole.log('You can climb', altitudeFL115 - alt3, 'm before reaching FL115');\n\n// Get the most pessimistic (lowest) possible estimate for FL115?\n// This is possible only with a minimum pressure and a minimum air temperature\n// We suppose that we are not flying in winter storm conditions\n// Let's define these as 1000 hPa and -20°C\n// You should never be flying in an ultralight aircraft is pressure\n// is below 1000 hPa\nconst altitudeMinFL115 = Math.round(velitherm.altitudeFromPressure(\n  pressureFL115, 1000, -20));\nconsole.log('FL115 should not be below', altitudeMinFL115,\n  'm even in bad winter weather');\nconsole.log('You can climb', altitudeMinFL115 - alt3,\n  'm before reaching the pessimistic estimate for FL115');\n```\n\nRun this example with:\n\n```shell\nnpx tsx examples/flightInstrument.ts\n```\n\n*Please note the huge difference between the usual 3505m estimate for FL115 and the actual 3945m altitude for this given day or the 3237m altitude in bad winter weather!*\n\n# API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [velitherm](#velitherm)\n*   [G](#g)\n*   [Cp](#cp)\n*   [L](#l)\n*   [gamma](#gamma)\n*   [ELR](#elr)\n*   [P0](#p0)\n*   [T0](#t0)\n*   [Rd](#rd)\n*   [Rv](#rv)\n*   [Md](#md)\n*   [Mv](#mv)\n*   [R](#r)\n*   [K](#k)\n*   [feetPerMeter](#feetpermeter)\n*   [altitudeFromStandardPressure](#altitudefromstandardpressure)\n    *   [Parameters](#parameters)\n*   [pressureFromStandardAltitude](#pressurefromstandardaltitude)\n    *   [Parameters](#parameters-1)\n*   [altitudeFromPressure](#altitudefrompressure)\n    *   [Parameters](#parameters-2)\n*   [pressureFromAltitude](#pressurefromaltitude)\n    *   [Parameters](#parameters-3)\n*   [waterVaporSaturationPressure](#watervaporsaturationpressure)\n    *   [Parameters](#parameters-4)\n*   [relativeHumidity](#relativehumidity)\n    *   [Parameters](#parameters-5)\n*   [dewPoint](#dewpoint)\n    *   [Parameters](#parameters-6)\n*   [relativeHumidityFromDewPoint](#relativehumidityfromdewpoint)\n    *   [Parameters](#parameters-7)\n*   [mixingRatio](#mixingratio)\n    *   [Parameters](#parameters-8)\n*   [specificHumidityFromMixingRatio](#specifichumidityfrommixingratio)\n    *   [Parameters](#parameters-9)\n*   [specificHumidity](#specifichumidity)\n    *   [Parameters](#parameters-10)\n*   [airDensity](#airdensity)\n    *   [Parameters](#parameters-11)\n*   [LCL](#lcl)\n    *   [Parameters](#parameters-12)\n*   [gammaMoist](#gammamoist)\n    *   [Parameters](#parameters-13)\n*   [adiabaticExpansion](#adiabaticexpansion)\n    *   [Parameters](#parameters-14)\n*   [adiabaticCooling](#adiabaticcooling)\n    *   [Parameters](#parameters-15)\n    *   [Examples](#examples)\n*   [pressureFromFL](#pressurefromfl)\n    *   [Parameters](#parameters-16)\n*   [FLFromPressure](#flfrompressure)\n    *   [Parameters](#parameters-17)\n\n## velitherm\n\nvelivole.fr/meteo.guru Basic Thermodynamics Equations for Soaring Flight\n\nCopyright © 2022 Momtchil Momtchev \u003cmomtchil@momtchev.com\u003e\n\nLicensed under the LGPL License, Version 3.0 (the \"License\")\nYou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at:\n\u003chttps://www.gnu.org/licenses/lgpl-3.0.en.html\u003e\n\nAll methods use:\n\nPressure in hPa\n\nTemperature in °C\n\nHeight in meters\n\nRelative humidity in % from 0 to 100\n\nSpecific humidity in g/kg\n\nMixing ratio in g/kg\n\nType: [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)\n\n## G\n\nEarth's average gravity acceleration (m/s2)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## Cp\n\nThe thermal capacity of air (J/kg)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## L\n\nThe enthalpy of vaporization of water (J/kg)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## gamma\n\nThe adiabatic lapse rate of dry air (°C/m)\n\nThis is the rate of cooling of a rising air parcel\nwithout water vapor condensation.\n\nSee gammaMoist() for the condensation case.\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## ELR\n\nMean environmental lapse rate of the troposphere (°C/m)\n\nThis is the mean rate of cooling of the troposphere when\nthe air is calm and stable. It works best over large\nheight differences. It is also the lapse rate of the\nstandard atmosphere.\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## P0\n\nThe average sea level pressure (hPa)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## T0\n\nThe temperature of the ICAO standard atmosphere (°C)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## Rd\n\nThe specific gas constant of dry air J/(kg\\*K)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## Rv\n\nThe specific gas constant of water vapor J/(kg\\*K)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## Md\n\nMolar mass of dry air kg/mol\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## Mv\n\nMolar mass of water vapor kg/mol\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## R\n\nUniversal gas constant J/(kg\\*mol)\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## K\n\nAbsolute zero in °C\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## feetPerMeter\n\nNumber of feets in one meter\n\nType: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)\n\n## altitudeFromStandardPressure\n\nAltitude from pressure using the barometric formula and ICAO's definition\nof standard atmosphere.\n\nThis is a very rough approximation that is an ICAO standard.\nIt is used when calculating QNH.\nIt does not take into account the pressure and temperature of the day.\n\n### Parameters\n\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Pressure\n*   `pressure0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional sea-level pressure of the day (optional, default `P0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## pressureFromStandardAltitude\n\nPressure from altitude using the barometric formula and ICAO's definition\nof standard atmosphere.\n\nThis is a very rough approximation that is an ICAO standard. It is used\nwhen calculating QNH.\nIt does not take into account the pressure and temperature of the day.\n\n### Parameters\n\n*   `height` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Height\n*   `pressure0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional sea-level pressure of the day (optional, default `P0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## altitudeFromPressure\n\nAltitude from pressure using the hypsometric formula.\n\nThis is a better equation that takes into account the pressure and the\ntemperature of the day.\nIt is not a standard and different weather institutions use slightly\ndifferent parameters.\nIt is used when calculating the QFF.\n\n### Parameters\n\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Pressure\n*   `pressure0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional sea-level pressure of the day (optional, default `P0`)\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional average temperature from the ground\n    to the given level (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## pressureFromAltitude\n\nPressure from altitude using the hypsometric formula.\n\nThis is a better equation that takes into account the pressure and\nthe temperature of the day.\nIt is not a standard and different weather institutions use slightly\ndifferent parameters.\nIt is used when calculating the QFF.\n\n### Parameters\n\n*   `height` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Height\n*   `pressure0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional sea-level pressure of the day (optional, default `P0`)\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional average temperature from the ground\n    to the given level (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## waterVaporSaturationPressure\n\n(Saturation) Water vapor pressure.\n\nClausius–Clapeyron equation - the most fundamental equation in weather\nscience.\n\nThis is the Magnus-Tetens approximation.\n\n### Parameters\n\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Temperature (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## relativeHumidity\n\nRelative humidity from specific humidity.\n\nThis is from the Magnus-Tetens approximation.\n\n### Parameters\n\n*   `specificHumidity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Specific humidity\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional pressure (optional, default `P0`)\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional temperature (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## dewPoint\n\nDew point from relative humidity.\n\nApproximation of the Magnus equation with the Sonntag 1990 coefficients.\n\n### Parameters\n\n*   `relativeHumidity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Relative humidity\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional temperature (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## relativeHumidityFromDewPoint\n\nRelative humidity from dew point.\n\nApproximation of the Magnus equation with the Sonntag 1990 coefficients.\n\n### Parameters\n\n*   `dewPoint` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Relative humidity\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional temperature (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## mixingRatio\n\nMixing ratio from specific humidity.\n\nAnalytic equation from the definition.\n\n### Parameters\n\n*   `specificHumidity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Specific humidity\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## specificHumidityFromMixingRatio\n\nSpecific humidity from mixing ratio.\n\nAnalytic equation from the definition.\n\n### Parameters\n\n*   `mixingRatio` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Mixing ratio\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## specificHumidity\n\nSpecific humidity from relative humidity.\n\nApproximation of the Magnus equation with the Sonntag 1990 coefficients.\n\n### Parameters\n\n*   `relativeHumidity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Relative humidity\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional pressure (optional, default `P0`)\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional temperature (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## airDensity\n\nAir density.\n\nAnalytic equation from Avogadro's Law.\n\n### Parameters\n\n*   `relativeHumidity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Relative humidity\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional pressure (optional, default `P0`)\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional temperature (optional, default `T0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## LCL\n\nLifted Condensation Level.\n\nThis is the altitude at which a mechanically lifted air parcel from\nthe ground will condensate.\n\nIt corresponds to the cloud base level when the clouds are formed by\nmechanical lifting.\n\nThis approximation is known as the Espy equation with the Stull coefficient.\n\n### Parameters\n\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Temperature at 2m\n*   `dewPoint` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Dew point at 2m\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## gammaMoist\n\nMoist adiabatic lapse rate from pressure and temperature.\n\nCopied from Roland Stull, Practical Meteorology\n(copylefted, available online).\n\nRather complex approximation based on the Magnus-Tetens equation and\nthe barometric equation.\n\n### Parameters\n\n*   `temp` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Temperature\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Optional pressure (optional, default `P0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## adiabaticExpansion\n\nAdiabatic expansion rate from pressure change rate.\n\nThis equation allows to calculate the expansion ratio of an air parcel\nfrom the the previous pressure and the new pressure.\n\nAn adiabatic expansion is an isentropic process that is governed by\nthe Ideal gas law in general and the constant entropy relationship in\nparticular:\n(P / P0) = (V / V0) ^ gamma\nWhere P=pressure, V=volume, gamma=heat capacity ratio (1.4 for air,\na diatomic gas)\n\nAnalytic equation.\n\n### Parameters\n\n*   `volume0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Old volume\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** New pressure\n*   `pressure0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Old pressure (optional, default `P0`)\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## adiabaticCooling\n\nAdiabatic cooling rate from pressure change rate.\n\nThis equation allows to calculate the cooling ratio of an air parcel from the\nthe previous pressure and the new pressure.\n\nIt is by combining this equation with the barometric equation\nthat the adiabatic lapse rate of dry air can be obtained.\n\nAn adiabatic expansion is an isentropic process that is governed by\nthe Ideal gas law in general and the constant entropy relationship\nin particular:\n(P / P0) = (V / V0) ^ gamma\nWhere P=pressure, V=volume, gamma=heat capacity ratio (1.4 for air,\na diatomic gas)\n\nKeep in mind that if you intend to use this method to calculate a rate\nrelative to height in meters, you will need very precise altitude\ncalculations for good results. As the dry adiabatic rate is a constant\nthat does not depend on the temperature or the pressure, most of the time\nyou will be better off simply using the `gamma` constant.\n\n\u003chttps://en.wikipedia.org/wiki/Ideal_gas_law\u003e contains a very good\nintroduction to this subject.\n\nAnalytic equation.\n\n### Parameters\n\n*   `temp0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Old temperature\n*   `pressure` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** New pressure\n*   `pressure0` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Old pressure (optional, default `P0`)\n\n### Examples\n\n```javascript\n// Compute the adiabatic cooling per meter\n// when rising from 0m AMSL to 100m AMSL starting at 15°C\n\nconst gamma = (15 - velitherm.adiabaticCooling(15,\n                      velitherm.pressureFromStandardAltitude(100),\n                      velitherm.pressureFromStandardAltitude(0))\n               ) / 100;\n\n// It should be very close to the provided constant\nassert(Math.abs(gamma - velitherm.gamma) \u003c 1e-5)\n```\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## pressureFromFL\n\nConvert a Flight Level to pressure\n\nFlight levels are defined as pressure and not as a fixed\naltitude. This means that a flight level can always be converted\nto pressure without needing any other information in a fully\ndeterministic way.\n\nA flight level of 115 means 11500 feet measured by barometer\nusing the ICAO standard atmosphere.\n\nThe returned pressure can then be converted to altitude using\nany of the above functions, taking into account the MSL pressure and\ntemperature variations.\n\n### Parameters\n\n*   `FL` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Flight Level\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n\n## FLFromPressure\n\nConvert pressure to Flight Level.\n\nFlight levels are defined as pressure and not as a fixed\naltitude. This means that a flight level can always be converted\nto pressure without needing any other information in a fully\ndeterministic way.\n\nA flight level of 115 means 11500 feet measured by barometer\nusing the ICAO standard atmosphere.\n\nThe returned Flight Level can be a fractional number, this should\nbe rounded to the closest integer as there are no fractional flight levels.\n\n### Parameters\n\n*   `P` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** pressure\n\nReturns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)**\u0026#x20;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmomtchev%2Fvelitherm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmomtchev%2Fvelitherm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmomtchev%2Fvelitherm/lists"}