 NCL Home > Documentation > Functions > Meteorology

# static_energy_atm

Compute the atmospheric moist and dry static energy. 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 static_energy_atm (
t          : numeric,  ; float, double, integer only
q          : numeric,
z          : numeric,
iounit  : integer
)

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

## Arguments

t

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

q

A scalar or array containing specific humidity (units: kg/kg, g/kg).

z

A scalar or array containing height (m).

iounit

An integer array of length 2 which specifies the units of the input t and q.

• 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 q are kg/kg
• iounit(1)=1 input q are g/kg

## Return value

A variable of type 'list' which comtains 3 derived variables: [/MSE, DSE, LSE /] The returned units are J/kg.

## Description

The static energy is a combination of an air parcel's :

```          Latent heat: Lv*q          ; Lv - latent heat of vaporization of water
Dry Air Enthalpy: Cp*t     ; Cp - specific heat of dry air at constant pressure
Potential Energy: g*z      ; g  - gravity
```

The atmosphere's total static energy is composed of two components: Dry Static Energy (DSE) and Latent Static Energy (LSE). Specifically:

```          DSE = Cp*t + g*z
```
and
```          LSE = Lv*q
```
The sum of (DSE+LSE) is commonly called Moist Static Energy (MSE):
```
MSE = DSE + LSE
```

• The MSE is a thermodynamic variable that describes the state of an air parcel. It is similar to the equivalent potential temperature. As noted in Yano and Ambaum (2017): "MSE is conserved under moist adiabatic processes and under hydrostatic balance, thus it is a useful quantity to understand moist convection."

• The DSE [aka: Montgomery Streamfunction] is a thermodynamic variable similar to potential temperature, except that the concept of static energy assumes that any kinetic energy is locally dissipated into heat.

```Reference:
Holton, J. R. (1992): An Introduction the Dynamic Meteorology. Academic Press.

Wikipedia: Moist Static Energy

Yano, J.-I. and Ambaum, M. H. P. (2017):

Moist static energy: definition, reference constants, a conservation law and effects on buoyancy
Q.J.R. Meteorol. Soc, 143: 2727-2734.
```

## Examples

Example 1:

```   t  = 27.3       ; C         iounit(0)=0
q  = 14.4       ; g/kg      iounit(1)=1
z  = 275        ; m         elevation above the ground

SE = static_energy_atm(t, q, z, (/0,1/)

; clarity: explicitly extract each variable from list
MSE = SE       ; MSE = 341007  J/kg
DSE = SE       ; DSE = 304858  J/kg
LSE = SE       ; LSE = 36149.8 J/kg
delete(SE)   ; no longer needed

printVarSummary(MSE)
printVarSummary(DSE)
printVarSummary(LSE)
```

Example 2:

