An electromagnetic wave possesses energy from the electric and magnetic components. This w/u deals with the magnetic component of that energy by taking the example of a solenoid.

A solenoid is basically a conducting coil wrapped in a helix. When an electric current is run through the coil, it generates an opposing emf which must be overcome by the connected battery. Thus, the battery must do work to force a maximum current through the solenoid. This work is stored in the surrounding magnetic field. The circuit equation for a solenoid is

V= L(dI/dt) + RI
where I is the current flowing at a given time, V is the voltage across the solenoid, R is its resistance and L its self-inductance. The power required at any instance in the circuit is given by the product VI. Simply integrating this over time will yield the work done.
W= 1/2(LIo2)+RIo2
The first term on the right hand side is the inductively stored energy (i.e. that stored in the solenoidal magnetic field) while the second term is the energy dissipated resistively. Thus we have
Winductive=1/2(LIo2)= UM
where UM is the magnetic stored energy. In the case of an ideal solenoid (one that is infinitely long) the inductance L can be expressed in terms of the cross-sectional radius r, the length d and the number of turns N of the solenoid
L=μoN2πr2d
where μo is the permeability of free space. In this case the magnetic field running through the solenoid is
B=μoNI
Combining the previous three equations and noting that πr2d is simply the volume of the solenoid V one arrives at
UM=(B2/2μo)V
Finally, divide by volume to obtain the magnetic field energy density, uM
uM=B2/2μ
The permeability may be changed by putting a soft iron core into the solenoid, greatly increasing the amount of magnetic energy that can be stored in the inductor.