# Analyze the Stirling Cycle with Real-World Materials

Examine the Stirling cycle for 10 moles of air.

 In:= XmAir = 10 ChemicalData["Air", "MolarMass"]
 Out= Calculate the isothermal expansion and compression curves at 200 °C and 100 °C, respectively.

 In:= XisothermalExpansion = Transpose[{ ThermodynamicData["Air", "SpecificVolume", {"Temperature" -> Quantity[200, "DegreesCelcius"], "Pressure" -> Quantity[Range[100, 200] 1000, "Pascals"]}] mAir, Quantity[Range[100, 200] 1000, "Pascals"]}];
 In:= XisothermalCompression = Transpose[{ ThermodynamicData["Air", "SpecificVolume", {"Temperature" -> Quantity[120, "DegreesCelcius"], "Pressure" -> Quantity[Range[100, 200] 1000, "Pascals"]}] mAir, Quantity[Range[100, 200] 1000, "Pascals"]}];

Create the diagram.

 In:= XListLinePlot[{isothermalExpansion, isothermalCompression}, Axes -> False, PlotRange -> All, FrameLabel -> Automatic, Frame -> True, GridLines -> {{0.2, 0.3}, {}}]
 Out= Calculate mechanical work through .

 In:= XW = Quantity[ NIntegrate[ Evaluate[ Interpolation[QuantityMagnitude[isothermalExpansion]][V]], {V, 0.2, 0.3}] - NIntegrate[ Evaluate[ Interpolation[QuantityMagnitude[isothermalCompression]][V]], {V, 0.2, 0.3}], "Joules"]
 Out= Find maximal and minimal pressures for expansion and compression.

 In:= X{pMax1, pMin1} = Quantity[Interpolation[QuantityMagnitude[isothermalExpansion]][{0.2, 0.3}], "Pascals"]
 Out= In:= X{pMax2, pMin2} = Quantity[ Interpolation[QuantityMagnitude[isothermalCompression]][{0.2, 0.3}], "Pascals"]
 Out= Calculate the change in internal energy.

 In:= XU[T_, p_] := ThermodynamicData["Air", "InternalEnergy", {"Temperature" -> T, "Pressure" -> p}]*mAir; \[CapitalDelta]U = U[ Quantity[200, "DegreesCelcius"], pMax1 ] - U[ Quantity[120, "DegreesCelcius"] , pMin2]
 Out= Out= Using work and the change in internal energy, calculate efficiency.

 In:= XW/\[CapitalDelta]U
 Out= Compare with maximal possible Carnot efficiency.

 In:= X1. - UnitConvert[Quantity[120, "DegreesCelcius"], "Kelvins"]/ UnitConvert[Quantity[200, "DegreesCelcius"], "Kelvins"]
 Out= ## Mathematica

Questions? Comments? Contact a Wolfram expert »