system
Given the following post, respond as if you're commenting on Reddit:
human
What is fire, and why does it form the shape that it does (like in a candle flame, for example)?

I am guessing that it is made out of some sort of matter (photons presumably). But if this is so, what gives the shape it is?
gpt
If you have ever sat around a campfire, or a warm fireplace in your living room,
or even the burners on a gas stove, you will agree that fire seems quite
substantial. You can see it, and you can see the instantaneous effects when
something flammable comes in contact with it. Paper blackens and burns,
plastic melts and also burns. But what is fire? What exactly is the yellow or blue
flame made of? How does it work?

The simple answer is that the fire you see is a chemical reaction. Nothing more, nothing less. How that
chemical reaction manifests itself into a visible flame is quite fascinating
though, so bear with me.

To make this explanation simple, I'll first describe the fire you see on your gas
stove. All flames work in a similar manner, but Methane in particular is easy to
describe.

If we looked at a methane molecule, listed in chemical books as CH4, it would
consist of 1 carbon atom with 4 hydrogen atoms attached to it.

Methane by itself will do nothing. If you filled an air-tight room with methane
and tried to light it, nothing would happen. To make fire, we need
oxygen. Luckily, about 21% of the air we breath is oxygen.

Single oxygen atoms by themselves do not float around in the air we breathe. In fact, few
atoms like to be by themselves, and will normally attach to others in clumps. 

Oxygen atoms are therefore most commonly found attached as a pair.
Therefore, an oxygen molecule is listed as O2, which means two oxygen atoms
bonded together.

If you mixed oxygen and methane in an air-tight room, nothing would happen
either. At room temperature, there is not enough energy for the methane and
oxygen molecules to break their atomic bonds and react. However, all we need
is a small amount of energy in a tightly focused spot, such as a spark, and the
reactions can start.

Okay, now to the fire. Assume we have a methane molecule, and an oxygen
molecule (CH4 + O2), and enough energy (the spark, or previous reactions) for
those molecules to break their bonds. Note that we must put energy IN to the
reaction for the molecules to break apart. There is no heat generated in this
part of the process.

Hydrogen atoms and Oxygen atoms are rather unstable by themselves, and
they will want to bond with something (this is a bit simplified, this gets even
more fascinating in detail). One of the oxygen atoms will attach to the carbon 
atom (CO), two of the hydrogen atoms will join together (H2), and the remaining oxygen and two hydrogen atoms will
join (H2O). When these atoms bond together, they release the stored energy in
them that made them unstable to begin with. This is the heat you feel, and is
able to continue the reaction by providing enough energy for other methane
and oxygen molecules to react. This is why we don't need a continuous spark
for a gas stove, the reaction itself is enough to keep it going as long as the
methane and oxygen continue to be supplied.

This first part of the reaction happened very quickly, almost to the point where
you could say that the original molecules broke apart and re-bonded almost
instantly. That is not the end of the story though. Some of the resulting
molecules haven't shed enough energy yet, and are still unstable. Another
oxygen molecule will be added to the reaction, adding to the CO and the H2
atoms, so we end up with CO2 and H2O. This is called oxidization, and takes
considerably longer than the first part of the reaction... about a millisecond or
so, and produces less energy. If there is not enough oxygen in the mixture, this
second process wont be able to complete, and that is when you will get a sooty
flame.

So to summarize this whole process, you take a methane molecule and two
oxygen molecules, add a bit of energy to get them excited, and you end up
with a carbon-dioxide molecule (CO2) and two water molecules (H2O) and
energy.

CH4 + O2 + O2 --> CO2 + H2O + H2O (In other words, methane and oxygen
become carbon-dioxide and water - pretty clean too).

But where is the heat coming from? If we put in a little bit of energy (the spark)
to start the reaction, where is the energy coming from that is causing the heat
and light?

The simple answer is that it is coming from the methane molecule. Hydrogen
and carbon atoms dont really like to bond together very easily. It takes a
considerable amount of energy to get them to do so. That energy remains
'stored' in the molecule and is released when a reaction with other molecules is
able to take place. This is equivilent to pushing a large boulder up a hill and
then jamming a little rock under it so that it cant roll down. By using a little bit
of energy to unjam the little rock, you release a large amount of 'stored' energy
as the bolder rampages down the hill.

The light you see is just the visible spectrum of the energy released by the
combustion (and refracted through the plasma). The fire moves and waves as
oxygen is consumed in one location and the reaction moves to where more is
available.

The same process happens for other combustibles also, such as wood in a
campfire, wax in a candle and petrol in your car. Same principle, just slightly
different chemical reactions.