source: trunk/eml/reactors/pfr.mso @ 858

Last change on this file since 858 was 858, checked in by gerson bicca, 14 years ago

updated pfr model

  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*----------------------------------------------------------------------
16* Author: Rafael de P. Soares and Paula B. Staudt
17* $Id: pfr.mso 858 2009-10-09 20:15:23Z bicca $
18*--------------------------------------------------------------------*#
19
20using "streams";
21
22Model pfr
23
24ATTRIBUTES
25
26        Pallete         = true;
27
28        Brief           = "Model of a Generic PFR with constant mass holdup";
29
30        Icon            = "icon/pfr";
31
32        Info            =
33
34"== Requires the information of ==
35
36* Reaction values
37
38* Heat of reaction
39
40* Pressure profile
41
42";
43
44
45
46PARAMETERS
47
48
49
50outer PP                                                        as Plugin               (Brief = "External Physical Properties", Type="PP");
51
52outer   NComp                                           as Integer              (Brief="Number of components");
53
54                NReac                                           as Integer              (Brief="Number of reactions");
55
56                stoic(NComp, NReac)     as Real                         (Brief = "Stoichiometric Matrix");
57
58                NDisc                                           as Integer              (Brief="Number of points of discretization", Default=10);
59
60                Mw(NComp)                               as molweight    (Brief="Component Mol Weight");
61
62                L                                                               as length               (Brief="Reactor Length");
63
64                Across                                          as area                 (Brief="Cross section area");
65
66
67
68SET
69
70       
71
72        Mw   = PP.MolecularWeight();
73
74
75
76VARIABLES
77
78
79
80in      Inlet   as stream       (Brief = "Inlet Stream", PosX=0, PosY=0.5076, Symbol="_{in}");
81
82out     Outlet  as stream       (Brief = "Outlet Stream", PosX=1, PosY=0.5236, Symbol="_{out}");
83
84
85
86        str(NDisc+1) as vapour_stream;
87
88        vol(NDisc+1) as vol_mol;
89
90        rho(NDisc+1) as dens_mass;
91
92       
93
94        q(NDisc)                                as heat_rate;
95
96
97
98        M(NComp, NDisc)         as mol                  (Brief = "Molar holdup");
99
100        Mt(NDisc)                       as mol                  (Brief = "Molar holdup");
101
102        C(NComp, NDisc)         as conc_mol     (Brief="Components concentration", Lower=-1e-6);
103
104        E(NDisc)                                as energy               (Brief="Total Energy Holdup on element");
105
106        r(NReac, NDisc)                 as reaction_mol;
107
108        Hr(NReac, NDisc)        as heat_reaction;
109
110        #Hf(NComp, NDisc)       as heat_reaction;
111
112
113
114EQUATIONS
115
116
117
118"Inlet boundary"
119
120        str(1).F = Inlet.F;
121
122        str(1).T = Inlet.T;
123
124        str(1).P = Inlet.P;
125
126        str(1).z = Inlet.z;
127
128
129
130"Outlet boundary"
131
132        Outlet.F = str(NDisc+1).F;
133
134        Outlet.T = str(NDisc+1).T;
135
136        Outlet.P = str(NDisc+1).P;
137
138        Outlet.z = str(NDisc+1).z;
139
140        Outlet.h = str(NDisc+1).h;
141
142        Outlet.v = str(NDisc+1).v;
143
144       
145
146        for z in [1:NDisc]
147
148                for c in [1:NComp]
149
150                        "Component Molar Balance"
151
152                        diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c))
153
154                                + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc;
155
156                end
157
158               
159
160                "Energy Balance"
161
162                diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h +
163
164                        sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z);
165
166
167
168                "Energy Holdup"
169
170                E(z) = Mt(z)*str(z+1).h - str(z+1).P*Across*L/NDisc;
171
172
173
174                "mass flow is considered constant"
175
176                str(z+1).F*vol(z+1)*rho(z+1) = str(z).F*vol(z)*rho(z);
177
178       
179
180                "Molar concentration"
181
182                C(:,z) * Across*L/NDisc = M(:,z);
183
184               
185
186                "Geometrical constraint"
187
188                Across*L/NDisc = Mt(z) * vol(z);
189
190
191
192                "Molar fraction"
193
194                str(z+1).z * Mt(z) = M(:,z);
195
196               
197
198                #Hf(:,z) = PP.IdealGasEnthalpyOfFormation(str(z+1).T);
199
200                #Hr(:,z) = -sum(stoic*Hf(:, z));
201
202        end
203
204
205
206        for z in [1:NDisc+1]
207
208                "Specific Volume"
209
210                vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z);
211
212               
213
214                "Specific Mass"
215
216                rho(z) = PP.VapourDensity(str(z).T, str(z).P, str(z).z);
217
218        end
219end
Note: See TracBrowser for help on using the repository browser.