# 13 Simulating Microstates and Microstates of a Monatmoic Ideal Gas

# Simulating Microstates and Microstates of a Monatmoic Ideal Gas

This lab is designed to align with AAOT science outcome #1: *Gather, comprehend, and communicate scientific and technical information in order to explore ideas, models, and solutions and generate further questions.*

## Materials

- digital device with spreadsheet program
- digital device with internet access

## ObjectiveS

- Simulate the microstates and resulting macrostates of two containers of ideal gas in thermal contact.
- Use the simulation to identify the most likely macrostate and determine the relative probability of each macrostates when each container holds the same number of atoms.
- Compare the simulated results with the predictions of a two-state model.
- Calculate the temperature and entropy of the most likely state of the two-state system and check for compatibility with the Second Law of Thermodynamics.
- Use the simulation to identify the most likely macrostate and determine the relative probability of each macrostates when each container holds a different number of atoms.
- Calculate the temperature and entropy of the most likely state and check for compatibility with the Second Law of Thermodynamics.

## Simulation Building

We will build a program to simulate the distribution of energy among the atoms in two ideal gasses that are in separate containers but able to exchange thermal energy. For example, the container walls are in contact to allow conduction and/or the container walls are clear to allow exchange of radiation. Though there are more efficient methods, we will build our simulation with a spreadsheet because previous labs have allowed us to become familiar with using spreadsheets. We will use a random number generator to simulate a random physical process, so this type of simulation is known as a *Monte Carlo* simulation (named after the famous casino).

- We will simulate only 10 gas atoms, 5 in each container, with 10 units of thermal energy randomly distributed among them. The distribution of the energy among the particles is the microstate of the system. (Simulating more than a few particles with this method would be very time consuming).
- Randomly distributing the energy ensures that all microstates are equally likely.

- The total amount of energy in each gas serves as the macrostate of the system tracking the macrostate information over time (over many random configurations) allows us to find the probability of the different macrostates.

- The total energy in each gas serves as the macrostate so we can simply divide by the number of atoms in each gas to find the average energy per molecule for each macrostate.
- Using the relation between average kinetic energy and temperature for a temperature for a monoatomic ideal gas we can calculate the gas temperature for each macrostate.
- We can apply the ideal gas law to find the ratio of other state variables for the ideal gas (volume or pressure).

- For the case of an equal number of atoms in each gas the 10 units of energy have an equal chance of randomly ending up in either gas A or gas B, so we can model this system as a simple two-state system just like modeling the total number of heads/tails after flipping 10 quarters.

## Two-State PRedictions

1) Which macrostate had the highest predicted multiplicity (and therefore probability)?

2) Based on your multiplicity calculations, are there more ways (microstates) to distribute thermal energy evenly throughout a system, or are there more microstates that produce higher concentrations of energy in parts of the system? Explain.

3) The probability of different macrostates (total energy in each gas) depends on their multiplicity. Due to your answer above, are the most probable macrostates those with well distributed energy, or poorly distributed energy? Explain.

4) Entropy is a measure of how well the thermal energy is distributed throughout a system (more distributed means higher entropy). Based on your answers above, should the most likely macrostates of a system will have relatively high entropy or low entropy?

5) Does your previous answer agree with the Second Law of Thermodynamics, which says that the entropy of an isolated system should always increase due to spontaneous processes? [Statistically, a system that starts in low probability microstate is likely to end up in a higher probability microstate. Based on our analysis so far, would that mean about the entropy change?] Explain your reasoning.

6) Do your previous answers agree with the entropy calculated directly from the multilplicity as in the simulation spreadsheet? (e.g. is the highest probability macrostate also the one with highest entropy?)

7) We know that two systems allowed to spontaneously exchange heat will trend toward thermal equilibrium. In order for that observation to align with our analysis so far, the macrostate with the highest probability (and highest entropy), has to be one that puts the two gases in thermal equilibrium. Is this the case according to your temperature calculations for each gas? What is the predicted equilibrium temperature of this gas?

Overall, we are interpreting thermal equilibrium and the Second Law of Thermodynamics as simply consequences of basic statistics. In systems with many atoms storing many units of energy, the statistical probability of increasing entropy becomes so large compared to the probability of decreasing entropy that we just don’t observe spontaneous decreases in entropy over everyday timescales. Let’s run our simulator to see if the simulated data support that interpretation, with the understanding that we will only simulate 10 atoms with 10 units of energy and we will only run 200 trials.

## Equal Atoms Simulation

8) Run the simulation for 200 trials.

9) Plot the simulated probability vs. macrostate (number of energy units in gas A). This is known as a probability distribution. Be sure to give your graph a title and axis labels.

10) Add a second series to the same graph. The second series will plot the predicted probability vs. macrostate.

11)Does the probability distribution produced by the simulation agree with the distribution predicted by the two-state model? If not, explain how they differ and explain why do you think they did not agree.

12) What is the macrostate with the highest frequency (state in which the system spent most of it’s time)?

13) What is the macrostate with the highest frequency (state in which the system spent the least of it’s time)?

14) Does the highest frequency macrostate agree with your predictions? Explain.

## UnEqual Atoms Simulation

15) When there is an unequal number of atoms in each gas then there is not an equal probability of each energy unit ending up in either gas. There is a higher probability that it ends up in the gas with more atoms. Therefore, we can’t use the two-state model to predict the probabilities of each macrostate. However, based the connections between probability, entropy, and thermal equilibrium that we made at the beginning of lab, we do expect that expect that the most likely macrostate is the one which places the two gases in thermal equilibrium. Change the atom numbers in your spreadsheet to 3 in gas A and 7 in gas B. Looking at your temperature values for the two gases. Which macrostate (energy in each gas) would place the system in thermal equilibrium and what would the equilibrium temperature be?

16) Run the simulation for another 200 trials with the atom number set to 3 in gas A and 7 in gas B.

17) Does the simulated data agree with your prediction for the most likely macrostate and equilibrium temperature? Explain any differences.

## Conclusions

18) Overall, do the calculations support the prediction that temperature is the quantity which will be equal for the maximum entropy state, as opposed to other quantities such as volume, etc? [Hint: Is the state with equal volumes the one with maximum probability, or the state with equal temperature?] Explain.

19) Does it appear that the simulation is useful for visualizing and predicting the probability distribution for the macrostates and corresponding state variable values of a monatomic ideal gas? Explain.

## Further Questions

20) We only simulated a few units of energy distributed among a few atoms. Even when we aren’t manually tallying the frequency as we did in this case, we find that scaling microscopic simulations to macroscopic systems is computationally prohibitive. For example, if you were to simulate just one liter of gas at room temperature (300 K), and atmospheric pressure, how many atoms would we need to simulate? Show your work.

20) What is the average kinetic energy of each atom in this 1 liter of gas?

21) Using the same energy unit size as in our simulation, how many energy units would each atom have on average?

22) In that case, how many energy units would we need track in order simulate this liter of room temperature gas?