~jdpipe/ascend/trunk-old

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# This file is part of the ASCEND Modeling Library and is released
# under the GNU Public License as described at the end of this file.
#
# This file demonstrates the use of dyn_column.a4l

DELETE TYPES;
READ FILE "dyn_column.a4l";

# The following source statement uses a full path to find the file
# set_intervals.tcl.  If this path fails, edit in the correct
# full path.
source "$env(ASCENDDIST)/models/set_intervals.tcl";

#Vapor liquid flash.
COMPILE tvlf OF test_vapor_liquid_flash;
BROWSE {tvlf};
ASSIGN tvlf.equilibrated FALSE;
RUN {tvlf.values};
RUN {tvlf.reset};
SOLVE {tvlf} WITH QRSlv;
RUN {tvlf.check_self};
ASSIGN tvlf.dynamic TRUE;
RUN {tvlf.fl1.seqmod};
RUN {tvlf.fl1.set_ode};
RUN {tvlf.fl1.set_obs};
set_int 100 1 {s};
ASSIGN {tvlf.feed.f['water']} 0.025 {kmol/s};
INTEGRATE tvlf FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM;
ASSIGN tvlf.dynamic FALSE;
ASSIGN tvlf.equilibrated TRUE;
RUN {tvlf.values};
RUN {tvlf.reset};
SOLVE {tvlf} WITH QRSlv;
RUN {tvlf.check_self};
ASSIGN tvlf.dynamic TRUE;
RUN {tvlf.fl1.seqmod};
#RUN {tvlf.fl1.set_ode};
#RUN {tvlf.fl1.set_obs};
ASSIGN tvlf.t 0 {s};
ASSIGN {tvlf.feed.f['water']} 0.010 {kmol/s};
INTEGRATE tvlf FROM 0 TO 99 WITH BLSODE;

# Single Tray
COMPILE tt OF test_tray;
BROWSE {tt};
ASSIGN tt.equilibrated FALSE;
RUN {tt.values};
RUN {tt.reset};
SOLVE {tt} WITH QRSlv;
RUN {tt.check_self};
ASSIGN tt.dynamic TRUE;
RUN {tt.reset};
RUN {tt.fl1.set_ode};
RUN {tt.fl1.set_obs};
ASSIGN {tt.vin.f['water']} 0.030 {kmol/s};
INTEGRATE tt FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM
ASSIGN tt.dynamic FALSE;
ASSIGN tt.equilibrated TRUE;
RUN {tt.values};
RUN {tt.reset};
SOLVE {tt} WITH QRSlv;
RUN {tt.check_self};
ASSIGN tt.dynamic TRUE;
RUN {tt.reset};
#RUN {tt.fl1.set_ode};
#RUN {tt.fl1.set_obs};
ASSIGN tt.t 0 {s};
ASSIGN {tt.vin.f['water']} 0.010 {kmol/s};
INTEGRATE tt FROM 0 TO 99 WITH BLSODE;

ASSIGN tt.dynamic FALSE;
RUN {tt.values};
RUN {tt.reset};
RUN tt.fl1.reset_to_adiabatic;
SOLVE {tt} WITH QRSlv;
RUN {tt.check_self};
ASSIGN tt.dynamic TRUE;
RUN {tt.fl1.seqmod};
ASSIGN tt.t 0 {s};
ASSIGN {tt.vin.f['water']} 0.015 {kmol/s};
INTEGRATE tt FROM 0 TO 99 WITH BLSODE;


# Feed tray with 1 V/L feed.
COMPILE tft OF test_feed_tray;
BROWSE {tft};
ASSIGN tft.equilibrated FALSE;
RUN {tft.values};
RUN {tft.reset};
SOLVE {tft} WITH QRSlv;
RUN {tft.check_self};
ASSIGN tft.dynamic TRUE;
RUN {tft.reset};
RUN {tft.fl1.set_ode};
RUN {tft.fl1.set_obs};
ASSIGN {tft.feed.f['water']} 0.030 {kmol/s};
INTEGRATE tft FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM;
ASSIGN tft.dynamic FALSE;
ASSIGN tft.equilibrated TRUE;
RUN {tft.values};
RUN {tft.reset};
SOLVE {tft} WITH QRSlv;
RUN {tft.check_self};
ASSIGN tft.dynamic TRUE;
RUN {tft.reset};
ASSIGN tft.t 0 {s};
ASSIGN {tft.feed.f['water']} 0.010 {kmol/s};
INTEGRATE tft FROM 0 TO 99 WITH BLSODE;

