NCL Home > Documentation > Functions > Meteorology

# enthalpy

Compute atmospheric enthalpy.

Available in version 6.5.0 and later.

## Prototype

```load "\$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
; from NCL V6.2.0 onward.
; No need for user to explicitly load.

function enthalpy (
t          : numeric,  ; float, double, integer only
w          : numeric,
iounit [3] : integer
)

return_val [dimsizes(t)] :  float or double
```

## Arguments

t

A scalar or array containing temperature (units: degC, degK, degF). If t and w are arrays they must be the same size and shape (ie: conform).

w

A scalar or array containing mixing ratio (units: kg/kg, g/kg). If w and t are arrays they must be the same size and shape (ie: conform).

iounit

An integer array of length 3 which specifies the units of the input t and w and returned enthalpy units.

• iounit(0)=0 input t are degrees Celcius (degC)
• iounit(0)=1 input t are degrees Kelvin (degK)
• iounit(0)=2 input t are degrees Farenheit (degF)

• iounit(1)=0 input w are kg/kg
• iounit(1)=1 input w are g/kg

• iounit(2)=0 output enthalpy are kJ/kg
• iounit(2)=1 output enthalpy are J/kg

## Return value

A variable of the same size and shape as t.

## Description

Enthalpy is a thermodynamic quantity equivalent to the internal energy plus the energy the system exerts on its surroundings. The enthalpy is a constant pressure function. As such, it includes the work term for expansion against the atmosphere.

## Examples

The https://www.aqua-calc.com/calculate/humidity WWW link can be used for evaluation.

Example 1:

```   t    = (/20, 32.2222/)        ; degC,  iounits(0)=0
rh   = (/40, 70 /)            ; %
w    = (/0.005875, 0.021717/) ; kg/kg, iounits(1)=0

io   = (/ 0, 0, 0/)           ; kJ/kg, iounits(2)=0
e    = enthalpy(t, w, io )    ; kJ/kg   ; (/ 35.10, 98.38 /)

print(e)
```
The output:
```
Variable: e
Type: float
Total Size: 8 bytes
2 values
Number of Dimensions: 1
Dimensions and sizes:   [2]
Coordinates:
Number Of Attributes: 4
long_name :   Enthalpy
units :       kJ/kg
equation :    Enthalpy (h) kJ/kg = T * (1.01 + 0.00189 * W) + 2.5 * W; T=>degC, W=>g/kg
NCL : enthalpy
(0)     35.09689
(1)     98.3828
```

Example 2: Same as Example but aternative input and output units.

```
w    = (/ 5.875,  21.717/)    ; g/kg, iounits(1)=1

tk   = (/293.15, 305.375/)    ; degK, iounits(0)=1
io   = (/ 1, 1, 0/)           ; kJ/kg,iounits(0)=0
ek   = enthalpy(tk, w, io )   ; kJ/kg; (/ 35.10, 88.16 /)

tf   = (/ 68.0 ,  90.0  /)    ; degF, iounits(0)=2
io   = (/ 2, 1, 1/)           ;  J/kg, iounits(0)=0
ef   = enthalpy(tf, w, io )   ;  J/kg; (/ 35109.59, 88159.55/)
```