The working fluid can be used to output useful work if used in a turbine. Also, in thermodynamic cycles energy may be input to the working fluid by means of a compressor. The mathematical formulation for this may be quite simple if we consider a cylinder in which a working fluid resides. A piston is used to input useful work to the fluid. From mechanics, the work done from state 1 to state 2 of the process is given by:
where ds is the incremental distance from one state to the next and F is the force applied. The negative sign is introduced since in this case a decrease in volume is being considered. The situation is shown in the following figure:
The force is given by the product of the pressure in the cylinder and its cross sectional area such that
Where A&sdot;ds = dV is the elemental change of cylinder volume. If from state 1 to 2 the volume increases then the working fluid actually does work on its surroundings and this is commonly denoted by a negative work. If the volume decreases the work is positive. By the definition given with the above integral the work done is represented by the area under a pressure–volume diagram. If we consider the case where we have a constant pressure process then the work is simply given by