ASSIGN tft.dynamic FALSE;
RUN {tft.values};
RUN {tft.reset};
RUN {tft.fl1.reset_to_adiabatic};
SOLVE {tft} WITH QRSlv;
RUN {tft.check_self};
ASSIGN tft.dynamic TRUE;
RUN {tft.reset};
ASSIGN tft.t 0 {s};
ASSIGN {tft.feed.f['water']} 0.015 {kmol/s};
INTEGRATE tft FROM 0 TO 99 WITH BLSODE;

# Condenser with 1 liquid product when partial is
# FALSE and 1 vapor product when partial is TRUE;
# Both Liquid and vapor products are possible but
# one of the flows must be set or a ratio given.
COMPILE tc OF test_condenser;
BROWSE {tc};
ASSIGN tc.partial FALSE;
# Partial is false - this is a total condenser
ASSIGN tc.fl1.vap_distillate.flow 0 {mole/sec};
# if partial TRUE set liq_distillate.flow = 0;
ASSIGN tc.equilibrated FALSE;
RUN {tc.values};
RUN {tc.reset};
SOLVE {tc} WITH QRSlv;
RUN {tc.check_self};
ASSIGN tc.dynamic TRUE;
RUN tc.fl1.seqmod;
RUN tc.fl1.set_ode;
RUN tc.fl1.set_obs;
ASSIGN tc.t 0 {s};
ASSIGN {tc.vapin.f['water']} 0.025 {kmol/s};
INTEGRATE tc FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM;
ASSIGN tc.dynamic FALSE;
ASSIGN tc.equilibrated TRUE;
RUN {tc.values};
RUN tc.fl1.seqmod;
SOLVE {tc} WITH QRSlv;
RUN {tc.check_self};
ASSIGN tc.dynamic TRUE;
ASSIGN tc.t 0 {s};
ASSIGN {tc.vapin.f['water']} 0.025 {kmol/s};
INTEGRATE tc FROM 0 TO 99 WITH BLSODE;

# Reboiler with 1 liquid product when partial is
# TRUE and 1 vapor product with partial is FALSE;
# Both liquid an vapor products are possible if one
# of the follows is fixed or a ratio is given.

COMPILE tr OF test_reboiler;
BROWSE {tr};
ASSIGN tr.dynamic FALSE;
ASSIGN tr.partial TRUE;
ASSIGN tr.fl1.vap_bottom.flow 0 {mole/s};
ASSIGN tr.equilibrated FALSE;
RUN {tr.values};
RUN {tr.reset};
SOLVE {tr} WITH QRSlv;
RUN {tr.check_self};
ASSIGN tr.dynamic TRUE;
RUN tr.fl1.seqmod;
RUN tr.fl1.set_ode;
RUN tr.fl1.set_obs;
ASSIGN tr.t 0 {s};
ASSIGN {tr.liqin.f['water']} 0.025 {kmol/s};
INTEGRATE tr FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM;
ASSIGN tr.dynamic FALSE;
ASSIGN tr.equilibrated TRUE;
RUN {tr.values};
RUN {tr.reset};
SOLVE {tr} WITH QRSlv;
RUN {tr.check_self};
ASSIGN tr.dynamic TRUE;
RUN tr.fl1.seqmod;
ASSIGN tr.t 0 {s};
ASSIGN {tr.liqin.f['water']} 0.015 {kmol/s};
INTEGRATE tr FROM 0 TO 99 WITH BLSODE;

