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 77 2006-12-08 19:21:59Z paula $ |
---|
27 | *--------------------------------------------------------------------*# |
---|
28 | |
---|
29 | using "streams"; |
---|
30 | |
---|
31 | Model pfr |
---|
32 | PARAMETERS |
---|
33 | ext PP as CalcObject (Brief = "External Physical Properties"); |
---|
34 | ext NComp as Integer(Brief="Number of components"); |
---|
35 | NReac as Integer(Brief="Number of reactions"); |
---|
36 | stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix"); |
---|
37 | NDisc as Integer(Brief="Number of points of discretization", Default=10); |
---|
38 | Mw(NComp) as molweight (Brief="Component Mol Weight"); |
---|
39 | |
---|
40 | L as length(Brief="Reactor Length"); |
---|
41 | Across as area(Brief="Cross section area"); |
---|
42 | |
---|
43 | SET |
---|
44 | Mw = PP.MolecularWeight(); |
---|
45 | |
---|
46 | VARIABLES |
---|
47 | in Inlet as stream; |
---|
48 | out Outlet as stream; |
---|
49 | str(NDisc+1) as stream_therm; |
---|
50 | vel(NDisc+1) as velocity; |
---|
51 | vol(NDisc+1) as vol_mol; |
---|
52 | rho(NDisc+1) as dens_mass; |
---|
53 | |
---|
54 | q(NDisc) as heat_rate; |
---|
55 | M(NComp, NDisc) as mol (Brief = "Molar holdup"); |
---|
56 | Mt(NDisc) as mol (Brief = "Molar holdup"); |
---|
57 | C(NComp, NDisc) as conc_mol(Brief="Components concentration", Lower=-1e-6); |
---|
58 | E(NDisc) as energy (Brief="Total Energy Holdup on element"); |
---|
59 | |
---|
60 | r(NReac, NDisc) as reaction_mol; |
---|
61 | Hr(NReac, NDisc) as heat_reaction; |
---|
62 | |
---|
63 | EQUATIONS |
---|
64 | "Vapourisation Fraction" |
---|
65 | str.v = Inlet.v; |
---|
66 | |
---|
67 | "Inlet boundary" |
---|
68 | str(1).F = Inlet.F; |
---|
69 | str(1).T = Inlet.T; |
---|
70 | str(1).P = Inlet.P; |
---|
71 | str(1).z = Inlet.z; |
---|
72 | |
---|
73 | "Outlet boundary" |
---|
74 | Outlet.F = str(NDisc+1).F; |
---|
75 | Outlet.T = str(NDisc+1).T; |
---|
76 | Outlet.P = str(NDisc+1).P; |
---|
77 | Outlet.z = str(NDisc+1).z; |
---|
78 | Outlet.h = str(NDisc+1).h; |
---|
79 | Outlet.v = str(NDisc+1).v; |
---|
80 | |
---|
81 | for z in [1:NDisc] |
---|
82 | for c in [1:NComp-1] |
---|
83 | "Component Molar Balance" |
---|
84 | diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c)) |
---|
85 | + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc; |
---|
86 | end |
---|
87 | |
---|
88 | "Energy Balance" |
---|
89 | diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h + |
---|
90 | sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z); |
---|
91 | |
---|
92 | "Energy Holdup" |
---|
93 | E(z) = Mt(z)*str(z+1).h - str(z+1).P*Across*L/NDisc; |
---|
94 | |
---|
95 | "mass flow is considered constant" |
---|
96 | str(z+1).F*vol(z+1) = str(z).F*vol(z); # FIXME: is this correct? No (constant velocity: only for equimolar) |
---|
97 | #rho(z+1)*vel(z+1) = rho(z)*vel(z); # FIXME: this is correct! But does not converge. |
---|
98 | |
---|
99 | "Molar concentration" |
---|
100 | C(:,z) * Across*L/NDisc = M(:,z); |
---|
101 | |
---|
102 | "Sum of M" |
---|
103 | Mt(z) = sum(M(:,z)); |
---|
104 | |
---|
105 | "Geometrical constraint" |
---|
106 | Across*L/NDisc = Mt(z) * vol(z); |
---|
107 | |
---|
108 | "Molar fraction" |
---|
109 | str(z+1).z * Mt(z) = M(:,z); |
---|
110 | end |
---|
111 | |
---|
112 | for z in [1:NDisc+1] |
---|
113 | "Specific Volume" |
---|
114 | vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z); |
---|
115 | |
---|
116 | "Specific Mass" |
---|
117 | rho(z) = PP.VapourDensity(str(z).T, str(z).P, str(z).z); |
---|
118 | |
---|
119 | "Velocity" |
---|
120 | vel(z)*Across = str(z).F*vol(z); |
---|
121 | end |
---|
122 | end |
---|