A steam engine is a heat engine that performs mechanical work using steam as its working fluid.
Steam engines are external combustion engines, where the working fluid is separated from the combustion products. Non-combustion heat sources such as solar power, nuclear power or geothermal energy may be used. The ideal thermodynamic cycle used to analyze this process is called the Rankine cycle. In the cycle, water is heated and transforms into steam within a boiler operating at a high pressure. When expanded through pistons or turbines, mechanical work is done. The reduced-pressure steam is then exhausted to the atmosphere, or condensed and pumped back into the boiler.
In general usage, the term steam engine can refer to either the integrated steam plants (including boilers etc.) such as railway steam locomotives and portable engines, or may refer to the piston or turbine machinery alone, as in the beam engine and stationary steam engine. Specialized devices such as steam hammers and steam pile drivers are dependent on the steam pressure supplied from a separate boiler.
The use of boiling water to produce mechanical motion goes back over 2000 years, but early devices were not highly practical. The Spanish inventor Jerónimo de Ayanz y Beaumont obtained a patent for a rudimentary steam-powered water pump in 1606. In 1698 Thomas Savery patented a steam pump that used steam in direct contact with the water being pumped. Savery's steam pump used condensing steam to create a vacuum and draw water into a chamber, and then applied pressurized steam to further pump the water. Thomas Newcomen's atmospheric engine was the first commercial true steam engine using a piston, and was used in 1712 for pumping in a mine.