#LyX 2.1 created this file. For more info see http://www.lyx.org/ \lyxformat 474 \begin_document \begin_header \textclass book \use_default_options false \maintain_unincluded_children false \language english \language_package default \inputencoding auto \fontencoding global \font_roman default \font_sans default \font_typewriter default \font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default \output_sync 0 \bibtex_command default \index_command default \paperfontsize default \spacing single \use_hyperref false \papersize a4paper \use_geometry false \use_package amsmath 2 \use_package amssymb 2 \use_package cancel 1 \use_package esint 0 \use_package mathdots 0 \use_package mathtools 1 \use_package mhchem 0 \use_package stackrel 1 \use_package stmaryrd 1 \use_package undertilde 1 \cite_engine basic \cite_engine_type default \biblio_style plain \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \justification true \use_refstyle 0 \index Index \shortcut idx \color #008000 \end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \paragraph_indentation default \quotes_language english \papercolumns 1 \papersides 2 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false \end_header \begin_body \begin_layout Chapter Multi-phase equilibrium \begin_inset Index idx status collapsed \begin_layout Plain Layout equilibrium \end_layout \end_inset libraries \begin_inset CommandInset label LatexCommand label name "cha:physprops" \end_inset \end_layout \begin_layout Standard This chapter describes the models we provide to compute thermodynamic properties \begin_inset Index idx status collapsed \begin_layout Plain Layout thermodynamic properties \end_layout \end_inset for multi-phase \begin_inset Index idx status collapsed \begin_layout Plain Layout multi-phase \end_layout \end_inset , multi-component \begin_inset Index idx status collapsed \begin_layout Plain Layout multi-component \end_layout \end_inset vapor/liquid mixtures \begin_inset Index idx status collapsed \begin_layout Plain Layout vapor/liquid mixtures \end_layout \end_inset where we assume equilibrium exists among co-existing phases. \end_layout \begin_layout Section A description of the libraries \end_layout \begin_layout Standard In this section we describe the three libraries, \family typewriter phases.a4l \family default , \family typewriter components.a4l \family default and \family typewriter thermodynamics.a4l \family default . These libraries contain many models, but the end user is only interested in a few of them. Our intention is that these few should be very simple to use, with the complexities buried inside the models. \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout first the phase definitions \end_layout \end_inset The first contains the models we use to define the phases we allow for a mixture (i.e., vapor, liquid, vapor/liquid, liquid/liquid and vapor/liquid/liquid ) \begin_inset CommandInset ref LatexCommand ref reference "id:#id(pgfId-1010487)" \end_inset \begin_inset Foot status collapsed \begin_layout Plain Layout It should be noted that, while the models will correctly set up the data structures for the liquid/liquid and vapor/liquid/liquid options, we do not really support these alternatives at this time. \end_layout \end_inset \noun off . \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout then the components and their data \end_layout \end_inset The second library contains the models having all the component physical properties for the components we include with ASCEND -- e.g., there are property values for heat capacity \begin_inset Index idx status collapsed \begin_layout Plain Layout heat capacity \end_layout \end_inset , heat of vaporization \begin_inset Index idx status collapsed \begin_layout Plain Layout heat of vaporization \end_layout \end_inset , accentric factor \begin_inset Index idx status collapsed \begin_layout Plain Layout accentric factor \end_layout \end_inset and so forth for water, methanol, carbon dioxide, etc. There is also the very extensive list of group contribution \begin_inset Index idx status collapsed \begin_layout Plain Layout group contribution \end_layout \end_inset data we need to use the UNIFAC \begin_inset Index idx status collapsed \begin_layout Plain Layout UNIFAC \end_layout \end_inset method. \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout and finally the mixture thermodynamic models \end_layout \end_inset The third provides the models we use to compute multi-component mixture thermodynamic properties for phases, such as ideal gas \begin_inset Index idx status collapsed \begin_layout Plain Layout ideal gas \end_layout \end_inset , Pitzer \begin_inset Index idx status collapsed \begin_layout Plain Layout Pitzer \end_layout \end_inset , UNIFAC, and Wilson \begin_inset Index idx status collapsed \begin_layout Plain Layout Wilson \end_layout \end_inset . The final model in this library is the one to compute equilibrium conditions for multi-component, multi-phase systems. We provide both a constant relative volatility \begin_inset Index idx status collapsed \begin_layout Plain Layout relative volatility \end_layout \end_inset and a rigorous phase equilibrium model, with the ability to switch interactivel y between which one to use. Thus one can first assume constant relative volatility to have a better chance to converge and then switch to the version that makes the chemical potential \begin_inset Index idx status collapsed \begin_layout Plain Layout chemical potential \end_layout \end_inset equal for a component in all phases. \end_layout \begin_layout Subsection The \family typewriter phases.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout phases.a4l \end_layout \end_inset library \end_layout \begin_layout Standard \begin_inset Marginal status open \begin_layout Plain Layout need to create only instances of phases_data \end_layout \end_inset The \family typewriter Phases.a4l \family default library, see Figure \begin_inset CommandInset ref LatexCommand ref reference "fig:physprops.phases.a4l" \end_inset \noun off , has only one model in it, phases_data \noun default \begin_inset Index idx status collapsed \begin_layout Plain Layout phases \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset data \end_layout \end_inset \begin_inset Foot status collapsed \begin_layout Plain Layout In this and following figures, we represent each model as a rectangle. On the upper left is the name of the model. In \begin_inset CommandInset ref LatexCommand ref reference "fig:physprops.phases.a4l" \end_inset \noun on Figure 1-1 \noun off , the model is phases_data. On the left side we list in order the parameters for the model. These are shared objects \begin_inset Index idx status collapsed \begin_layout Plain Layout shared objects \end_layout \end_inset a model containing an instance of phases_data will pass to that instance. An example would bepd IS_A phases_data(V, 'Pitzer_vapor_mixture', 'none', 'none')We list the parts defined locally within a model on the right side of the rectangle, including instances of models, atoms and sets. The slanted double-headed arrow indicates a set; thus, phases and other_phases are sets in phases_data.In \begin_inset CommandInset ref LatexCommand ref reference "fig:physprops.thermoLib" \end_inset \noun on Figure 1-3 \noun off we show lines connecting a model, call it A, to a part within another model, call it B.part. The connection is to the sides of both. This type of connection says B.part is an instance of model A. We also show connections from the bottom of one model, call it C, to the top of another, call it D; with this connection we indicate that the lower model D is a refinement \begin_inset Index idx status collapsed \begin_layout Plain Layout refinement \end_layout \end_inset of the upper model C. \end_layout \end_inset \noun off . The user creates an instance of this model, specifying which phases are to exist for a stream or holdup and which thermodynamic model the system should use to compute mixture properties for each phase. Compiling this instance then sets up the data structures required to characteri ze those phases for the system. \end_layout \begin_layout Standard For example, suppose we want to model a flowsheet consisting of a single flash unit. Suppose further that we want to allow the feed to the flash unit to be vapor, liquid or vapor/liquid (i.e., 2 phase). The product streams from the flash unit will be a vapor phase mixture and a liquid phase mixture. We would define three instances of the phases_data model, one for each type of phase condition we wish to model. You can find the following statements in the model \family typewriter testflashmodel \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout testflashmodel \end_layout \end_inset in the library \family typewriter flash.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout flash.a4l \end_layout \end_inset . \end_layout \begin_layout LyX-Code pdV IS_A phases_data('V', 'ideal_vapor_mixture', \end_layout \begin_layout LyX-Code 'none', 'none'); \end_layout \begin_layout LyX-Code pdL IS_A phases_data('L', 'none', \end_layout \begin_layout LyX-Code 'UNIFAC_liquid_mixture', 'none'); \end_layout \begin_layout LyX-Code pdVL IS_A phases_data('VL', 'ideal_vapor_mixture', \end_layout \begin_layout LyX-Code 'UNIFAC_liquid_mixture','none'); \end_layout \begin_layout Standard When compiled, \family typewriter pdV \family default , \family typewriter pdL \family default and \family typewriter pdVL \family default contain the data structures the thermodynamic models require to model a vapor, liquid and vapor/liquid stream \begin_inset Index idx status collapsed \begin_layout Plain Layout stream \end_layout \end_inset (or holdup \begin_inset Index idx status collapsed \begin_layout Plain Layout holdup \end_layout \end_inset ). \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout the phase indicators and types \end_layout \end_inset The first parameter is a character that indicates the phase option desired - \family typewriter 'M' \family default , \family typewriter 'V' \family default , \family typewriter 'L' \family default , \family typewriter 'VL' \family default , \family typewriter 'LL' \family default and \family typewriter 'VLL' \family default . \family typewriter 'M' \family default is for a material only stream (no thermodynamic properties are to be computed), \family typewriter 'V' \family default is for vapor and \family typewriter 'L' \family default for liquid. This model always expects the user to supply in the last three parameters an ordered list giving the three single phase mixture models to be used: vapor, liquid1, liquid2. For a non-existent phase \begin_inset Index idx status collapsed \begin_layout Plain Layout non-existent phase \end_layout \end_inset , the user should supply 'none' as the model. If there is only one liquid phase, liquid2 will not exist. The allowed models we can use to estimate multi-component phase mixture properties are in the third of the libraries we describe in this chapter, \family typewriter thermodynamics.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout thermodynamics.a4l \end_layout \end_inset , which we discuss shortly in Section \begin_inset CommandInset ref LatexCommand ref reference "ssec:physprops.thermoLib" \end_inset \noun off . \end_layout \begin_layout Standard \begin_inset Float figure wide false sideways false status open \begin_layout Plain Layout \noun off \begin_inset Graphics filename howto-physpropsFig1.eps width 90col% \end_inset \end_layout \begin_layout Plain Layout \begin_inset Caption Standard \begin_layout Plain Layout Phases.a4l \begin_inset Index idx status collapsed \begin_layout Plain Layout Phases.a4l \end_layout \end_inset models \begin_inset CommandInset label LatexCommand label name "fig:physprops.phases.a4l" \end_inset \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Subsection The \family typewriter components.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout components.a4l \end_layout \end_inset library \end_layout \begin_layout Standard In this library (see Figure \begin_inset CommandInset ref LatexCommand ref reference "fig:physprops.components.a4l" \end_inset \noun off ) we provide the actual physical property data for the components supplied with ASCEND. The data we provide is that found in the tables at the back of Reid \begin_inset Index idx status collapsed \begin_layout Plain Layout Reid \end_layout \end_inset , Prausnitz \begin_inset Index idx status collapsed \begin_layout Plain Layout Prausnitz \end_layout \end_inset and Poling \begin_inset Index idx status collapsed \begin_layout Plain Layout Poling \end_layout \end_inset , The Properties of Vapors \noun default & \noun off Liquids, 4th Ed, McGraw-Hill \begin_inset Index idx status collapsed \begin_layout Plain Layout McGraw-Hill \end_layout \end_inset , New York (1986). For a few of the components, we have also identified their UNIFAC groups \begin_inset Index idx status collapsed \begin_layout Plain Layout UNIFAC groups \end_layout \end_inset . We include a few Wilson binary mixture parameters \begin_inset Index idx status collapsed \begin_layout Plain Layout Wilson binary mixture parameters \end_layout \end_inset . \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout need to create only instances of components_data \end_layout \end_inset The purpose of this library is similar to the \family typewriter phases.a4l \family default library. We wish to provide an easy-to-use model that will set up the data structures for the components in a mixture that the thermodynamic models will use when estimating mixture physical properties. All the user has to do is create an instance of the bottom-most model \family typewriter components_data \family default , passing into it a list of the components in the mixture and the name of one of them which is to serve as the reference component. This model, having parts which are instances of the others present in this library, then compiles into the needed data structures. \end_layout \begin_layout Standard An example of use is found in the model \family typewriter testflashmodel \family default in the library \family typewriter flash.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout flash.a4l \end_layout \end_inset : \end_layout \begin_layout LyX-Code cd IS_A components_data(['n_pentane','n_hexane', \end_layout \begin_layout LyX-Code 'n_heptane'],'n_heptane'); \end_layout \begin_layout Standard When compiled \family typewriter cd \family default has in it a data structure containing the physical properties for the three species listed. \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout reference component \end_layout \end_inset The choice of which species to use as the reference component \begin_inset Index idx status collapsed \begin_layout Plain Layout reference component \end_layout \end_inset is up to the user. Usually a good choice is one that is plentiful in the mixture, but that need not be so. \end_layout \begin_layout Standard \begin_inset Float figure wide false sideways false status open \begin_layout Plain Layout \begin_inset Graphics filename howto-physpropsFig2.eps width 100col% \end_inset \end_layout \begin_layout Plain Layout \begin_inset Caption Standard \begin_layout Plain Layout components.a4l \begin_inset Index idx status collapsed \begin_layout Plain Layout components.a4l \end_layout \end_inset models \begin_inset CommandInset label LatexCommand label name "fig:physprops.components.a4l" \end_inset \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout adding a new component \end_layout \end_inset One can add more components to this library as follows: \end_layout \begin_layout Enumerate add the name of the new component to the list of supported_components at the beginning of the model \family typewriter td_thermodynamic_constants \family default (part of the \family typewriter WHERE \family default statement that causes the system to output a diagnostic if someone subsequently misspells the name of a component) \end_layout \begin_layout Enumerate add the component data as a \family typewriter CASE \family default to the \family typewriter SELECT \family default statement in \family typewriter \begin_inset Newline newline \end_inset td_thermodynamic_constants \family default (for an example, look at how it is done for 'methanol') \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout adding UNIFAC group identifiers \end_layout \end_inset Put the UNIFAC group identifiers \begin_inset Index idx status collapsed \begin_layout Plain Layout UNIFAC group identifiers \end_layout \end_inset for the new component into the set subgroups. To illustrate, this statement for methanol is: \end_layout \begin_layout LyX-Code subgroups:== ['CH3', 'OH']; \end_layout \begin_layout Standard You can find all the UNIFAC group identifiers possible in the model \family typewriter UNIFAC_constants \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout UNIFAC \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset constants \end_layout \end_inset . Then fill in the vector \family typewriter nu \family default with a value for each of these groups (to indicate how many such groups are in the molecule). To illustrate, the values for methanol are: \end_layout \begin_layout LyX-Code nu['CH3']:==1; \end_layout \begin_layout LyX-Code nu['OH']:==1; \end_layout \begin_layout Standard If you are entering the component without identifying its UNIFAC groups, then enter the subgroups statement and define it as empty -- i.e., write \end_layout \begin_layout LyX-Code subgroups:== [ ]; \end_layout \begin_layout Standard There should then be no entry for nu (see the \family typewriter CASE \family default for hydrogen, for example). An activity coefficient estimated by the UNIFAC method will be unity for such a component. \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout adding Wilson parameters \end_layout \end_inset To add Wilson parameters \begin_inset Index idx status collapsed \begin_layout Plain Layout Wilson parameters \end_layout \end_inset , first fill in the names of the other components for which you are adding data into the set \family typewriter wilson_set \family default . For example, this set for methanol might be: \end_layout \begin_layout LyX-Code wilson_set:== ['H2O','(CH3)2CO','CH3OH']; \end_layout \begin_layout Standard Then fill in lambda and energy parameters into the arrays \family typewriter lambda \family default and \family typewriter del_ip \family default , one for each of the other components. Again, to illustrate, these arrays for methanol would be: \end_layout \begin_layout LyX-Code lambda['H2O']:==0.43045; \end_layout \begin_layout LyX-Code lambda['(CH3)2CO']:==0.77204; \end_layout \begin_layout LyX-Code lambda['CH3OH']:==1.0; \end_layout \begin_layout LyX-Code del_ip['(CH3)2CO']:==2.6493E+002 {J/g_mole}; \end_layout \begin_layout LyX-Code del_ip['H2O']:==1.1944E+002 {J/g_mole}; \end_layout \begin_layout LyX-Code del_ip['CH3OH']:==0.0 {J/g_mole}; \end_layout \begin_layout Standard Finally for each of these other components, go to its \family typewriter CASE \family default statement, add the name of the new component to its wilson_set and then add statements to set the corresponding lambda and energy data. BEN, IS THIS RIGHT????If you are not adding any Wilson data, enter the statement: \end_layout \begin_layout LyX-Code wilson_set:== [ ]; \end_layout \begin_layout Subsection The \family typewriter thermodynamics.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout thermodynamics.a4l \end_layout \end_inset library \begin_inset CommandInset label LatexCommand label name "ssec:physprops.thermoLib" \end_inset \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout create instances only of phase_partials and thermodynamics \end_layout \end_inset Figure \begin_inset CommandInset ref LatexCommand ref reference "fig:physprops.thermoLib" \end_inset \noun off shows all the models in this library and how they are related to each other. There are two models in this library that the user has to worry about: \family typewriter \noun default phase_partials \family default \noun off \begin_inset Index idx status collapsed \begin_layout Plain Layout phase \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset partials \end_layout \end_inset and \family typewriter \noun default thermodynamics \family default \noun off . The user creates one instance of thermodynamics for every stream or holdup in a process model. Each instance, when compiled has parts which are instances of the other models in this library and which are create the equations to compute the thermodynamic properties for a multi-component, multi-phase mixture. \end_layout \begin_layout Standard However, the user must pass each instance of a thermodynamics model an array of instances of \family typewriter phase_partials \family default , one for each phase in the mixture. One \family typewriter phase_partials \family default model must exist for each phase in each stream or holdup in the process model as it provides the equations modeling that phase. \end_layout \begin_layout Standard \begin_inset Note Note status collapsed \begin_layout Plain Layout Need to explain UNIFAC, Pitzer etc, since these terms are not familiar to the Mechanical Engineer, and no details are provided as to which is appropriate for which types of problems. \end_layout \begin_layout Plain Layout Also, it would be useful to know how to model a homogenous two-phase stream of gas/liquid mixture of a single component. \end_layout \begin_layout Plain Layout Also, the documentation needs a 'hello world' example of how to use the properties correlation, eg how to compute the enthalpy of water at room temperature / atmospheric pressure. \end_layout \end_inset \end_layout \begin_layout Standard Each of the models in the array of \family typewriter phase_partials \family default must be refined to be one of the possible models for computing properties for a single phase mixture, i.e., one of the models lying below the \family typewriter phase_paritals \family default model in Figure \begin_inset CommandInset ref LatexCommand ref reference "fig:physprops.thermoLib" \end_inset \noun off : \family typewriter \noun default ideal_vapor_mixture \family default \noun off \begin_inset Index idx status collapsed \begin_layout Plain Layout ideal \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset vapor \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset mixture \end_layout \end_inset , \family typewriter \noun default Pitzer_vapor_mixture \family default \noun off \begin_inset Index idx status collapsed \begin_layout Plain Layout Pitzer \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset vapor \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset mixture \end_layout \end_inset , \family typewriter \noun default UNIFAC_liquid_mixture \family default \noun off \begin_inset Index idx status collapsed \begin_layout Plain Layout UNIFAC \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset liquid \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset mixture \end_layout \end_inset or \family typewriter \noun default Wilson_liquid_mixture \family default \noun off \begin_inset Index idx status collapsed \begin_layout Plain Layout Wilson \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset liquid \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset mixture \end_layout \end_inset . \end_layout \begin_layout Standard \begin_inset Float figure wide false sideways false status open \begin_layout Plain Layout \noun off \begin_inset Graphics filename howto-physpropsFig3.eps lyxscale 50 width 100col% \end_inset \end_layout \begin_layout Plain Layout \begin_inset Caption Standard \begin_layout Plain Layout Models in thermodynamic.a4l \begin_inset CommandInset label LatexCommand label name "fig:physprops.thermoLib" \end_inset \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Standard The information in an instance of a \family typewriter phases_data \family default model allows us to construct this array of \family typewriter phase_partials \family default . We extract the following code from the library \family typewriter stream_holdup.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout stream \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset holdup.a4l \end_layout \end_inset to illustrate how we have created such a model, given a \family typewriter phases_data \family default model. \end_layout \begin_layout LyX-Code MODEL select_mixture_type \begin_inset Index idx status collapsed \begin_layout Plain Layout select \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset mixture \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset type \end_layout \end_inset ( \end_layout \begin_layout LyX-Code cd WILL_BE components_data; \end_layout \begin_layout LyX-Code type WILL_BE symbol_constant; \end_layout \begin_layout LyX-Code ) REFINES sh_base; \end_layout \begin_layout LyX-Code phase IS_A phase_partials(cd); \end_layout \begin_layout LyX-Code SELECT (type) \end_layout \begin_layout LyX-Code CASE 'ideal_vapor_mixture': \end_layout \begin_layout LyX-Code phase IS_REFINED_TO ideal_vapor_mixture(cd); \end_layout \begin_layout LyX-Code CASE 'Pitzer_vapor_mixture': \end_layout \begin_layout LyX-Code phase IS_REFINED_TO Pitzer_vapor_mixture(cd); \end_layout \begin_layout LyX-Code CASE 'UNIFAC_liquid_mixture': \end_layout \begin_layout LyX-Code phase IS_REFINED_TO UNIFAC_liquid_mixture(cd); \end_layout \begin_layout LyX-Code CASE 'Wilson_liquid_mixture': \end_layout \begin_layout LyX-Code phase IS_REFINED_TO Wilson_liquid_mixture(cd); \end_layout \begin_layout LyX-Code OTHERWISE: \end_layout \begin_layout LyX-Code END SELECT; \end_layout \begin_layout LyX-Code boundwidth IS_A bound_width; \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code \end_layout \begin_layout LyX-Code END select_mixture_type; \end_layout \begin_layout LyX-Code \end_layout \begin_layout LyX-Code MODEL stream( ....... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code \end_layout \begin_layout LyX-Code FOR j IN phases CREATE \end_layout \begin_layout LyX-Code smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]); \end_layout \begin_layout LyX-Code END FOR; \end_layout \begin_layout LyX-Code FOR j IN phases CREATE \end_layout \begin_layout LyX-Code phase[j] ALIASES smt[j].phase; \end_layout \begin_layout LyX-Code END FOR; \end_layout \begin_layout LyX-Code state IS_A thermodynamics(cd, pd, phase, equilibrated); \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout LyX-Code ... \end_layout \begin_layout Standard \begin_inset Marginal status collapsed \begin_layout Plain Layout cannot directly embed SELECT statements in FOR loops \end_layout \end_inset We had to be a bit tricky, but we hope we have not been so devious that you cannot understand what we have done if we explain it to you here. Look first at the code we extracted from the model stream. The models \family typewriter cd \family default and \family typewriter pd \family default are instances of a \family typewriter components_data \family default and a \family typewriter phases_data \family default model respectively. If we look inside \family typewriter pd \family default , we will find it contains an array called \family typewriter phase_type \family default , with one entry for each phase that gives the type (name) of the model to be used to set up the equations for that phase. ASCEND does not allow \family typewriter SELECT \family default statements \begin_inset Index idx status collapsed \begin_layout Plain Layout SELECT statements. embedded in FOR \end_layout \end_inset to be embedded directly within a \family typewriter FOR \family default loop -- thus we need a bit of deviousness. For each phase j we create \family typewriter smt[j] \family default as an instance of a \family typewriter select_mixture_type \family default model. We parameterize the \family typewriter select_mixture_type \family default with the components data \family typewriter cd \family default and the type (name) \family typewriter pd.phase_type[j] \family default of the model to be used to generate its equations. Then we embed the select statement within the \family typewriter select_mixture_type \family default model, something ASCEND does allow. \end_layout \begin_layout Standard The model \family typewriter select_mixture_type \family default appears first in this code. It uses the type (name) it is passed to select and then to instance the desired refinement of the \family typewriter phase_partials \family default model. \end_layout \begin_layout Standard Returning to the code extracted from the flash model, the second \family typewriter FOR \family default loop creates the desired array by aliasing the array element \family typewriter phase[j] \family default with the phase model created within the corresponding \family typewriter smt \family default instance. \end_layout \begin_layout Standard \begin_inset Marginal status open \begin_layout Plain Layout disappearing phases \begin_inset Index idx status collapsed \begin_layout Plain Layout disappearing phases \end_layout \end_inset \end_layout \end_inset The multi-phase model handles the case where a phase disappears by using a complementarity \begin_inset Index idx status collapsed \begin_layout Plain Layout complementarity \end_layout \end_inset formulation. This formulation relaxes the constraint for a phase that its mole fractions must sum to unity when it disappears. Thus the vapor/liquid model will correctly alter the model to handle the situation when the mixture becomes a superheated vapor or a subcooled liquid. \end_layout \begin_layout Standard We are now ready to create an instance of a thermodynamics model. When compiled this instance contains all the equations needed to estimate the phase conditions for a multi-phase, multi-component mixture assuming equilibrium exists among the phases. The following line of code, extracted from the stream model referred to above, illustrates its use: \end_layout \begin_layout LyX-Code state IS_A thermodynamics(cd, pd, phase, equilibrated); \end_layout \begin_layout Standard where \family typewriter cd \family default is an instance of a \family typewriter components_data model \family default , \family typewriter pd \family default of a \family typewriter phases_data \family default model, \family typewriter phase \family default an array of instances of \family typewriter phase_partials \family default , and \family typewriter equilibrated \family default a \family typewriter boolean \family default variable. When \family typewriter equilibrated \family default is \family typewriter FALSE \family default , the model will generate the equations assuming constant relative volatilities (the user must estimate these volatilities). When \family typewriter TRUE \family default , the model generates the equations assuming the chemical potentials for a component are equal in all phases. \end_layout \begin_layout Section Using the thermodynamics models \end_layout \begin_layout Standard There are several libraries of models that use the libraries we have just described. The first library to examine is \family typewriter stream_holdup.a4l \family default . This library contains steady-state models for a stream and a holdup. The following gives the parameter list for a user to create an instance of a stream. \end_layout \begin_layout Subsection Streams \begin_inset Index idx status collapsed \begin_layout Plain Layout streams \end_layout \end_inset and holdups \begin_inset Index idx status collapsed \begin_layout Plain Layout holdups \end_layout \end_inset \end_layout \begin_layout LyX-Code MODEL stream ( \end_layout \begin_layout LyX-Code cd WILL_BE components_data; \end_layout \begin_layout LyX-Code pd WILL_BE phases_data; \end_layout \begin_layout LyX-Code equilibrated WILL_BE boolean; \end_layout \begin_layout LyX-Code ) REFINES sh_base; \end_layout \begin_layout Standard The model \family typewriter sh_base \family default is a dummy model to tie all models into this library back to a common root model. The user need do nothing because of this refinement. What you should note is that all you need to do to create a stream is create a \family typewriter components_data \family default model and a \family typewriter phases_data \family default model. One supplies the boolean variable \family typewriter equilibrated \family default as a variable that one can set interactively or in a method or a script when running the model to decide how to model equilibrium, as we have discussed above. A holdup is equally as easy to model. \end_layout \begin_layout Subsection Flash units \begin_inset Index idx status collapsed \begin_layout Plain Layout flash units \end_layout \end_inset and variants thereof \end_layout \begin_layout Standard From streams and holdups, we can move on to unit operation models. The library \family typewriter flash.a4l \family default provide us with a flash model. The parameter list for the flash model is: \end_layout \begin_layout LyX-Code MODEL vapor_liquid_flash \begin_inset Index idx status collapsed \begin_layout Plain Layout vapor \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset liquid \begin_inset ERT status collapsed \begin_layout Plain Layout \backslash _ \end_layout \end_inset flash \end_layout \end_inset ( \end_layout \begin_layout LyX-Code Qin WILL_BE energy_rate; \end_layout \begin_layout LyX-Code equilibrated WILL_BE boolean; \end_layout \begin_layout LyX-Code feed WILL_BE stream; \end_layout \begin_layout LyX-Code vapout WILL_BE stream; \end_layout \begin_layout LyX-Code liqout WILL_BE stream; \end_layout \begin_layout LyX-Code ) WHERE ( \end_layout \begin_layout LyX-Code feed, vapout, liqout WILL_NOT_BE_THE_SAME; \end_layout \begin_layout LyX-Code feed.cd, vapout.cd, liqout.cd WILL_BE_THE_SAME; \end_layout \begin_layout LyX-Code vapout.pd.phase_indicator == 'V'; \end_layout \begin_layout LyX-Code liqout.pd.phase_indicator == 'L'; \end_layout \begin_layout LyX-Code (feed.pd.phase_indicator IN ['V','L','VL','VLL']) == TRUE; \end_layout \begin_layout LyX-Code ) REFINES flash_base; \end_layout \begin_layout Standard Again we see that to create a flash unit, we need to create the variable \family typewriter Qin \family default for the heat input to the unit, a boolean \family typewriter equilibrated \family default and three streams, \family typewriter feed \family default , \family typewriter vapout \family default and \family typewriter liqout \family default . The three streams must all be different streams. They must have the same components in them. The stream \family typewriter vapout \family default must be a vapor stream and the stream \family typewriter liqout \family default a liquid stream. The \family typewriter feed \family default stream can be of any kind. \end_layout \begin_layout Standard Hopefully with the above information, creating a flash unit should not now seem particularly difficult. \end_layout \begin_layout Standard If you examine this library further, you will see it contains models which are variations of the flash unit for: \family typewriter detailed_tray \family default , \family typewriter tray \family default , \family typewriter feed_tray \family default , \family typewriter total_condenser \family default and \family typewriter simple_reboiler \family default . \end_layout \begin_layout Subsection Distillation columns \begin_inset Index idx status collapsed \begin_layout Plain Layout Distillation columns \end_layout \end_inset \end_layout \begin_layout Standard We provide two libraries that allow you to model distillation columns: \family typewriter column.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout column.a4l \end_layout \end_inset and \family typewriter collocation.a4l \family default \begin_inset Index idx status collapsed \begin_layout Plain Layout collocation.a4l \end_layout \end_inset . The library \family typewriter column.a4l \family default first models a tray stack and then a simple column using that model. A third model extracts the profiles for pressure, temperature, a parameter that indicates the deviation from constant molar overflow conditions, total vapor and liquid flows and component compositions against tray number. This information may then be used for plotting these profiles using the ASCEND plotting capability. \end_layout \begin_layout Standard The library \family typewriter collocation.a4l \family default provides collocation models for simple columns. With collocation models, one models composition profiles as smooth functions of tray number in a column section. Columns with a large number of trays are modeled with relatively small collocation models. Also the number of trays becomes a continuous variable, aiding in optimization studies where the number of trays in each section is to be computed. \end_layout \begin_layout Subsection Dynamic unit models \end_layout \begin_layout Standard ASCEND contains models for simulating the dynamic behavior of units. Their use is described in Chapter \begin_inset CommandInset ref LatexCommand vref reference "cha:ivp" \end_inset . \end_layout \begin_layout Section Discussion \end_layout \begin_layout Standard We have presented a description of the libraries that allow one to model the equations providing thermodynamic properties for multi-component, multi-pha se mixtures when one assume equilibrium exists among co-existing phases. With this description, we hope that these models become much less difficult to use. We end this chapter by describing other libraries that build on the property estimation libraries, models for streams and holdups, for flash units and variations thereof, and for columns. \end_layout \end_body \end_document