To raise the temperature, internal energy, of the gas in the container,
 The surroundings can decrease the volume. This is positive work by the surroundings.
 Thermal energy can be added, (by the flames.) This is positive thermal work from the surroundings.
The first law of thermodynamics says all energy is conserved. This leads to the mathematical expression of the 1st law of thermodynamics.
The expression on the left, ΔU, is about the gas and the expression on the right, W+Q, is about the surroundings. In detail the 1st law can be expressed as
Note: When using a PV diagram, the work that is calculated is the work of the gas and not the work by the surroundings. So the area under the curve from a PV diagram cannot plug into the 1st law equation directly. It will need to be adjusted.
The change in internal energy can be calculated from
 algebra equation
 PV diagram
 1st law of thermodynamics
Work can be calculated from
 algebra equation
 PV diagram or
 1st law
Thermal energy, Q can be found from
 1st law of thermodynamics
Note: In reality, Q can be found in other ways (e.g. latent heat of fusion, latent heat of vaporization, latent heats, thermal energy changes due to phase changes, etc.) This text is not covering this because it is beyond the scope of the curriculum.
