# Optional Practical: Thermodynamics simulation (GeoGebra)

## Introduction In this exercise GeoGebra will be used to construct PV diagrams for gas transformations, starting with the simplest isochoric transformation building up to the most difficult to model, adiabatic.

## Isochoric

An isochoric transformation is one in which volume is constant, the gas simply gets hotter or colder but the volume doesn't change. No work is done in this transformation so the gain in internal energy must equal the heat added to the gas.

### Setting up the axis

To make the calculations simpler to follow we are going to base the simulation on 1.203 x 10-3 moles of ideal gas. This means that the constant nR = 10 kPacm3K-1 . So if the pressure is in kPa and the volume cm3 then the temperature of the gas in Kelvin is given by T = PV/10. This will give you the same graphs as the ones given as examples in my book :-) You can follow the worked examples on page 442 - 443 as you build the simulations

• Open a new file in GeoGebra and zoom out so that the range of the axis is from 0 - 500.
• Use the move graphics tool to shift the origin to the bottom left of the window.
• You can add labels to the axis by right clicking the workspace > graphics > x axis. add the units in the label rather than the unit box (volume/cm3). Otherwise units will appear on all the numbers.

### Defining the pressure and temperature

The next step is to create two points that the transformation will take place between, these will be defined by the intersection between lines, first set the volume.

• Make a slider with name V from 0 to 500, increment 0.1.

This animation shows how to place a slider but the value are different The slider will be used to set the volume, to display this a vertical line will be drawn on the graph.

• In the input bar (at the bottom of the screen) type x=V, this will create a vertical line that moves as you vary V.
• Right click the line and change the properties of the line to make it grey.

The two pressures are defined in the same way:

• Make sliders P1 and P2 with range from 0 to 500 increment 0.1.
• input equations y=P1 and y=P2
• Make the lines grey (you can also make the lines dashed if you like)
• Using the point tool add a point on the intersection of the two pressure lines with the volume line. • Using the line segment tool join the two points with a line.

It is useful to see how the gas moves from one isotherm to another so we are going to add the isotherms at the beginning and end but first we need to calculate the temperature.

• Input T1 =P1*V/10 and T2=P2*V/10. In the algebra pane you will see the two temperature values calculated.
• The isotherms will be input as functions of x input: I1(x)=10*T1/x and I2(x) = 10*T2/x
• The two isotherms should appear passing through the the two points.
• Make the isotherms light in colour.

### Energy changes

SInce the volume is constant no work is done so the heat added simply increases the internal energy of the gas. Due to the fact that nR = 10 kPa cm3 K-1 = 0.01 Pa m3 K-1 the formula for change in internal energy (3/2nRΔT) simplifies to 0.015ΔT.

• Input: ΔU = 0.015*(T2-T1)
• Using the text tool write change in "ΔU =" then select "ΔU" from the objects and finish with the units "J".

This is how you insert text (different text though) You can now vary the pressures and volume and see how the internal energy changes.

### Question

1.203 x 10-3 moles of an ideal monatomic gas undergoes an isochoric expansion from 50 kPa to 200 kPa at a volume of 250 cm3 . Calculate

1. the initial temperature
2. the final temperature
3. the gain in internal energy

## Isobaric

An isobaric transformation is a compression or expansion at constant pressure. In an expansion work is done by the gas and the temperature increases so heat must be added and in a compression work is done on the gas and the temperature decreases so heat must be lost.

• Set the axis as before.
• Create sliders for V1, V2 and P
• Make lines at x=V1, x=V2 and y=P
• Change line properties so they are grey and dashed.
• Add point at the intersections of the P and V lines. (make sure A intersects V1 and B intersects V2)
• Add line segment from A to B.

### Calculating work done

The work done in an isobaric transformation = PΔV, this is the area under the line segment from A to B. Geogebra can find the area under a line by integrating the function but first you need to define the function. This is simply f(x)=P

• input f(x)=P
• Hide the line.
• input integral[f,V1,V2]
• The area under the line segment will now be shaded and the area displayed.

Because of the units the are is not expresses in Joules but can be converted by dividing by 1000.

• input "work=e/1000" where e is the letter denoting the area (this might not be e in your simulation). As before it is useful to see how the gas moves from one isotherm to another so we are going to add the isotherms at the beginning and end but first we need to calculate the temperature.

• Input T1 =P*V1/10 and T2=P*V2/10. In the algebra pane you will see the two temperature values calculated.
• The isotherms will be input as functions of x input: I1(x)=10*T1/x and I2(x) = 10*T2/x
• The two isotherms should appear passing through the the two points.
• Make the isotherms light in colour.

### Energy changes

In an isobaric transformation work is done and internal energy changes, you have already calculated work done so need to find the change in internal energy.

• Input: ΔU = 0.015*(T2-T1)

The first law of thermodynamics states that heat exchanged Q = ΔU + W so we need to calculate that

• Input: Q = ΔU + work
• Add text to display ΔU, W and Q.
Note the transformations always go from A - B so if V2 is less than V1 the process is a compression. Observe the changing signs of ΔU, W and Q for compressions and expansions.

### Question

1.203 x 10-3 moles of an ideal monatomic gas undergoes an isobaric expansion from 100 cm3 to 300 cm3 at a pressure of 250 kPa. Calculate:

1. The original temperature
2. The final temperature
3. The gain in internal energy of the gas
4. The work done by the gas.
5. The heat added to the gas.

## Isothermal

An isothermal transformation is a compression or expansion that takes place at a constant temperature. Since temperature is constant there is no change in internal energy so the work done will equal the amount of heat transferred.

• Set the axis as before.
• Add sliders for V1, V2 and T (T should be from 0 to 10000)
• Add lines x=V1 and x=V2, make the lines grey and dashed.
• Input the function I(x) = 10*T/x, make the line grey.
• Add points A and B to the intersects of the lines.
• Use the integral function to find the area from A to B
• Write an equation to convert the area into Joules.
• Display the work done on the graph.

### Question

1.203 x 10-3 moles of an ideal monatomic gas undergoes an isothermal compression from 300 cm3 to 100 cm3 at a temperature of 1000 K. Calculate:

1. The initial pressure.
2. The final pressure.
3. You can't calculate the work done on the gas without a graph. In an exam you would be given a graph and be expected to count the squares to estimate the area.

An adiabatic transformation is an expansion or compression that takes place without any heat being exchanged in or out of the gas. This means that if the gas does work all the energy transferred must have come from the internal energy.

• Set the axis as before.
• Add sliders for V1 and V2
• Add vertical lines passing through V1 and V2, make them grey and dashed or hide them completely.

During an adiabatic process the pressure and volume are related by the equation PV5/3 = constant. The value of the constant is different for different processes. If we call the constant k then the function giving the line of an adiabatic process is y = k/x5/3

• Add a slider for k from 0 to 1000000.
• Input the function A1(x) = k/x^(5/3)
• Add points A and B at the intersections of the lines.
• Use the integral function to find the area under the adiabatic curve between A and B.

In order to plot the isotherms we first need to calculate the temperatures at the beginning and end. This can be found from PV=nRT so T = PV/10 where P = k/V5/3 (from the adiabatic equation).

• Input T1 = V1*k/ V1^(5/3) / 10
• Input T2 = V2*k/V2^(5/3) / 10
• Input I1(x) = 10*T1/x
• Input I2(x) = 10*T2/x
• Make the isotherms grey and hide the adiabatic curve (the shaded area will still show)
• Add equations to calculate W, ΔU and Q.
• Display the temperatures plus W, ΔU and Q on your graph.