Volatiles

Volatiles are the group of chemical elements and chemical compounds that can be readily vaporized. In contrast with volatiles, elements and compounds that are not readily vaporized are known as refractory substances.
On planet earth, the term 'volatiles' often refers to the volatile components of magma. In astrogeology volatiles are investigated in the crust or atmosphere of a planet or moon. Volatiles include nitrogen, carbon dioxide, ammonia, hydrogen, methane, sulfur dioxide and others. 
Planetary science.
Planetary scientists often classify volatiles with exceptionally low melting points, such as hydrogen and helium, as gases (as in gas giant), whereas those volatiles with melting points above about 100 K (–173 °C, –280 °F) are referred to as ices. The terms "gas" and "ice" in this context can apply to compounds that may be solids, liquids or gases. Thus, Jupiter and Saturn are gas giants, and Uranus and Neptune are ice giants, even though the vast majority of the "gas" and "ice" in their interiors is a hot, highly dense fluid that gets denser as the center of the planet is approached.
Igneous petrology.
In igneous petrology the term more specifically refers to the volatile components of magma (mostly water vapor and carbon dioxide) that affect the appearance and explosivity of volcanoes. Volatiles in a magma with a high viscosity, generally felsic with a higher silica (SiO2) content, tend to produce eruptions that are explosive. Volatiles in a magma with a low viscosity, generally mafic with a lower silica content, tend to vent and can give rise to a lava fountain.
Volatiles in magma.
Some volcanic eruptions are explosive because the mixing between water and magma reaching the surface, releases energy suddenly. Moreover, in some cases, the eruption is caused by volatiles dissolved in the magma.
Approaching the surface, pressure decreases and the volatiles evolve creating bubbles that circulate in the liquid. The bubbles are connected together forming a network. This especially increments the fragmentation into small drops or spray or coagulate clots in gas.
Generally, 95-99% of magma is liquid rock. However, the small percentage of gas present, represents a very large volume when it expands on reaching atmospheric pressure. Gas is a preponderant part in a volcano system because it generates explosive eruptions. Magma in the mantle and lower crust has lot of volatiles within and water and carbon dioxide are not the only volatiles that volcanoes release. Also they leak hydrogen sulfide and sulfur dioxide. Sulfur dioxide is usually possible to find in basaltic and rhyolite rocks. Volcanoes also release a high amount of hydrogen chloride and hydrogen fluoride as volatiles.
Solubility of volatiles.
There are three main factors that affect the dispersion of volatiles in magma: confining pressure, composition of magma, temperature of magma. Pressure and composition are the most important parameters.
To understand how the magma behaves rising to the surface, the role of "solubility" within the magma must be known. An empirical law has been used for different magma-volatiles combination. For instance, for water in magma the equation is n=0.1078 P where "n" is the amount of dissolved gas as weight percentage (wt%), "P" is the pressure in megapascal (MPa) that acts on the magma. The value changes for example for water in rhyolite where n=0.4111 P and for the carbon dioxide is n=0.0023 P.
These simple equations work if there is only one volatile in a magma. However, in reality, the situation is not so simple because there are often multiple volatiles in a magma. It is a complex chemical interaction between different volatiles.
Simplifying, the solubility of water in rhyolite and basalt is function of pressure and depth below the surface in absence of other volatiles. Both basalt and rhyolite lose water with decreasing pressure as the magma rises to the surface. The solubility of water is higher in rhyolite than in basaltic magma. Knowledge of the solubility allows the determination of the maximum amount of water that might be dissolved in relation with pressure. If the magma contains less water than the maximum possible amount, it is "undersaturated" in water. Usually insufficient water and carbon dioxide exist in the deep crust and mantle, so magma is often "undersaturated" in these conditions. Magma becomes "saturated" when it reaches the maximum amount of water that can be dissolved in it. If the magma continues to rise up to the surface and more water is dissolved, it becomes "supersaturated". If more water is dissolved in magma, it can be ejected as "bubbles" or vapor water. This happens because pressure decreases in the process and velocity increases and the process has to balance also between decrease of solubility and pressure. Making a comparison with the solubility of carbon dioxide in magma, this is considerably less than water and it tends to exsolve at greater depth. In this case water and carbon dioxide are considered independent. What affects the behavior of the magmatic system is the depth at which carbon dioxide and water are released. Low solubility of carbon dioxide means that it starts to release bubbles before reaching the magma chamber. The magma is at this point already supersaturated. The magma enriched in carbon dioxide bubbles, rises up to the roof of the chamber and carbon dioxide tends to leak through cracks into the overlying caldera. Basically, during an eruption the magma loses more carbon dioxide than water, that in the chamber is already supersaturated. Overall, water is the main volatile during an eruption.
Nucleation of bubbles.
Bubble nucleation happens when the a volatile becomes saturated. Actually the bubbles are composed of molecules that tend to aggregate spontaneously in a process called homogeneous nucleation. The surface tension acts on the bubbles shrinking the surface and forces them back to the liquid. The nucleation process is greater when the space to fit is irregular and the volatile molecules can ease the effect of surface tension. The nucleation can occur thanks to the presence of solid crystals, which are stored in the magma chamber. They are perfect potential nucleation sites for bubbles. If there is no nucleation in the magma the bubbles formation might appear really late and magma becomes significantly supersaturated. The balance between supersaturation pressure and bubble's radii expressed by this equation: ∆P=2σ/r, where ∆P is 100 MPa and σ is the surface tension. If the nucleation starts later when the magma is very supersaturated, the distance between bubbles becomes smaller. Essentially if the magma rises rapidly to the surface, the system will be more out of equilibrium and supersaturated. When the magma rises there is competition between adding new molecules to the existing ones and creating new ones. The distance between molecules characterizes the efficiency of volatiles to aggregate to the new or existing site. Crystals inside magma can determine how bubbles grow and nucleate.