/[ascend]/trunk/models/phases.a4l
ViewVC logotype

Contents of /trunk/models/phases.a4l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2651 - (show annotations) (download) (as text)
Thu Dec 13 07:29:48 2012 UTC (11 years, 6 months ago) by jpye
File MIME type: text/x-ascend
File size: 6282 byte(s)
Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)
1 REQUIRE "system.a4l";
2 (* => system.a4l, basemodel.a4l *)
3 PROVIDE "phases.a4l";
4
5 (*
6 * phases.a4l
7 * by Arthur W. Westerberg
8 * Part of the ASCEND Library
9 * $Date: 1998/06/17 19:16:57 $
10 * $Revision: 1.3 $
11 * $Author: mthomas $
12 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/phases.a4l,v $
13 *
14 * This file is part of the ASCEND Modeling Library.
15 *
16 * Copyright (C) 1998 Arthur W Westerberg
17 *
18 * The ASCEND Modeling Library is free software; you can redistribute
19 * it and/or modify it under the terms of the GNU General Public
20 * License as published by the Free Software Foundation; either
21 * version 2 of the License, or (at your option) any later version.
22 *
23 * The ASCEND Modeling Library is distributed in hope that it will be
24 * useful, but WITHOUT ANY WARRANTY; without even the implied
25 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26 * See the GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 *)
31
32 (*
33 * This model establishes the symbolic information needed by streams
34 * and holdups for the phases they contain, based on the information
35 * with which the user parameterizes this model.
36 *)
37
38 MODEL phases_data(
39 phase_indicator IS_A symbol_constant;
40 vapor_option IS_A symbol_constant;
41 liquid1_option IS_A symbol_constant;
42 liquid2_option IS_A symbol_constant;
43 ) WHERE(
44 (* The next 3 conditions limit to models supported in thermo.a4l.
45 * as models for new correlations, solid phases, and so forth
46 * are added to thermo.a4l, this should be expanded.
47 *)
48 (phase_indicator IN ['M','V','L','VL','LL','VLL']) == TRUE;
49 (vapor_option IN
50 ['Pitzer_vapor_mixture','ideal_vapor_mixture','none']) == TRUE;
51 (liquid1_option IN
52 ['Wilson_liquid_mixture', 'UNIFAC_liquid_mixture', 'none']) == TRUE;
53
54 (* Note: The Wilson method cannot predict a second liquid phase *)
55 ((liquid1_option IN ['Wilson_liquid_mixture']) AND
56 (phase_indicator IN ['LL','VLL'])) == FALSE;
57 (liquid2_option IN ['UNIFAC_liquid_mixture', 'none']) == TRUE;
58
59 (* not all combinations involving 'none' are legal. *)
60 ((phase_indicator == 'M') AND
61 (vapor_option == 'none') AND
62 (liquid1_option == 'none') AND (liquid2_option == 'none'))
63 OR
64 ((phase_indicator == 'V') AND
65 (liquid1_option == 'none') AND
66 (liquid2_option == 'none'))
67 OR
68 ((phase_indicator == 'L') AND
69 (vapor_option == 'none') AND (liquid2_option == 'none'))
70 OR
71 ((phase_indicator == 'VL') AND (liquid2_option == 'none'))
72 OR
73 ((phase_indicator == 'LL') AND (vapor_option == 'none'))
74 OR
75 ((phase_indicator == 'VLL') AND (
76 ('none' IN [vapor_option,liquid1_option,liquid2_option]) == FALSE))
77 ;
78 (*
79 *)
80
81 (* Note: at present the thermodynamics models do not have
82 * correlations that will support a complete LLE calculation,
83 * so VLL is diabled until we get models that do.
84 * If you create such models, remove the next condition.
85 *)
86 (phase_indicator IN ['LL','VLL']) == FALSE;
87 );
88
89 (*
90 * typical examples of use --
91 * pd IS_A phases_data('M', 'none', 'none', 'none');
92 * pd IS_A phases_data('V', 'Pitzer_vapor_mixture', 'none', 'none');
93 * pd IS_A phases_data('VL', 'Pitzer_vapor_mixture',
94 * 'Wilson_liquid_mixture','none');
95 * pd IS_A phases_data('VLL', 'Pitzer', 'UNIFAC_liquid_mixture',
96 * 'UNIFAC_liquid_mixture');
97 *)
98
99 phases IS_A set OF symbol_constant;
100 reference_phase IS_A symbol_constant;
101
102 SELECT (phase_indicator)
103 CASE 'M':
104 phases :== ['material'];
105 reference_phase :== 'material';
106 CASE 'V':
107 phases :== ['vapor'];
108 reference_phase :== 'vapor';
109 CASE 'L':
110 phases :== ['liquid1'];
111 reference_phase :== 'liquid1';
112 CASE 'VL':
113 phases :== ['vapor','liquid1'];
114 reference_phase :== 'liquid1';
115 CASE 'LL':
116 phases :== ['liquid1','liquid2'];
117 reference_phase :== 'liquid1';
118 CASE 'VLL':
119 phases :== ['vapor','liquid1','liquid2'];
120 reference_phase :== 'liquid1';
121 END SELECT;
122
123 phase_type[phases] IS_A symbol_constant;
124
125 SELECT (phase_indicator)
126 CASE 'M':
127 phase_type['material'] :== vapor_option;
128 CASE 'V':
129 phase_type['vapor'] :== vapor_option;
130 CASE 'L':
131 phase_type['liquid1'] :== liquid1_option;
132 CASE 'VL':
133 phase_type['vapor'] :== vapor_option;
134 phase_type['liquid1'] :== liquid1_option;
135 CASE 'LL':
136 phase_type['liquid1'] :== liquid1_option;
137 phase_type['liquid2'] :== liquid2_option;
138 CASE 'VLL':
139 phase_type['vapor'] :== vapor_option;
140 phase_type['liquid1'] :== liquid1_option;
141 phase_type['liquid2'] :== liquid2_option;
142 END SELECT;
143
144 other_phases IS_A set OF symbol_constant;
145 other_phases :== [phases - [reference_phase]];
146
147 METHODS
148 (* No clear, specify, reset methods are needed here
149 * as all items are constants. But we are setting a
150 * rigorous example of how to MODEL, so here they are.
151 *)
152
153 METHOD check_self;
154 END check_self;
155 METHOD check_all;
156 END check_all;
157 METHOD default_self;
158 END default_self;
159 METHOD default_all;
160 END default_all;
161 METHOD specify;
162 END specify;
163 METHOD scale_self;
164 END scale_self;
165 METHOD scale_all;
166 END scale_all;
167 METHOD bound_self;
168 END bound_self;
169 METHOD bound_all;
170 END bound_all;
171
172 END phases_data;
173
174 MODEL test_phases_data REFINES testcmumodel;
175 (* the following 3 models should all build properly. *)
176 pass1 IS_A phases_data('M', 'none', 'none', 'none');
177 pass2 IS_A phases_data('V', 'Pitzer_vapor_mixture', 'none', 'none');
178 pass3 IS_A phases_data('VL', 'Pitzer_vapor_mixture',
179 'Wilson_liquid_mixture','none');
180
181 (* and the rest should fail *)
182 fail4 IS_A phases_data('VLL', 'Pitzer_vapor_mixture',
183 'UNIFAC_liquid_mixture',
184 'UNIFAC_liquid_mixture');
185 fail5 IS_A phases_data('M', 'Pitzer_vapor_mixture',
186 'UNIFAC_liquid_mixture',
187 'UNIFAC_liquid_mixture');
188 fail6 IS_A phases_data('VL', 'Pitzer_vapor_mixture',
189 'none', 'UNIFAC_liquid_mixture');
190 (* we really should put in all 20 or so other failures, but
191 * it's tedious and pointless.
192 *)
193
194 METHODS
195 (* for completeness *)
196 METHOD values;
197 (* everything is currently a constant, so nothing to do. *)
198 END values;
199 END test_phases_data;

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