| 1 | \documentclass{article} |
|---|
| 2 | \usepackage{fullpage,lmodern,cxref,url} |
|---|
| 3 | \usepackage[T1]{fontenc} |
|---|
| 4 | \begin{document} |
|---|
| 5 | \title{{\tt Ternary}: Ternary Thermodynamics Visualization} |
|---|
| 6 | \author{Adam C. Powell, IV} |
|---|
| 7 | \date{Version @VERSION@ released @RELEASE_DATE@} |
|---|
| 8 | \maketitle |
|---|
| 9 | |
|---|
| 10 | \begin{abstract} |
|---|
| 11 | {\tt Ternary} is a little code written by Adam Powell back in 2003 to |
|---|
| 12 | visualize ternary free energy functions. In 2008-2009 he updated it to |
|---|
| 13 | calculate phase diagram isotherms. Soon it will do a lot more. |
|---|
| 14 | \end{abstract} |
|---|
| 15 | |
|---|
| 16 | \tableofcontents |
|---|
| 17 | \newpage |
|---|
| 18 | |
|---|
| 19 | \section{Introduction} |
|---|
| 20 | |
|---|
| 21 | In 2003, Adam Powell wrote the core of this little program to visualize the |
|---|
| 22 | free energy function of a polymer-solvent-nonsolvent system as used by one of |
|---|
| 23 | his grad students. In 2008-2009, he expanded it considerably: |
|---|
| 24 | \begin{itemize} |
|---|
| 25 | \item Removed it from the {\tt RheoPlast} package and made it a stand-alone |
|---|
| 26 | program, with considerably expanded documentation. |
|---|
| 27 | \item Craig Carter used a convex hull construct to find and illustrate the |
|---|
| 28 | lowest-energy manifold of a binary free energy function or set of |
|---|
| 29 | functions.\footnote{Though others have noted the relationship between the |
|---|
| 30 | convex hull and the minimum enengy surface before ({\em e.g.} |
|---|
| 31 | \cite{Var1990,Aic2001,Aic2003,Zho2004}), Carter's Mathematica scripts are |
|---|
| 32 | the inspiration for this work.} Based on that concept, ternary uses {\tt |
|---|
| 33 | qhull} \cite{BDH1997} to calculate that hull, and visualizes the edges of the resulting |
|---|
| 34 | triangles---which will clearly show the one- and two-phase regions, complete |
|---|
| 35 | with two-phase tie lines. |
|---|
| 36 | \item Added visualization and convex hull calculation for multiple phases with |
|---|
| 37 | separate free energy functions, {\em e.g.} solid and liquid. |
|---|
| 38 | \item Made binodal calculation much more accurate by a Newton refining |
|---|
| 39 | procedure at the edges. |
|---|
| 40 | \item Added spinodal region boundary calculation. |
|---|
| 41 | \item Added a graphical interface for setting the free energy parameters. |
|---|
| 42 | \end{itemize} |
|---|
| 43 | |
|---|
| 44 | {\tt Ternary} is nearly complete, with the one un-implemented feature being to |
|---|
| 45 | build and neatly visualize how free energy functions create a full |
|---|
| 46 | temperature-composition ternary phase diagram. |
|---|
| 47 | |
|---|
| 48 | \section{Compiling {\tt Ternary}} |
|---|
| 49 | |
|---|
| 50 | To compile {\tt Ternary}, you need the qhull library and geomview program, as |
|---|
| 51 | well as a C compiler. On Debian and Ubuntu, installing the {\tt |
|---|
| 52 | build-essential}, {\tt liblapack-dev}, {\tt libqhull-dev} and {\tt geomview} |
|---|
| 53 | packages satisfy this. If you want to build the documentation as well, you |
|---|
| 54 | will also need {\tt cxref} along with \LaTeX (in the {\tt texlive-latex-base} |
|---|
| 55 | package) for the PDF, and either {\tt hevea} or {\tt latex2html} for HTML |
|---|
| 56 | documentation. |
|---|
| 57 | |
|---|
| 58 | Next, unpack the {\tt .tar.gz} source archive by typing (at the command line): |
|---|
| 59 | \begin{quote} |
|---|
| 60 | \tt tar xzf Ternary-[version].tar.gz |
|---|
| 61 | \end{quote} |
|---|
| 62 | Configure and compile it using: |
|---|
| 63 | \begin{quote} |
|---|
| 64 | \tt ./configure\\ |
|---|
| 65 | make |
|---|
| 66 | \end{quote} |
|---|
| 67 | Then you can run the {\tt ternary} and {\tt square} binary executables. Modify |
|---|
| 68 | them by changing the parameters at the top of {\tt ternary.c} and {\tt |
|---|
| 69 | square.c} and re-compiling it using {\tt make} again. |
|---|
| 70 | |
|---|
| 71 | \section{How it works} |
|---|
| 72 | |
|---|
| 73 | The files {\tt ternary.c} and {\tt square.c} (documentation in appendices |
|---|
| 74 | \ref{file_ternary.c} and \ref{file_square.c}) contain sample front-ends to the |
|---|
| 75 | free energy and phase diagram libraries. They do the following: |
|---|
| 76 | \begin{itemize} |
|---|
| 77 | \item Call functions in {\tt book.c} (appendix \ref{file_book.c}) to create a |
|---|
| 78 | triangular or square array of points and set of triangles connecting them. |
|---|
| 79 | \item Calculate the free energy function on the triangle vertices using |
|---|
| 80 | {\tt free\_energies()} in {\tt freenergy.c} (appendix |
|---|
| 81 | \ref{file_freenergy.c}). Note that {\tt freenergy.c} is the sole source file |
|---|
| 82 | for {\tt libfreenergy}; {\tt book.c} and the others below comprise {\tt |
|---|
| 83 | libgibbs}. |
|---|
| 84 | \item Display the free energy using the functions in {\tt geomview.c} |
|---|
| 85 | (appendix \ref{file_geomview.c}), which forks and controls a Geomview |
|---|
| 86 | process. |
|---|
| 87 | \item Calculate the spinodal of this free energy function using {\tt |
|---|
| 88 | calc\_spinodal} in {\tt spinodal.c} (appendix \ref{file_spinodal.c}), and |
|---|
| 89 | displays it on the free energy function. |
|---|
| 90 | \item Use Qhull calls in {\tt qhull.c} (appendix \ref{file_qhull.c}) to |
|---|
| 91 | calculate the convex hull of the free energy function. |
|---|
| 92 | \item Refine the multi-phase triangles using Newton iteration ({\tt |
|---|
| 93 | hullRefine} in {\tt qhull.c}) to find the lowest-energy point starting at |
|---|
| 94 | each corner, smoothing the phase boundaries considerably. |
|---|
| 95 | \item Add the two-phase region facet outlines to the Geomview display. |
|---|
| 96 | \end{itemize} |
|---|
| 97 | |
|---|
| 98 | For more than one free energy function (as implemented in {\tt ternary} and |
|---|
| 99 | {\tt square}), it creates a double-size (or more) array with multiple sets of |
|---|
| 100 | points, and multiple sets of triangle indices connecting them. The rest of |
|---|
| 101 | this procedure is pretty much the same. |
|---|
| 102 | |
|---|
| 103 | The {\tt Ternary} GUI does all of these things as well each time the user |
|---|
| 104 | changes the free energy function parameters or otherwise updates the display. |
|---|
| 105 | |
|---|
| 106 | \section{Bugs} |
|---|
| 107 | |
|---|
| 108 | There are several bugs in the Ternary algorithms, an incomplete implementation, |
|---|
| 109 | and a problem in the GUI, as follows: |
|---|
| 110 | |
|---|
| 111 | \begin{itemize} |
|---|
| 112 | \item Finding some phases depends on the initial discretization of the space. |
|---|
| 113 | For example, if there is a small miscibitily gap which none of the initial |
|---|
| 114 | points happens to be in, it will not show up in the phase diagram isotherm. |
|---|
| 115 | |
|---|
| 116 | \item The refining algorithm does not work well near a critical point. |
|---|
| 117 | |
|---|
| 118 | \item The edge-values test often produces two critical points and a three-phase |
|---|
| 119 | region where there should be just one critical point. |
|---|
| 120 | |
|---|
| 121 | \item Version 0.5.0 is releasing with an incomplete implementation of {\tt |
|---|
| 122 | hullRefine} which is fine for interior points, but does not attempt to |
|---|
| 123 | refine points on the edges, i.e. pseudobinaries. |
|---|
| 124 | |
|---|
| 125 | \item The function {\tt hullReturnPhaseBoundaries} returns more phases than |
|---|
| 126 | appropriate in some cases, with some of them empty. |
|---|
| 127 | |
|---|
| 128 | \item The {\tt Ternary} GUI is incomplete: it is missing the polynomial and |
|---|
| 129 | Gaussian free energy terms, and cannot add or remove phases. |
|---|
| 130 | \end{itemize} |
|---|
| 131 | |
|---|
| 132 | \section{Future Goals} |
|---|
| 133 | |
|---|
| 134 | The 1.0 release should have the following features: |
|---|
| 135 | \begin{itemize} |
|---|
| 136 | \item Fixes for as many of the above bugs as possible. |
|---|
| 137 | \item An XML format for the free energy parameters, and ability to load and |
|---|
| 138 | save in this format in {\tt libfreenergy}. |
|---|
| 139 | \item Some ability to import and export ThermoCalc\textregistered database |
|---|
| 140 | files. |
|---|
| 141 | \item Ability to click the isotherm view lower convex hull triangles to return |
|---|
| 142 | the triangle number and its corners. |
|---|
| 143 | \item Function for determining the phases and their fractions for a given |
|---|
| 144 | composition in the lower convex hull isotherm. |
|---|
| 145 | \item Assembly of the ternary full phase diagram isotherm traces in a separate |
|---|
| 146 | view. |
|---|
| 147 | \item Stitch together ternary isotherm traces to create smooth faces. |
|---|
| 148 | \item Change {\tt libfreenergy} and {\tt libgibbs} from $C2,C3$ composition |
|---|
| 149 | representation to an array, creating a multi-component API which will |
|---|
| 150 | support such calculations when the back-end is ready. |
|---|
| 151 | \end{itemize} |
|---|
| 152 | |
|---|
| 153 | Other wishlist items include: |
|---|
| 154 | \begin{itemize} |
|---|
| 155 | \item ``Line compounds'' which consist of a single point, this is already |
|---|
| 156 | possible to do manually but is not in the GUI or either front end. |
|---|
| 157 | \item Phases which do not cover the whole ternary space, also possible to do |
|---|
| 158 | manually but it would be nice to have some support in {\tt book.c}. |
|---|
| 159 | \end{itemize} |
|---|
| 160 | |
|---|
| 161 | \section{Copyright} |
|---|
| 162 | |
|---|
| 163 | {\tt Ternary} Thermodynamics Visualization |
|---|
| 164 | |
|---|
| 165 | \noindent Copyright \copyright 2003, 2006, 2008, 2009 Adam C. Powell, IV |
|---|
| 166 | |
|---|
| 167 | This code is free software; you can redistribute it and/or modify it under |
|---|
| 168 | the terms of the GNU General Public License as published by the Free Software |
|---|
| 169 | Foundation; either version 3 of the License, or (at your option) any later |
|---|
| 170 | version. |
|---|
| 171 | |
|---|
| 172 | This code is distributed in the hope that it will be useful, but WITHOUT ANY |
|---|
| 173 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|---|
| 174 | PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|---|
| 175 | |
|---|
| 176 | You should have received a copy of the GNU General Public License along with |
|---|
| 177 | this code; if not, write to the Free Software Foundation, Inc., 51 Franklin |
|---|
| 178 | Street, Fifth Floor Boston, MA 02110-1301 USA |
|---|
| 179 | |
|---|
| 180 | You may contact the author by email at {\tt apowell@opennovation.com}. |
|---|
| 181 | |
|---|
| 182 | \section{Version History} |
|---|
| 183 | |
|---|
| 184 | This is a condensed summary of new user-visible features in {\tt Ternary}. A |
|---|
| 185 | more detailed description of new features in each release is in the {\tt |
|---|
| 186 | ChangeLog} file. |
|---|
| 187 | |
|---|
| 188 | \subsection{{\tt Ternary} 0.1.0} |
|---|
| 189 | |
|---|
| 190 | First standalone release of ternary (extracted from {\tt RheoPlast}), which |
|---|
| 191 | plots a ternary free energy function. New to this release is the use of the |
|---|
| 192 | Geomview {\tt COFF} format, which creates a much smoother pseudocolor plot. |
|---|
| 193 | |
|---|
| 194 | \subsection{{\tt Ternary} 0.2.0} |
|---|
| 195 | |
|---|
| 196 | This release links with the {\tt qhull} library to calculate the convex hull of |
|---|
| 197 | the energy function, and displays 2- and 3-phase regions in addition to the |
|---|
| 198 | free energy function. |
|---|
| 199 | |
|---|
| 200 | \subsection{{\tt Ternary} 0.3.0} |
|---|
| 201 | |
|---|
| 202 | This version introduced multiple free energy functions which intersect to |
|---|
| 203 | produce complex multi-phase regions on the convex hull. Internally, much of |
|---|
| 204 | the code in {\tt main()} moved out to a new file {\tt book.c}, which will make |
|---|
| 205 | it a lot easier to wrap these functions using SIDL or SWIG. |
|---|
| 206 | |
|---|
| 207 | \subsection{{\tt Ternary} 0.4.0} |
|---|
| 208 | |
|---|
| 209 | The new Newton refining code in {\tt qhull.c}, which uses new free energy |
|---|
| 210 | derivative functions in {\tt freenergy.c}, gives {\tt Ternary} the ability to |
|---|
| 211 | accurately predict binodal boundaries. Another new function in {\tt |
|---|
| 212 | spinodal.c} calculates the shape of the spinodal curve. |
|---|
| 213 | |
|---|
| 214 | All functions can now accommodate ``rectangle'' ternary spaces, though it's not |
|---|
| 215 | clear what a spinodal means in this context. The {\tt square} front-end |
|---|
| 216 | demonstrates this functionality. |
|---|
| 217 | |
|---|
| 218 | Finally, a major reorganization splits the bulk of the code into two libraries, |
|---|
| 219 | with front-end codes {\tt ternary} and {\tt square} calling into them. The |
|---|
| 220 | library {\tt libfreenergy} calculates free energies and derivatives, and can be |
|---|
| 221 | re-used in phase field codes. The library {\tt libgibbs} calculates phase |
|---|
| 222 | diagrams. The APIs are relatively immature and bound to change. |
|---|
| 223 | |
|---|
| 224 | \subsection{{\tt Ternary} 0.5.0} |
|---|
| 225 | |
|---|
| 226 | The {\tt Ternary} GUI has landed, but is not yet complete. |
|---|
| 227 | |
|---|
| 228 | This version fixed major bugs in, and improved the accuracy of, the spinodal |
|---|
| 229 | calculation. |
|---|
| 230 | |
|---|
| 231 | There are also new arbitrary polynomial terms in the free energy functions. |
|---|
| 232 | And there is a new {\tt adjust\_gaussians} function to aid in the use of |
|---|
| 233 | Gaussians for a single-function free energy surface with known free energies of |
|---|
| 234 | certain phases. |
|---|
| 235 | |
|---|
| 236 | \bibliographystyle{unsrturl} |
|---|
| 237 | \bibliography{ternary} |
|---|
| 238 | \newpage |
|---|
| 239 | |
|---|
| 240 | \appendix |
|---|
| 241 | |
|---|
| 242 | % Begin-Of-Source-Files |
|---|
| 243 | |
|---|
| 244 | % End-Of-Source-Files |
|---|
| 245 | \end{document} |
|---|