158f Thermo-Graphics: a Graphical Presentation of Chemical Engineering Thermodynamics Based on Mathematica, Karl B. Schnelle, Jr., Chemical Engineering Department, Vu Station B 351604, Vanderbilt University, Nashville, Tennessee, 37235-1604

Karl Benjamin Schnelle, Chemical Engineering, Vanderbilt University, VU Station B 351604, Nashville, TN 37235-1604

Chemical Engineering 223 Chemical And Phase Equilibria is presented for junior Chemical Engineering students who have completed the basic mass and energy balance course and an initial thermodynamics course in which the basic concepts of chemical thermodynamics were discussed. The primary goal of Chemical Engineering 223 (ChE 223) is to present the basis and use of chemical and phase equilibrium data and correlations to design chemical and biological processes. Emphasis is on applications to processes associated with chemical conversions and separations involving gasses, liquids, and solids. Also included in the applications is the basic presentation of liquefaction and refrigeration equipment. To stimulate student interest and recognition of the usefulness of thermodynamics, the scenario of these applications are problems related to real world systems.

Now that all of our students have laptop computers, a significant goal of ChE 223 is to ensure that the students will become acquainted with computer methods in the solution of thermodynamic problems applied to real systems. Use of the computer to aid in the solution of homework is encouraged. In order to assure that students will use the computer in a variety of problem solution techniques, problems are assigned which require computer use. Each of these problems is based on a real world situation and requires a different technique for solution. An ideal computing system for doing the kind of calculations prescribed by the special problems and the homework problems is Mathematica.

Mathematica's graphics and programming capabilities make it suitable for developing interactive environments for studying thermodynamics. Hence THERMO-GRAPHICS was selected to describe the action that we were trying to achieve. Using an equation of state like the Redlich-Kwong equation, a Mathematica programmer can develop a package in which a student can graphically study thermodynamic processes that can be represented by equations of state. If properly designed, the program would provide the student with informative prompts that would allow the student to concentrate on learning thermodynamics without having to master Mathematica code.

A Dreyfus Foundation grant was used to assist the development of the THERMO-GRAPHICS package to carry out pressure-volume-temperature two or three-dimensional surfaces. The material is now used for lecture presentations and for solutions of thermodynamic problems. It is a means of better understanding the application of thermodynamic equilibrium to processes like refrigeration cycles and equilibrium flash separations. Results have indicated that the ease of using the computer through Mathematica for calculations and graphical presentation presents thermodynamics in a more appealing light. The work also was extended into graphical representation of phase equilibrium surfaces. The same plan was followed to develop interactive Mathematica programs to illustrate the effects of thermodynamic parameters on phase equilibria.

THERMO-GRAPHICS is a combination of executable FORTRAN calculation programs, visual basic programs, batch files, and Mathematica packages that work together to facilitate the comprehension of thermodynamic problems through graphical presentations and computer generated solutions. The main directory THG contains 4 executable programs, 3 Mathematica packages, and one dynamic link library. The DTIP subdirectory contains 13 executable programs, two batch files, and 5 data files one com file, and one Mathematica package. These DTIP programs are based on the algorithms provided by the Danish Technical University for use only for educational endeavors. The BUBBLE subdirectory contains one executable program and one Mathematica package. A description of each of these files follows:

[THG]

Chemdata.exe; a chemical database program written in Visual Basic that includes the critical properties, heat capacity of gases in the ideal-gas state, and vapor pressures for 86 compounds.

Domerk.exe; a FORTRAN program that performs pure component vapor-liquid equilibrium (at saturation conditions) calculations using the Redlich-Kwong equation of state.

Domesrk.exe; a FORTRAN program that performs pure component vapor-liquid equilibrium (at saturation conditions) calculations using the Soave-Redlich-Kwong equation of state.

Rxnequil.exe; a FORTRAN program that calculates the equilibrium conversion of multiple reactions in terms of the reaction coordinate.

Graphmix.m; a Mathematica package that allows calculation of compressibility factors, fugacity coefficients, and specific volumes of gas mixtures.

Graphnet.m; a Mathematica package consisting of numerous thermodynamic functions that can estimate P-V-T data for five models including the ideal gas, van der Waals, Redlich-Kwong, Soave-Redlich-Kwong, and Benedict-Webb-Rubin models.

Units.m; a Mathematica package that allows conversion of units between the various systems. Conversions are provided for pressure, temperature, volume, mass, density, energy. The universal gas constants are also available.

Vbrun300.dll; a Visual Basic library file that is accessed by chemdata.exe during execution.

[DTIP]

Inpsrken.exe; an interactive FORTRAN program that lets the user create an input file for Srkenvel.exe. The name of the input file is Srkenvel.dat.

Srkenvel.exe; a FORTRAN program that calculates the VLE phase envelope of an up to 5 component mixture. The Soave-Redlich-Kwong equation of state is utilized.

Intsrken.exe; a FORTRAN program that converts the output from Srkenvel.exe into a standard Mathematica input format.

Inpsrkfl.exe; an interactive FORTRAN program that lets the user create an input file for Srkflash.exe. The name of the input file is Srkflash.dat.

Srkflash.exe; a FORTRAN program that calculates the compositions of the two phases after a multicomponent mixture is flashed within the phase envelope. The Soave- Redlich-Kwong equation of state is utilized.

Intsrkfl.exe; a FORTRAN program that converts the output from Srkflash.exe into a standard Mathematica input format.

Inpgcenv.exe, Gcenvel.exe, Intgcenv.exe, Inpgcfls.exe, Gcflash.exe, Intgcfls.exe; Analogous to the SRK programs except that the GC (group contribution) method is used to estimate mixture properties.

Instpath.exe; a FORTRAN program that converts all instances of the working path or directory found in Instruc.m to that specified during the creation of any of the input files.

dtip.bat; the main organizing batch program of all DTIP programs. Dtip.bat allows the user to select which general program to use from a menu and insures that all of the necessary other programs are executed.

Retro.bat; A batch program that allows a user to quickly edit the Srkenvel.dat file, change the quality of the vapor liquid mixture, and then execute the next three required programs. It is useful when attempting to make a plot of retrograde condensation. Note that this batch program is only used when the user has previously created a Srkenvel.dat file using the inpsrken.exe program. Thus, only srkenvel.exe, intsrken.exe, and instpath.exe need to be executed with srkenvel.dat sent into these programs as directed input. Retro.bat accomplishes this task rather than forcing the user to type out the tedious ` command statements.

Alfa.gct, Kij.gct, K1.gct, Pure.gct; Parameter files used in the calculation procedure of Gcenvel.exe and Gcflash.exe.

Srkenvel.dat; a sample Srkenvel.exe input file made available for reference.

Getkey.com; a command program used in Dtip.bat that allows the user to input his/her choice to the menu.

Instruc.m; the Mathematica package that provides the interface for all DTIP programs. Functions are available that allow the graphical creation of phase envelopes as well as the plotting of phase composition.

[BUBBLE]

Bubble.exe; a FORTRAN program that makes bubble point calculations for binary mixtures.

Vle.m; a Mathematica package that provides an interface for VLE output files created by the bubble point program. Features include generating both Equilibrium and Temperature XY diagrams.

One of the more interesting problems solved by THERMO-GRAPHICS is a pressure-temperature envelope of an organic solution that contains hydrogen. When the hydrogen composition gets below about 4 mole percent, retrograde condensation occurs. The DTIP program with the Mathematica graphics is especially notable in this problem. This problem and two others involving a flash separation and a liquid two phase separation equilibrium will be presented and reviewed.