Thermodynamics Honors Project: Calculation of Thermodynamic Properties Using Output from a Molecular Dynamics Simulation Due Date: the last day of class Introduction: In this honors project, you are going to take off your engineering hat and put on your science hat. One of the beauties of thermodynamics is that it is extremely important in both engineering (particularly in mechanical and chemical engineering) and science (particularly condensed matter physics and physical chemistry). In many ways, thermodynamics started out as an engineering study of how to best convert heat into usable work/power during the early to mid-nineteenth century – as in the steam engine of the industrial revolution. Some, of course, would argue that it really started earlier than that with the study of relationships between temperature, pressure, and volume (as in Charle’s Law and Boyle’s Law). Even so, during the nineteenth century, people with larger-than-life names like Carnot, Joule and Kelvin set the foundation with their work on the relationship between heat, work and energy. However, concepts like energy, temperature, etc. were still very much abstract ideas and little was understood about them in terms of their origin. Then along came a man named Ludwig Boltzmann who set thermodynamics on an amazing path of genuine scientific discovery detailing how the properties used in thermodynamics can be described by the motion of atoms and molecules in a given system. Boltzmann became the father of what is now called statistical thermodynamics (or statistical mechanics), whereas the pre-Boltzmann thermodynamics (which is what we learn in our class) is called classical thermodynamics. Engineers use the laws of thermodynamics to analyze machines and engines for things like: power output, operational temperature, efficiency, etc. Scientists will generally use thermodynamics to study the properties (internal energy, enthalpy, entropy, etc.) of a given material – often as the material undergoes a phase transition (e.g. solidification, boiling, melting, etc.). A general overview of the project is the following: 1. Run a molecular dynamics (MD) code written in the C language for a variety of different scenarios for the element, Argon. The MD code calculates the dynamics of Argon atoms that can be used to calculate various thermodynamics properties. 2. You will use a program called Tecplot (used in many engineering and scientific fields) to plot results and visualize what your system of atoms looks like as they bounce and vibrate around. 3. You will calculate properties such as temperature, pressure, internal energy, enthalpy, etc. based off of the dynamics of the atoms in your system. This is a fairly involved honors project. However, if you complete this project and work hard in the rest of the course, you will have a very good, basic understanding of many of the essentials of thermodynamics. I also think you will find this to be a fun project to work on as it will illuminate what some of the properties that we use in class actually are. 1 Using Molecular Dynamics (MD) to Simulate a System of Atoms: This project requires you to run a molecular dynamics program. Molecular dynamics (many times called MD) is a simulation technique used to simulate the motion of particles interacting with each other. The particles typically are atoms and/or molecules. The atoms interact with each other through a potential energy field – much like how planets and other large bodies interact through a gravitational potential energy field Gm1m2 (remember PE , where PE is potential energy). Although gravity is still r present in the atomic interactions, it is very small compared to what are known as interatomic potential energies that come from the electron configurations of different atoms overlapping with one another. This interatomic potential can be used to calculate the force on each atom. With the calculated force, a new velocity and position of the atom can be determined through Newton’s 2nd Law. The interatomic potential I am using for this program is called the Lennard-Jones 12-6 potential and is considered quite good for Argon atoms. The Lennard-Jones potential 12-6 is: 12 6 PE 4 r r Where PE is the potential energy, ε is an energy parameter, σ is a length scale parameter, and r is the distance between atoms. The force on an atom i interacting with atom j is given by: Fji PE . I am not going to go any further into details of the MD program as that is not the purpose of the project. If you are interested in it some more, you can talk with me and I can walk you through my program. Running and Compiling the MD program: You are going to have to download the molecular dynamics program that you will use for this project. It is called GarvinMD.c and it is located at: www.engineering.uiowa.edu/~jgarvin/ThermoHonors To compile and run the program, if you are on an engineering Linux machine: 1. Open up a terminal or konsole window 2. Go to the directory where GarvinMD.c is located 3. At command line, type: gcc GarvinMD.c -o MD.exe -lm 4. Run via: ./MD.exe To compile and run on an Engineering Windows machine: 1. Run the Wascana Shell program (search on your machine to find it) 2. Type: cd H: 3. Go to the directory where GarvinMD.c is located 4. At command line, type: gcc GarvinMD.c -o MD.exe -lm 5. Run via: MD.exe 2 When you run the GarvinMD.c program, you will be asked the following questions (different scenarios for you to run will be provided for you): 1. How many atoms will you be simulating? Explanation: The number of atoms (of Argon) that will be in your simulation. 2. Type 0 for an NVE simulation, type 1 for an NVT simulation. Explanation: An NVE simulation is one where there are a constant Number of particles, a constant Volume, and a constant Energy. An NVT simulation means constant Number of particles, constant Volume, and constant Temperature. 3. What is your lattice parameter (in Angstroms)? Explanation: Lattice parameter is the length of the side of a single crystal unit – described below. 4. What initial temperature do you want (in Kelvin)? Explanation: This sets the initial temperature of the system. If the simulation is NVE, the temperature might change significantly as the solution progresses in time. If the simulation is NVT, the temperature will roughly stay the same throughout the simulation (although there will be slight changes). 5. How many time steps and what is the time step size (in pico-seconds)? Explanation: The GarvinMD program solves the dynamics of particles as they move in time. The way the program does this is by breaking up the problem into time intervals and solving each time interval separately. The time interval size is the time step size and the number of intervals is the number of time steps. Once the GarvinMD code is run, an output file called output.dat will be written in Tecplot format with the following information: 1. The X/Y/Z positions (in Angstroms), atom number, atom diameter (in Angstroms), X/Y/Z velocities (in m/s), potential energy (in Joules), and the virial term (in Joules and will be explained later). Each of these variables is written out for each atom. 2. The atom information given above is printed every 500 time steps in the output.dat file. Visualizing the Data using Tecplot: To visualize the data, you will need to open up the output.dat file in a program called Tecplot. The Engineering computers should have Tecplot for both Linux and Windows. The procedure for viewing the results in Tecplot is as follows: 1. Open Tecplot (do a search on the engineering Windows machines or type tecplot on the engineering Linux machines at Terminal window). 2. Once Tecplot is open, go to FileLoad Data Files(s)Tecplot Data LoaderSearch and select output.datset Initial Plot Type to 3D Cartesian 3. You should now have a box that shows up. To see your atoms, click on “Scatter” on the left hand side. 4. Change the shape of your atoms by going to Zone Style on the left hand side. 5. In Zone Style, go to Scatter at the topSymbol ShapeSphere 3 6. While still in Zone StyleScatter, make sure the size of the Spheres (atoms) are appropriate by clicking “Scat SizeSize by VariableScatter Size Variable should be set to atom diameter. In addition, set Grid Units/Magnitude to 1.0. 7. You should now have a system of spheres (these are your Argon atoms). Click the “Play” arrow on the left to play a movie – they will jiggle rapidly. To create an .avi movie of your jiggling atoms, on the top menu, go to AnimateTime…AnimateDestinationTo FileFile FormatAVI Generate Animation FileEnter Width1200Animation Speed (frames/sec)1OK. You will now be asked what you want to call your movie, give it a name and hit OK. Now view your movie by double-clicking on the file you just created. It will be pretty jerky because you are saving out data only every 500 time steps. 8. To view a 2D view of your system, go to View at the top menu and click RotateXY (under Present Views). This will give you a projection on the XY plane. Note, that if you are on the very 1st frame (make sure the Time bar on the left is all the way over to 0) that the atoms look extremely ordered in a very nice fashion. This is because the initial configuration is that of a crystal (an FCC lattice to be precise). 9. To save out a picture, go to FileExportExport FormatPNGEnter Width1200OK. Give it a name to save out as. 10. For the postprocessing calculations of temperature, pressure, etc. you may use either Tecplot or Excel (or other program you feel comfortable with). Doing the calculations in Tecplot is a little tricky so it may be best to just do them in Excel. If you’d like to try them in Tecplot, you can either search online for how to calculate new variables or come see me in my office hours. Your Tasks: You will need to complete the following tasks and put the results in a Powerpoint presentation that you will either show me in person or email me. NOTE: Each simulation will take between 15 and 30 minutes to complete. 1st Task: Run the following scenario (in bold is user input): How many atoms will you be simulating? 864 Type 0 for an NVE simulation, type 1 for an NVT simulation. 0 What is your lattice parameter (in Angstroms)? 5.51 What initial temperature do you want (in Kelvin)? 86 How many time steps and what is the time step size (in pico-seconds)? 30000 0.01 The 1st slide of your powerpoint should have a picture from Tecplot of the very first time step (both the default view and the XY projected view). It should show the initial FCC structure of the Argon Crystal. FCC stands for Face-Centered-Cubic, which is the crystal structure of the Argon atoms in a typical solid state. A crystal implies that the atoms are regularly ordered. FCC has a basic unit (shown below in Figure 1) that has atoms on 4 each of the faces of a unit cell and at each of the corners. Your results will look more like that of Figure 2. Make a movie of this scenario (with the atoms represented as spheres) in both the default view and the XY view and put that movie in the 2nd slide of your powerpoint. To make a movie, please see Tecplot instructions discussed previously. Does it stay a solid throughout the simulation? Why or why not? Discuss this in your Powerpoint. Figure 1: This illustrates the structure of an FCC crystal. You will not have the “connectors” in your Powerpoint figures. Picture taken from http://cstwww.nrl.navy.mil/lattice/struk.picts/a1.s.png. 5 Figure 2: Your results will look something like the following for the first frame. 2nd Task: Fill out the tables below for the following cases: Case 1 2 3 4 Process 12 14 24 Temp (K) Pres (MPa) v (m3/kg) u (kJ/kg) h (kJ/kg) Δs (in kJ/kgK) Case 1: NVT, number of atoms = 864, Lattice parameter = 15.5 , initial temperature = 315K, timesteps = 20000, time step size = 0.01 ps Case 2: NVT, number of atoms = 864, Lattice parameter = 15.5 , initial temperature = 390K, timesteps = 20000, time step size = 0.01 ps Case 3: NVT, number of atoms = 864, Lattice parameter = 5.51 , initial temperature = 84K, timesteps = 20000, time step size = 0.01 ps Case 4: NVT, number of atoms = 864, Lattice parameter = 6.0 , initial temperature = 95K, timesteps = 20000, time step size = 0.01 ps 6 1. Which of the above cases are in a solid state and remain in a solid state throughout the entire simulation? How can you tell it is solid? Hint: Look at the atoms in Tecplot in an XY plane. Do you know what the crystal structure is (don’t worry if you don’t – you will need to have taken Materials Science to know)? 2. Which of the above cases are in an ideal gas state? How can you tell? 3. Which of the above cases are neither a solid nor an ideal gas? Put the results of your tables in your Powerpoint slides. In addition, create the same tables using data obtained in the Stewart and Jacobsen scientific paper found at www.engineering.uiowa.edu/~jgarvin/ThermoHonors. Please use the data in that paper to compare with the results you obtained. NOTE: Case 3 is not available in the paper and Case 4 will not match up as well. Make a movie of scenarios 1, 3, and 4 (with the atoms represented as spheres) in both the default view and the XY view. Put the movies in your Powerpoint presentation. To make a movie, please see Tecplot instructions discussed previously. Finding properties: In order to calculate the properties, you are going to need to know the equations. Below are the equations you will need to find fill out your table. The equation to find Temperature is: T 2 KEave 3kb where T is the temperature of the system, KEave is the average kinetic energy of the atoms in the system, and kb is a constant known as the Boltzmann constant and has a value of 1.38e-23 Joules. Note, that the mass (m) of a single Argon atom is 6.67e-26 kg. This makes the ratio, kb/m, have a value of roughly 206 J/kg. The equation for Pressure is given by the following equation: P N 1 kbT V 3V N F i 1 j i ji (ri rj ) where N is the number of atoms, V is the total volume of the simulation box, and N F i 1 j i ji (ri rj ) is what is called the virial term – the brackets mean time averaged. In the output.dat, you are given a variable called “virial” that is the Fji (ri rj ) for j i each atom (which is the force, Fji , acting on atom i by atom j dotted with the position of atom i minus the position of atom j. What you have to do to get the rest of the virial term 7 is to sum the “virial” variable over all atoms in a given time-step, and then average each sum over all of your outputted time-steps in output.dat. In addition, you can find the volume in a number of different ways, but the easiest way is to use the equation: N 3 V lattice parameter . 4 Specific volume: To find the specific volume, you need the following equation: v V N m i i 1 Where mi is the mass of a single atom i. Specific internal energy: To find the specific internal energy (u), you need the following equation: N u N 1 2 m v v PE i 1 i i i i 1 i N m i 1 i where vi is the velocity of each individual atom and PEi is the potential energy for a given atom (given in the output.dat file). Specific enthalpy: To find the specific enthalpy, you need the following equation: h u pv Change in Specific entropy: Entropy, at its core, is based off of the probability a particular “micro-state” (meaning the ways in which the atoms arrange themselves and at what velocities) will yield a particular “macro-state” – i.e. internal energy, temperature, etc. Ludwig Boltzmann came up with an equation for entropy: S kb ln where is the total number of microstates allowed in a given system. Determining what should be for a given system is usually very difficult. As a result, we will not be calculating the absolute entropy in this project, but instead calculating entropy change via the Tds equations. The Tds equations are (note I am using the “specific” version of the equations): 8 Tds du pdv And Tds dh vdp Or, in discrete form: T s u pv T s h vp Using either one of the Tds equations above, please fill out the table above. Note, you will have to make some approximations regarding T (and possibly p and v) since there will be two Ts to choose from in order to solve the equation. 4th Task: For this task, run an NVT simulation with 864 atoms (run at least 20000 timesteps). Using a lattice parameter of 5.51 , play around with the temperature to see if you can pin-point the melting (or evaporation) temperature. Just by looking at a Tecplot movie, how will you be able to tell if the system has melted or evaporated? When you think you have pin-pointed a temperature your system either evaporates or melts, make a plot of the specific enthalpy (in kJ/kg) versus time (in pico-seconds) curve. From your plot, find the specific enthalpy of fusion (melting) of evaporation, in kJ/kg? Does it match with the actual values of the enthalpy of fusion (evaporation) for Argon? Note, this simulation should technically be done in a constant pressure (instead of constant volume) fashion – nevertheless, it should still give you a reasonable value for the enthalpy of evaporation. 9