```   a    = addfile("cam35.h0.0008-07.nc", "r")
T    = a->T              ; K         iounit(0)=1   (time,lev,lat,lon)
Q    = a->Q              ; kg/kg     iounit(1)=0
ZG   = a->Z3             ; m         Geopotential Height (above sea level)
PHIS = a->PHIS           ; m2/s2     Surface geopotential (time,lat,lon)
PHIS = PHIS/9.8          ; m
phis = conform(ZG, PHIS, (/0,2,3/))        ;  (time,lev,lat,lon)
Z    = ZG-phis           ; m         Height above the surface
copy_VarCoords(ZG, Z)

SE = static_energy_atm(t, q, z, (/1,0 /)

; for clarity: explicitly extract each variable from list
MSE = SE
DSE = SE
LSE = SE
delete(SE)   ; no longer needed

printVarSummary(MSE)
printMinMax(MSE,0)

printVarSummary(DSE)
printMinMax(DSE,0)

printVarSummary(LSE)
printMinMax(LSE,0)

;--- print an arbitrary location and time

hyam = a->hyam ; read from a file the mid-layer coef
hybm = a->hybm ; read from a file
ps   = a->PS   ; surface pressure [Pa]
p0   = 100000. ; since ps is in Pa or [ f->P0]
pm   = pres_hybrid_ccm(ps,p0,hyam,hybm)
copy_VarCoords(T, pm)
pm   = pm*0.01 ; convert to hPa
pm@long_name = "pressure level"
pm@units     = "hPa"

nt  = 0
LAT = 5
LON = 120
print(sprintf("%8.1f", pm(nt,:,{LAT},{LON}))+"  " \
+sprintf("%8.1f",  T(nt,:,{LAT},{LON}))+"  " \
+sprintf("%8.6f",  Q(nt,:,{LAT},{LON}))+"  " \
+sprintf("%8.1f",  Z(nt,:,{LAT},{LON}))+"  " \
+sprintf("%8.1f",MSE(nt,:,{LAT},{LON}))+"  " \
+sprintf("%8.1f",DSE(nt,:,{LAT},{LON}))+"  " \
+sprintf("%8.1f",LSE(nt,:,{LAT},{LON})) )

```
The edited output is:
```
Variable: MSE
Type: float
Total Size: 1437696 bytes
359424 values
Number of Dimensions: 4
Dimensions and sizes:	[time | 1] x [lev | 26] x [lat | 96] x [lon | 144]
Coordinates:
time: [3132..3132]
lev: [3.54463800000001..992.5560999999998]
lat: [ -90..89.99999999999999]
lon: [   0..357.5]
Number Of Attributes: 4
long_name :	Moist Static Energy
units :	J/kg
info :	MSE = (Cp*t + g*z)+Lv*q
short_name :	MSE
(0)	Moist Static Energy (J/kg) : min=487256   max=915394
(0)	=========

Variable: DSE
Type: float
Total Size: 1437696 bytes
359424 values
Number of Dimensions: 4
Dimensions and sizes:	[time | 1] x [lev | 26] x [lat | 96] x [lon | 144]
Coordinates:
time: [3132..3132]
lev: [3.54463800000001..992.5560999999998]
lat: [ -90..89.99999999999999]
lon: [   0..357.5]
Number Of Attributes: 4
long_name :	Dry Static Energy
units :	J/kg
info :	DSE = (Cp*t + g*z)
short_name :	DSE
(0)	Dry Static Energy (J/kg) : min=487256   max=915394
(0)	=========

Variable: LSE
Type: float
Total Size: 1437696 bytes
359424 values
Number of Dimensions: 4
Dimensions and sizes:	[time | 1] x [lev | 26] x [lat | 96] x [lon | 144]
Coordinates:
time: [3132..3132]
lev: [3.54463800000001..992.5560999999998]
lat: [ -90..89.99999999999999]
lon: [   0..357.5]
Number Of Attributes: 4
long_name :	moist static energy
units :	J/kg
info :	lse = Lv*q
short_name :	mse
(0)	latent static energy (J/kg) : min=0.00124475   max=55.3337

P        T         Q        Z        MSE       DSE        LSE
3.5     230.3  0.000002   37852.7  602605.8  602601.1       4.7
7.4     222.1  0.000002   32957.0  546323.9  546319.2       4.7
14.0     224.2  0.000002   28764.5  507375.8  507371.1       4.7
23.9     220.1  0.000002   25230.7  468661.8  468657.1       4.6
37.2     215.2  0.000002   22394.1  435906.7  435902.1       4.5
53.1     208.9  0.000002   20171.9  407830.0  407825.5       4.5
70.1     201.2  0.000002   18495.8  383577.0  383572.3       4.7
85.5     192.2  0.000002   17339.5  363277.1  363272.3       4.8
100.6     191.3  0.000002   16424.7  353367.9  353363.8       4.2
118.4     194.4  0.000003   15504.9  347460.5  347454.1       6.4
139.3     200.1  0.000005   14564.2  344022.9  344009.2      13.7
164.0     207.8  0.000013   13591.6  342251.0  342218.3      32.7
192.9     216.5  0.000035   12580.3  341127.1  341040.4      86.6
227.0     225.6  0.000084   11526.9  340020.2  339809.9     210.3
267.1     234.9  0.000174   10430.0  338845.9  338408.2     437.7
314.3     244.2  0.000310    9288.8  337416.7  336637.8     778.8
369.8     253.1  0.000601    8104.0  335519.8  334011.3    1508.5
435.1     262.0  0.001239    6876.7  334030.8  330920.5    3110.3
511.9     269.0  0.003729    5610.5  334897.1  325536.5    9360.6
602.3     275.4  0.005283    4311.0  332521.2  319258.8   13262.4
698.9     281.7  0.007350    3091.8  332011.0  313559.5   18451.5
790.1     286.4  0.009778    2065.1  332812.6  308266.9   24545.6
869.9     291.6  0.011405    1245.7  334101.3  305470.9   28630.4
932.6     295.1  0.015777     642.6  342658.3  303051.3   39607.0
973.6     298.1  0.017377     264.7  346017.2  302394.7   43622.5
995.7     299.8  0.017613      66.3  346386.1  302169.2   44216.9
```