/[ascend]/trunk/models/kchittur/eos.a4c
ViewVC logotype

Contents of /trunk/models/kchittur/eos.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2614 - (show annotations) (download) (as text)
Mon May 7 20:56:29 2012 UTC (8 years, 4 months ago) by kchittur
File MIME type: text/x-ascend
File size: 13300 byte(s)


1 REQUIRE "thermodynamics.a4l";
2
3 ATOM vdwa REFINES solver_var
4 DIMENSION M*L^5/Q^2/T^2
5 DEFAULT 0.1 {kg*m^5/mole^2/s^2};
6 lower_bound := 0.0 {kg*m^5/mole^2/s^2};
7 upper_bound := 10.0 {kg*m^5/mole^2/s^2};
8 nominal := 0.1 {kg*m^5/mole^5/s^2};
9 END vdwa;
10
11 ATOM virialC REFINES solver_var
12 DIMENSION L^6/Q^2
13 DEFAULT 7000.0 {cm^6/mol^2};
14 lower_bound := 0.0 {cm^6/mol^2};
15 upper_bound := 1.0 {m^6/mol^2};
16 nominal := 7000.0 {cm^6/mol^2};
17 END virialC;
18
19 ATOM virialB REFINES solver_var
20 DIMENSION L^3/Q
21 DEFAULT 1.0 {m^3/mol};
22 lower_bound := -1000.00 {m^3/mol};
23 upper_bound := 1000.0 {m^3/mol};
24 nominal := 1.0 {m^3/mol};
25 END virialB;
26
27
28 MODEL idealgas(P WILL_BE pressure;
29 T WILL_BE temperature;
30 V WILL_BE molar_volume;);
31
32 R IS_A molar_gas_constant;
33
34 eq: P*V = R*T;
35
36 METHODS
37 METHOD default_self;
38 RUN ClearAll;
39 RUN specify;
40 RUN values;
41 END default_self;
42 METHOD specify;
43 P.fixed := TRUE;
44 T.fixed := TRUE;
45 V.fixed := FALSE;
46 END specify;
47 METHOD values;
48 P := 1.0 {atm};
49 T := 298.0 {K};
50 END values;
51
52 END idealgas;
53
54 MODEL vanderwaals(P WILL_BE pressure;
55 T WILL_BE temperature;
56 V WILL_BE molar_volume;
57 Z WILL_BE factor;
58 data WILL_BE td_component_constants;
59 );
60
61 R IS_A molar_gas_constant;
62 b IS_A molar_volume;
63 a IS_A vdwa;
64 Pc IS_A pressure;
65 Tc IS_A temperature;
66
67 eq: (P*V^2 + a)*(V - b) = R*T*V^2;
68 eqb: b*8.0*data.Pc = R*data.Tc;
69 eqa: a*64.0*data.Pc = 27.0*R^2*(data.Tc)^2;
70 eqc: Z*R*T = P*V;
71
72 METHODS
73 METHOD default_self;
74 RUN ClearAll;
75 RUN specify;
76 RUN values;
77 END default_self;
78 METHOD specify;
79 P.fixed := TRUE;
80 T.fixed := TRUE;
81 V.fixed := FALSE;
82 Z.fixed := FALSE;
83 END specify;
84 METHOD values;
85 P := 12.0 {atm};
86 T := 298.15 {K};
87 V := 0.075 {m^3/mole};
88 V.nominal := 0.05 {m^3/mole};
89 V.upper_bound := 100 {m^3/mole};
90 END values;
91
92 END vanderwaals;
93
94 MODEL truncated_virial_equation (P WILL_BE pressure;
95 T WILL_BE temperature; V WILL_BE molar_volume; Z WILL_BE factor;
96 data WILL_BE td_component_constants;);
97
98 R IS_A molar_gas_constant;
99 Pc IS_A pressure;
100 Tc IS_A temperature;
101 T_degC IS_A factor;
102 omega IS_A factor;
103 Tr, Pr IS_A factor;
104 B IS_A virialB;
105 C IS_A virialC;
106
107 Bhat, B0, B1 IS_A factor;
108
109 Pc = data.Pc;
110 Tc = data.Tc;
111 omega = data.omega;
112
113 eq1: Tr = T/Tc;
114 eq2: Pr = P/Pc;
115 eq3: T_degC = T/1{K} - 273.15;
116
117 eq4: Bhat = B0 + omega*B1;
118 eq5: B0*Tr^(1.6) = 0.083*Tr^(1.6) - 0.422;
119 eq6: B1*Tr^(4.2) = 0.139*Tr^(4.2) - 0.172;
120
121 eq7: Z = 1.0 + B0*Pr/Tr + omega*B1*Pr/Tr;
122
123 eq8: Z*R*T = P*V;
124 eq9: B = Bhat*1.0{m^3/mol};
125
126 METHODS
127 METHOD default_self;
128 RUN ClearAll;
129 RUN specify;
130 RUN values;
131 END default_self;
132 METHOD specify;
133 P.fixed := TRUE;
134 T_degC.fixed := FALSE;
135 T.fixed := TRUE;
136 END specify;
137 METHOD values;
138 P := 12.0 {bar};
139 T := 298.15 {K};
140 END values;
141
142 END truncated_virial_equation;
143
144 MODEL rk(P WILL_BE pressure;
145 T WILL_BE temperature;
146 V WILL_BE molar_volume;
147 Z WILL_BE factor;
148 data WILL_BE td_component_constants;
149 );
150
151 R IS_A molar_gas_constant;
152 Pc IS_A pressure;
153 Tc IS_A temperature;
154 T_degC IS_A factor;
155 alpha, beta, q,Tr, Pr, omega IS_A factor;
156
157 PSI, OMEGA, sigma, eps IS_A real_constant;
158
159 PSI :== 0.42748;
160 OMEGA :== 0.08664;
161 sigma :== 1.0;
162 eps :== 0.0;
163
164 Pc = data.Pc;
165 Tc = data.Tc;
166 omega = data.omega;
167
168 eq1: Tr = T/Tc;
169 eq2: Pr = P/Pc;
170 eq3: T_degC = T/1{K} - 273.15;
171
172 eq4: alpha = Tr^(0.5);
173 eq5: q = PSI*alpha/(OMEGA*Tr);
174 eq6: beta = OMEGA*Pr/Tr;
175 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
176 eq8: P*V = Z*R*T;
177 METHODS
178 METHOD default_self;
179 RUN ClearAll;
180 RUN specify;
181 RUN values;
182 END default_self;
183 METHOD specify;
184 P.fixed := TRUE;
185 T_degC.fixed := FALSE;
186 T.fixed := TRUE;
187 END specify;
188 METHOD values;
189 P := 12.0 {bar};
190 T := 298.15 {K};
191 Z.lower_bound := 0.0;
192 Z.upper_bound := 10.0;
193 Z.nominal := 1.0;
194 END values;
195 END rk;
196
197 MODEL srk(P WILL_BE pressure;
198 T WILL_BE temperature;
199 V WILL_BE molar_volume;
200 Z WILL_BE factor;
201 data WILL_BE td_component_constants;);
202
203 R IS_A molar_gas_constant;
204 Pc IS_A pressure;
205 Tc IS_A temperature;
206 T_degC IS_A factor;
207 alpha, beta, q,Tr, Pr, omega IS_A factor;
208
209 PSI, OMEGA, sigma, eps IS_A real_constant;
210
211 PSI :== 0.42748;
212 OMEGA :== 0.08664;
213 sigma :== 1.0;
214 eps :== 0.0;
215
216 Pc = data.Pc;
217 Tc = data.Tc;
218 omega = data.omega;
219
220 eq1: Tr = T/Tc;
221 eq2: Pr = P/Pc;
222 eq3: T_degC = T/1{K} - 273.15;
223
224 eq4: alpha = (1.0 + (0.480+1.574*omega-0.176*omega^2)*(1.0-Tr^(0.5)))^2;
225 eq5: q = PSI*alpha/(OMEGA*Tr);
226 eq6: beta = OMEGA*Pr/Tr;
227 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
228 eq8: P*V = Z*R*T;
229
230 METHODS
231 METHOD default_self;
232 RUN ClearAll;
233 RUN specify;
234 RUN values;
235 END default_self;
236
237 METHOD specify;
238 P.fixed := TRUE;
239 T.fixed := TRUE;
240 T_degC.fixed := FALSE;
241 END specify;
242 METHOD values;
243 P := 12.0 {bar};
244 T := 298.15 {K};
245 Z.lower_bound := 0.0;
246 Z.upper_bound := 10.0;
247 Z.nominal := 1.0;
248 END values;
249 END srk;
250
251 MODEL pengrobinson(P WILL_BE pressure;
252 T WILL_BE temperature;
253 V WILL_BE molar_volume;
254 Z WILL_BE factor;
255 data WILL_BE td_component_constants;);
256
257 R IS_A molar_gas_constant;
258 Pc IS_A pressure;
259 Tc IS_A temperature;
260 T_degC IS_A factor;
261 alpha, beta, q,Tr, Pr, omega IS_A factor;
262
263 PSI, OMEGA, sigma, eps IS_A real_constant;
264
265 PSI :== 0.45724;
266 OMEGA :== 0.07780;
267 sigma :== 2.414213562;
268 eps :== 0.414213562;
269
270 Pc = data.Pc;
271 Tc = data.Tc;
272 omega = data.omega;
273
274 eq1: Tr = T/Tc;
275 eq2: Pr = P/Pc;
276 eq3: T_degC = T/1{K} - 273.15;
277
278 eq4: alpha = (1.0 + (0.37464+1.54226*omega-0.26992*omega^2)*(1.0-Tr^(0.5)))^2;
279 eq5: q = PSI*alpha/(OMEGA*Tr);
280 eq6: beta = OMEGA*Pr/Tr;
281 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
282 eq8: P*V = Z*R*T;
283
284
285 METHODS
286 METHOD default_self;
287 RUN ClearAll;
288 RUN specify;
289 RUN values;
290 END default_self;
291
292 METHOD specify;
293 P.fixed := TRUE;
294 T.fixed := TRUE;
295 T_degC.fixed := FALSE;
296 END specify;
297 METHOD values;
298 P := 12.0 {bar};
299 T := 298.15 {K};
300 Z.lower_bound := 0.0;
301 Z.upper_bound := 10.0;
302 Z.nominal := 0.1;
303 END values;
304
305 END pengrobinson;
306
307 MODEL vdw(P WILL_BE pressure;
308 T WILL_BE temperature;
309 V WILL_BE molar_volume;
310 Z WILL_BE factor;
311 data WILL_BE td_component_constants;);
312
313 R IS_A molar_gas_constant;
314 Pc IS_A pressure;
315 Tc IS_A temperature;
316 T_degC IS_A factor;
317 beta, q,Tr, Pr, omega IS_A factor;
318
319 alpha, PSI, OMEGA, sigma, eps IS_A real_constant;
320
321 PSI :== 27.0/64.0;
322 OMEGA :== 1.0/8.0;
323 sigma :== 0.0;
324 eps :== 0.0;
325 alpha :== 1.0;
326
327 Pc = data.Pc;
328 Tc = data.Tc;
329 omega = data.omega;
330
331 eq1: Tr = T/Tc;
332 eq2: Pr = P/Pc;
333 eq3: T_degC = T/1{K} - 273.15;
334
335 eq5: q = PSI*alpha/(OMEGA*Tr);
336 eq6: beta = OMEGA*Pr/Tr;
337 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
338 eq8: P*V = Z*R*T;
339
340 METHODS
341 METHOD default_self;
342 RUN ClearAll;
343 RUN specify;
344 RUN values;
345 END default_self;
346 METHOD specify;
347 P.fixed := TRUE;
348 T.fixed := TRUE;
349 T_degC.fixed := FALSE;
350 END specify;
351 METHOD values;
352 P := 12.0 {bar};
353 T := 298.15 {K};
354 Z.lower_bound := 0.0;
355 Z.upper_bound := 10.0;
356 Z.nominal := 0.1;
357 END values;
358
359 END vdw;
360
361 MODEL testidealgas;
362
363 ig IS_A idealgas(P,T,V);
364 P IS_A pressure;
365 T IS_A temperature;
366 V IS_A molar_volume;
367
368 METHODS
369 METHOD default_self;
370 RUN ClearAll;
371 RUN specify;
372 RUN values;
373 END default_self;
374 METHOD specify;
375 P.fixed := TRUE;
376 T.fixed := TRUE;
377 V.fixed := FALSE;
378 RUN ig.specify;
379 END specify;
380 METHOD values;
381 P := 1.0 {atm};
382 T := 800.0 {K};
383 RUN ig.values;
384 END values;
385 END testidealgas;
386
387 MODEL testvanderwaals;
388
389 c1 IS_A symbol_constant;
390 vd IS_A vanderwaals(P,T,V,Z,cd.data[c1]);
391 Tr, Pr IS_A factor;
392 P IS_A pressure;
393 T IS_A temperature;
394 V IS_A molar_volume;
395 Z IS_A factor;
396
397 c1 :== 'ethylene';
398 cd IS_A components_data([c1],c1);
399
400 eqTr: Tr = T/cd.data[c1].Tc;
401 eqPr: Pr = P/cd.data[c1].Pc;
402
403 METHODS
404 METHOD default_self;
405 RUN ClearAll;
406 RUN specify;
407 RUN values;
408 END default_self;
409
410 METHOD specify;
411 P.fixed := TRUE;
412 V.fixed := FALSE;
413 T.fixed := TRUE;
414 Z.fixed := FALSE;
415 RUN vd.specify;
416 END specify;
417 METHOD values;
418 P := 12.0 {bar};
419 T := 298.15 {K};
420 RUN vd.values;
421 END values;
422
423 END testvanderwaals;
424
425 MODEL testtruncatedvirial;
426
427 c1 IS_A symbol_constant;
428 c1 :== 'acetonitrile';
429 cd IS_A components_data([c1],c1);
430 Tr, Pr IS_A factor;
431 P IS_A pressure;
432 T IS_A temperature;
433 V IS_A molar_volume;
434 Z IS_A factor;
435 tve IS_A truncated_virial_equation(P,T,V,Z,cd.data[c1]);
436
437 eqTr: Tr = T/cd.data[c1].Tc;
438 eqPr: Pr = P/cd.data[c1].Pc;
439
440 METHODS
441 METHOD default_self;
442 RUN ClearAll;
443 RUN specify;
444 RUN values;
445 END default_self;
446
447 METHOD specify;
448 P.fixed := TRUE;
449 V.fixed := FALSE;
450 Z.fixed := FALSE;
451 T.fixed := TRUE;
452 RUN tve.specify;
453 END specify;
454 METHOD values;
455 P := 12.0 {bar};
456 T := 298.15 {K};
457 RUN tve.values;
458 END values;
459
460 END testtruncatedvirial;
461
462 MODEL testrk;
463
464 c1 IS_A symbol_constant;
465 c1 :== 'ethylene';
466 cd IS_A components_data([c1],c1);
467 Tr, Pr IS_A factor;
468 P IS_A pressure;
469 T IS_A temperature;
470 V IS_A molar_volume;
471 Z IS_A factor;
472 trk IS_A rk(P,T,V,Z,cd.data[c1]);
473
474 eqTr: Tr = T/cd.data[c1].Tc;
475 eqPr: Pr = P/cd.data[c1].Pc;
476
477 METHODS
478 METHOD default_self;
479 RUN ClearAll;
480 RUN specify;
481 RUN values;
482 END default_self;
483
484 METHOD specify;
485 P.fixed := TRUE;
486 V.fixed := FALSE;
487 Z.fixed := FALSE;
488 T.fixed := TRUE;
489 RUN trk.specify;
490 END specify;
491 METHOD values;
492 P := 12.0 {bar};
493 T := 298.15 {K};
494 RUN trk.values;
495 END values;
496
497 END testrk;
498
499 MODEL testsrk;
500
501 c1 IS_A symbol_constant;
502 c1 :== 'ethylene';
503 cd IS_A components_data([c1],c1);
504 Tr, Pr IS_A factor;
505 P IS_A pressure;
506 T IS_A temperature;
507 V IS_A molar_volume;
508 Z IS_A factor;
509 tsrk IS_A srk(P,T,V,Z,cd.data[c1]);
510
511 eqTr: Tr = T/cd.data[c1].Tc;
512 eqPr: Pr = P/cd.data[c1].Pc;
513
514 METHODS
515 METHOD default_self;
516 RUN ClearAll;
517 RUN specify;
518 RUN values;
519 END default_self;
520
521 METHOD specify;
522 P.fixed := TRUE;
523 V.fixed := FALSE;
524 Z.fixed := FALSE;
525 T.fixed := TRUE;
526 RUN tsrk.specify;
527 END specify;
528 METHOD values;
529 P := 12.0 {bar};
530 T := 298.15 {K};
531 RUN tsrk.values;
532 END values;
533
534 END testsrk;
535
536 MODEL testpengrobinson;
537
538 c1 IS_A symbol_constant;
539 c1 :== 'ethylene';
540 cd IS_A components_data([c1],c1);
541 Tr, Pr IS_A factor;
542 P IS_A pressure;
543 T IS_A temperature;
544 V IS_A molar_volume;
545 Z IS_A factor;
546 tpeng IS_A pengrobinson(P,T,V,Z,cd.data[c1]);
547
548 eqTr: Tr = T/cd.data[c1].Tc;
549 eqPr: Pr = P/cd.data[c1].Pc;
550
551 METHODS
552 METHOD default_self;
553 RUN ClearAll;
554 RUN specify;
555 RUN values;
556 END default_self;
557
558 METHOD specify;
559 P.fixed := TRUE;
560 V.fixed := FALSE;
561 Z.fixed := FALSE;
562 T.fixed := TRUE;
563 RUN tpeng.specify;
564 END specify;
565 METHOD values;
566 P := 12.0 {bar};
567 T := 298.15 {K};
568 RUN tpeng.values;
569 END values;
570
571 END testpengrobinson;
572
573 MODEL testvdw;
574
575 c1 IS_A symbol_constant;
576 c1 :== 'ethylene';
577 cd IS_A components_data([c1],c1);
578 Tr, Pr IS_A factor;
579 P IS_A pressure;
580 T IS_A temperature;
581 V IS_A molar_volume;
582 Z IS_A factor;
583 tvdw IS_A vdw(P,T,V,Z,cd.data[c1]);
584
585 eqTr: Tr = T/cd.data[c1].Tc;
586 eqPr: Pr = P/cd.data[c1].Pc;
587
588 METHODS
589 METHOD default_self;
590 RUN ClearAll;
591 RUN specify;
592 RUN values;
593 END default_self;
594
595 METHOD specify;
596 P.fixed := TRUE;
597 V.fixed := FALSE;
598 Z.fixed := FALSE;
599 T.fixed := TRUE;
600 RUN tvdw.specify;
601 END specify;
602 METHOD values;
603 P := 12.0 {bar};
604 T := 298.15 {K};
605 RUN tvdw.values;
606 END values;
607
608 END testvdw;
609
610 MODEL testall;
611
612 P IS_A pressure;
613 T IS_A temperature;
614 Vvanderwaals, Vvdw, Videal, Vtruncvirial, Vrk, Vsrk, Vpeng IS_A molar_volume;
615 Zvanderwaals, Zvdw, Ztruncvirial, Zrk, Zsrk, Zpeng IS_A factor;
616
617 c1 IS_A symbol_constant;
618 c1 :== 'acetonitrile';
619 cd IS_A components_data([c1],c1);
620 Tr, Pr IS_A factor;
621 ig IS_A idealgas(P,T,Videal);
622 vd IS_A vanderwaals(P,T,Vvanderwaals,Zvanderwaals,cd.data[c1]);
623 vdd IS_A vdw(P,T,Vvdw,Zvdw,cd.data[c1]);
624 tve IS_A truncated_virial_equation(P,T,Vtruncvirial,Ztruncvirial,cd.data[c1]);
625 trk IS_A rk(P,T,Vrk,Zrk,cd.data[c1]);
626 tsrk IS_A srk(P,T,Vsrk,Zsrk,cd.data[c1]);
627 tpeng IS_A pengrobinson(P,T,Vpeng,Zpeng,cd.data[c1]);
628
629 eqTr: Tr = T/cd.data[c1].Tc;
630 eqPr: Pr = P/cd.data[c1].Pc;
631
632 METHODS
633 METHOD default_self;
634 (* RUN ClearAll; *)
635 RUN specify;
636 RUN values;
637 END default_self;
638 METHOD specify;
639 P.fixed := TRUE;
640 T.fixed := TRUE;
641 Videal.fixed := FALSE;
642 Vvanderwaals.fixed := FALSE;
643 Vvdw.fixed := FALSE;
644 Vtruncvirial.fixed := FALSE;
645 Vrk.fixed := FALSE;
646 Vsrk.fixed := FALSE;
647 Vpeng.fixed := FALSE;
648 Zvanderwaals.fixed := FALSE;
649 Zvdw.fixed := FALSE;
650 Ztruncvirial.fixed := FALSE;
651 Zrk.fixed := FALSE;
652 Zsrk.fixed := FALSE;
653 Zpeng.fixed := FALSE;
654 RUN ig.specify;
655 RUN vd.specify;
656 RUN vdd.specify;
657 RUN tve.specify;
658 RUN trk.specify;
659 RUN tsrk.specify;
660 RUN tpeng.specify;
661 END specify;
662 METHOD values;
663 P := 306.12 {atm};
664 T := 561 {K};
665 RUN ig.values;
666 RUN vd.values;
667 RUN vdd.values;
668 RUN tve.values;
669 RUN trk.values;
670 RUN tsrk.values;
671 RUN tpeng.values;
672 END values;
673
674 END testall;

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