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 | * Model of a Generic PFR with constant mass holdup |
---|
17 | *-------------------------------------------------------------------- |
---|
18 | * |
---|
19 | * - Requires the information of: |
---|
20 | * * Reaction values |
---|
21 | * * Heat of reaction |
---|
22 | * * Pressure profile |
---|
23 | * |
---|
24 | *---------------------------------------------------------------------- |
---|
25 | * Author: Rafael de P. Soares and Paula B. Staudt |
---|
26 | * $Id: pfr.mso 194 2007-03-07 19:38:30Z rafael $ |
---|
27 | *--------------------------------------------------------------------*# |
---|
28 | |
---|
29 | using "streams"; |
---|
30 | |
---|
31 | Model pfr |
---|
32 | |
---|
33 | ATTRIBUTES |
---|
34 | Pallete = true; |
---|
35 | Brief = "Brief"; |
---|
36 | Info = |
---|
37 | "write some information"; |
---|
38 | |
---|
39 | PARAMETERS |
---|
40 | |
---|
41 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
42 | outer NComp as Integer (Brief="Number of components"); |
---|
43 | NReac as Integer (Brief="Number of reactions"); |
---|
44 | stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix"); |
---|
45 | NDisc as Integer (Brief="Number of points of discretization", Default=10); |
---|
46 | Mw(NComp) as molweight (Brief="Component Mol Weight"); |
---|
47 | L as length (Brief="Reactor Length"); |
---|
48 | Across as area (Brief="Cross section area"); |
---|
49 | |
---|
50 | SET |
---|
51 | |
---|
52 | Mw = PP.MolecularWeight(); |
---|
53 | |
---|
54 | VARIABLES |
---|
55 | |
---|
56 | in Inlet as stream (Brief = "Inlet Stream"); |
---|
57 | out Outlet as stream (Brief = "Outlet Stream"); |
---|
58 | |
---|
59 | str(NDisc+1) as streamPH; |
---|
60 | vel(NDisc+1) as velocity; |
---|
61 | vol(NDisc+1) as vol_mol; |
---|
62 | rho(NDisc+1) as dens_mass; |
---|
63 | |
---|
64 | q(NDisc) as heat_rate; |
---|
65 | M(NComp, NDisc) as mol (Brief = "Molar holdup"); |
---|
66 | Mt(NDisc) as mol (Brief = "Molar holdup"); |
---|
67 | C(NComp, NDisc) as conc_mol (Brief="Components concentration", Lower=-1e-6); |
---|
68 | E(NDisc) as energy (Brief="Total Energy Holdup on element"); |
---|
69 | r(NReac, NDisc) as reaction_mol; |
---|
70 | Hr(NReac, NDisc) as heat_reaction; |
---|
71 | |
---|
72 | EQUATIONS |
---|
73 | |
---|
74 | "Inlet boundary" |
---|
75 | str(1).F = Inlet.F; |
---|
76 | str(1).T = Inlet.T; |
---|
77 | str(1).P = Inlet.P; |
---|
78 | str(1).z = Inlet.z; |
---|
79 | |
---|
80 | "Outlet boundary" |
---|
81 | Outlet.F = str(NDisc+1).F; |
---|
82 | Outlet.T = str(NDisc+1).T; |
---|
83 | Outlet.P = str(NDisc+1).P; |
---|
84 | Outlet.z = str(NDisc+1).z; |
---|
85 | Outlet.h = str(NDisc+1).h; |
---|
86 | Outlet.v = str(NDisc+1).v; |
---|
87 | |
---|
88 | for z in [1:NDisc] |
---|
89 | for c in [1:NComp-1] |
---|
90 | "Component Molar Balance" |
---|
91 | diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c)) |
---|
92 | + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc; |
---|
93 | end |
---|
94 | |
---|
95 | "Energy Balance" |
---|
96 | diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h + |
---|
97 | sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z); |
---|
98 | |
---|
99 | "Energy Holdup" |
---|
100 | E(z) = Mt(z)*str(z+1).h - str(z+1).P*Across*L/NDisc; |
---|
101 | |
---|
102 | "mass flow is considered constant" |
---|
103 | str(z+1).F*vol(z+1) = str(z).F*vol(z); # FIXME: is this correct? No (constant velocity: only for equimolar) |
---|
104 | #rho(z+1)*vel(z+1) = rho(z)*vel(z); # FIXME: this is correct! But does not converge. |
---|
105 | |
---|
106 | "Molar concentration" |
---|
107 | C(:,z) * Across*L/NDisc = M(:,z); |
---|
108 | |
---|
109 | "Sum of M" |
---|
110 | Mt(z) = sum(M(:,z)); |
---|
111 | |
---|
112 | "Geometrical constraint" |
---|
113 | Across*L/NDisc = Mt(z) * vol(z); |
---|
114 | |
---|
115 | "Molar fraction" |
---|
116 | str(z+1).z * Mt(z) = M(:,z); |
---|
117 | end |
---|
118 | |
---|
119 | for z in [1:NDisc+1] |
---|
120 | "Specific Volume" |
---|
121 | vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z); |
---|
122 | |
---|
123 | "Specific Mass" |
---|
124 | rho(z) = PP.VapourDensity(str(z).T, str(z).P, str(z).z); |
---|
125 | |
---|
126 | "Velocity" |
---|
127 | vel(z)*Across = str(z).F*vol(z); |
---|
128 | end |
---|
129 | end |
---|