# Internal Tray Stack Model
# Stack of trays for a column
COMPILE tts OF test_tray_stack;
BROWSE {tts};
ASSIGN {tts.dynamic} FALSE;
ASSIGN {tts.equilibrated} FALSE;
RUN {tts.values};
RUN {tts.reset};
SOLVE {tts} WITH QRSlv;
RUN {tts.check_self};
ASSIGN {tts.dynamic} TRUE;
RUN {tts.fl1.seqmod};
RUN {tts.fl1.set_ode};
RUN {tts.fl1.set_obs};
set_int 100 1 {s};
ASSIGN {tts.lin.f['water']} 0.015 {kmol/s};
INTEGRATE tts FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM;
ASSIGN {tts.dynamic} FALSE;
ASSIGN {tts.equilibrated} TRUE;
RUN {tts.values};
RUN {tts.reset};
SOLVE {tts} WITH QRSlv;
RUN {tts.check_self};
ASSIGN {tts.dynamic} TRUE;
RUN {tts.fl1.seqmod};
ASSIGN {tts.t} 0 {s};
ASSIGN {tts.lin.f['water']} 0.025 {kmol/s};
INTEGRATE tts FROM 0 TO 99 WITH BLSODE;

ASSIGN {tts.dynamic} FALSE;
RUN {tts.values};
RUN {tts.fl1.reset_to_adiabatic};
SOLVE {tts} WITH QRSlv;
RUN {tts.check_self};
ASSIGN {tts.dynamic} TRUE;
RUN {tts.fl1.seqmod};
ASSIGN {tts.t} 0 {s};
ASSIGN {tts.lin.f['water']} 0.015 {kmol/s};
INTEGRATE tts FROM 0 TO 99 WITH BLSODE;



# Column Model
# Note that some of the solves in the following model
# may require a few more iterations than the solver
# gives by default, depending on the solver scaling
# and factorization and step control options.
# Just hit the Solve button again.
# In this model the condenser is defaulted to a total
# condenser and the reboiler is a partial reboiler.
COMPILE {tsc} OF {test_column};
BROWSE {tsc};
ASSIGN {tsc.dynamic} FALSE;
ASSIGN {tsc.equilibrated} FALSE;
#RUN {tsc.scale_all};
RUN {tsc.reset};
RUN {tsc.values};
SOLVE tsc WITH QRSlv;
RUN {tsc.check_self};
ASSIGN {tsc.dynamic} TRUE;
RUN {tsc.reset};
RUN {tsc.col.set_ode};
RUN {tsc.col.set_obs};
set_int 10000 1 {s};
ASSIGN {tsc.feed.f['n_heptane']} 0.011 {kmol/s};
INTEGRATE tsc FROM 0 TO 99 WITH BLSODE;

DELETE SYSTEM;
ASSIGN {tsc.dynamic} FALSE;
ASSIGN {tsc.equilibrated} TRUE;
RUN {tsc.values};
RUN {tsc.reset};
SOLVE tsc WITH QRSlv;
RUN {tsc.check_self};
ASSIGN {tsc.dynamic} TRUE;
RUN {tsc.reset};
ASSIGN {tsc.t} 0 {s};
ASSIGN {tsc.feed.f['n_heptane']} 0.009 {kmol/s};
INTEGRATE tsc FROM 0 TO 99 WITH BLSODE;

ASSIGN {tsc.dynamic} FALSE;
RUN {tsc.values};
RUN {tsc.reset};
RUN {tsc.col.reset_to_adiabatic};
SOLVE tsc WITH QRSlv;
RUN {tsc.check_self};
ASSIGN {tsc.dynamic} TRUE;
RUN {tsc.reset};
ASSIGN {tsc.t} 0{s};
ASSIGN {tsc.feed.f['n_heptane']} 0.011 {kmol/s};
INTEGRATE tsc FROM 0 TO 99 WITH BLSODE;

##########  dyn_separation_demos.a4s ends here  ##########
#
#  dyn_separation_demos.a4s
#  by Duncan Coffey
#  June, 1998
#  Part of the ASCEND Library
#  $Date: 1998/06/17 20:08:30 $
#  $Revision: 1.3 $
#  $Author: mthomas $
#  $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/dyn_separation_demos.a4s,v $
#
#  This file is part of the ASCEND Modeling Library.
#
#  Copyright (C) 1998 Carnegie Mellon University
#
#  The ASCEND Modeling Library is free software. You can redistribute
#  it and/or modify it under the terms of the GNU General Public
#  License as published by the Free Software Foundation---either
#  version 2 of the License, or (at your option) any later version.
#
#  The ASCEND Modeling Library is distributed in hope that it
#  will be useful, but WITHOUT ANY WARRANTY--without even the implied
#  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with the program.  If not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA.  Check
#  the file named COPYING.