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

Contents of /trunk/models/rachford.a4c

Parent Directory Parent Directory | Revision Log Revision Log


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

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