/[ascend]/trunk/models/rachford.a4c
ViewVC logotype

Annotation of /trunk/models/rachford.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (19 years, 11 months ago) by aw0a
File MIME type: text/x-ascend
File size: 5533 byte(s)
Setting up web subdirectory in repository
1 aw0a 1 REQUIRE "atoms.a4l";
2     (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *)
3     PROVIDE "rachford.a4c";
4     (*
5     * This file is part of the ASCEND Modeling Library and is released
6     * under the GNU Public License as described at the end of this file.
7     *
8     * Use of this module is demonstrated by the associated script file
9     * rachford.a4s.
10     *)
11    
12     (*
13     Ascend model of the Rachford-Rice equation described by King.
14     -- Separation Process. Chemical Engineering series. 2nd. Edition, McGraw-
15     Hill, 77-79, 1980 --. The problem consists in a simple flash calculation
16     performed by solving the Rachford-Rice equation. There is a disjunctive
17     statement which extends the use of that equation for cases in which the
18     system has only one phase (liquid or vapor). That is, this model not only
19     copes with the liquid-vapor equilibrium case. The resulting system of
20     equations can be solved with the ascend conditional solver CMSlv.
21    
22     This model requires:
23     "system.a4l"
24     "atoms.a4l"
25     *)
26    
27     (* ************************************************* *)
28    
29     (* Components *)
30    
31     MODEL component_constants;
32     Tc IS_A critical_temperature;
33     Pc IS_A critical_pressure;
34     vpa, vpb, vpc, vpd IS_A vapor_pressure_constant;
35     END component_constants;
36    
37     MODEL n_butane REFINES component_constants;
38     (*Constants *)
39     Tc :== 425.2 {K};
40     Pc :== 38.0 {bar};
41     vpa :== -6.88709;
42     vpb :== 1.15157;
43     vpc :== -1.99873;
44     vpd :== -3.13003;
45     END n_butane;
46    
47     MODEL n_pentane REFINES component_constants;
48     (*Constants *)
49     Tc :== 469.7 {K};
50     Pc :== 33.7 {bar};
51     vpa :== -7.28936;
52     vpb :== 1.53679;
53     vpc :== -3.08367;
54     vpd :== -1.02456;
55     END n_pentane;
56    
57     MODEL n_hexane REFINES component_constants;
58     (*Constants *)
59     Tc :== 507.5 {K};
60     Pc :== 30.1 {bar};
61     vpa :== -7.46765;
62     vpb :== 1.44211;
63     vpc :== -3.28222;
64     vpd :== -2.50941;
65     END n_hexane;
66    
67     (* ************************************************* *)
68    
69     (* Flash calculation *)
70     (* Rachford Rice calculation when P and T are specified *)
71    
72     MODEL simple_flash;
73     components IS_A set OF integer_constant;
74     comp[components] IS_A component_constants;
75     VP[components] IS_A pressure;
76     K[components] IS_A factor;
77     z[components],
78     x[components],
79     y[components] IS_A fraction;
80     V,F IS_A molar_rate;
81     V_F IS_A factor;
82     T IS_A temperature;
83     P IS_A pressure;
84     G IS_A factor;
85     bol1,bol2 IS_A boolean_var;
86    
87    
88     (* Component Data *)
89    
90     components :== [1..3];
91     comp[1] IS_REFINED_TO n_butane;
92     comp[2] IS_REFINED_TO n_pentane;
93     comp[3] IS_REFINED_TO n_hexane;
94    
95    
96     (* Boundaries *)
97     CONDITIONAL
98     cond1: G <= 0.0;
99     cond2: G <= 1.0;
100     END CONDITIONAL;
101    
102     bol1 == SATISFIED(cond1,1e-08);
103     bol2 == SATISFIED(cond2,1e-08);
104    
105     (* Variant Equations*)
106     eq1: V_F = 0.0;
107     eq2: V_F = G;
108     eq3: V_F = 1.0;
109    
110     (* Disjunctive Statement*)
111     WHEN (bol1,bol2)
112     CASE TRUE,TRUE:
113     USE eq1;
114     CASE FALSE,TRUE:
115     USE eq2;
116     CASE FALSE,FALSE:
117     USE eq3;
118     OTHERWISE:
119     END WHEN;
120    
121     (* Invariant Equations *)
122    
123     FOR i IN components CREATE
124    
125     (* Vapor pressure *)
126     ln(VP[i]/comp[i].Pc)*T/comp[i].Tc*abs(comp[i].Tc - T) =
127     (comp[i].vpa*abs(1.0 - T/comp[i].Tc) +
128     (comp[i].vpb*abs(1.0 - T/comp[i].Tc)^1.5) +
129     (comp[i].vpc*abs(1.0 - T/comp[i].Tc)^3.0) +
130     (comp[i].vpd*abs(1.0 - T/comp[i].Tc)^6.0))*(comp[i].Tc - T);
131    
132     (* Equilibrium constant *)
133     K[i] = VP[i] / P;
134    
135     END FOR;
136    
137     (* Rachford-Rice *)
138    
139     SUM[ ( z[i] * ( K[i] - 1 ) ) / ( ((K[i]-1)* V_F) + 1 )
140     | i IN components ] = G - V_F;
141    
142     FOR i IN components CREATE
143     (* Liquid compositions *)
144     x[i] = z[i] / ( ((K[i]-1)* V_F) + 1 );
145    
146     (* Vapor compositions *)
147     y[i] = ( K[i] * z[i] ) / ( ((K[i]-1)* V_F) + 1 );
148     END FOR;
149    
150     (* V/F *)
151     V_F = V/F;
152    
153    
154     METHODS
155    
156     METHOD default_self;
157     END default_self;
158    
159     METHOD specify;
160     FOR i IN components DO
161     z[i].fixed := TRUE;
162     END FOR;
163     F.fixed := TRUE;
164     P.fixed := TRUE;
165     T.fixed := TRUE;
166     END specify;
167    
168     METHOD values;
169    
170     (* fixed values *)
171     z[1] := 0.2;
172     z[2] := 0.5;
173     z[3] := 0.3;
174     P := 10 {atm};
175     T := 405 {K}; (* It obtains results in the complete range 150 - 830 *)
176     F:= 200 {lb_mole/hour};
177     (* initial guesses *)
178     K[1] := 2;
179     K[2] := 1;
180     K[3] := 0.5;
181     V := 100 {lb_mole/hour};
182     V_F:= 0.5;
183     G := 0.5;
184    
185     END values;
186    
187     END simple_flash;
188    
189    
190     (*
191     * rachford.a4c
192     * by Vicente Rico-Ramirez
193     * April 10, 1998
194     * Part of the ASCEND Library
195     * $Date: 1998/06/17 19:15:05 $
196     * $Revision: 1.3 $
197     * $Author: mthomas $
198     * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/rachford.a4c,v $
199     *
200     * This file is part of the ASCEND Modeling Library.
201     *
202     * Copyright (C) 1998 Carnegie Mellon Univesity
203     *
204     * The ASCEND Modeling Library is free software; you can redistribute
205     * it and/or modify it under the terms of the GNU General Public
206     * License as published by the Free Software Foundation; either
207     * version 2 of the License, or (at your option) any later version.
208     *
209     * The ASCEND Modeling Library is distributed in hope that it will be
210     * useful, but WITHOUT ANY WARRANTY; without even the implied
211     * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
212     * See the GNU General Public License for more details.
213     *
214     * You should have received a copy of the GNU General Public License
215     * along with the program; if not, write to the Free Software
216     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
217     * the file named COPYING.
218     *)

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22