1 | #*--------------------------------------------------------------------- |
---|
2 | * This file is property of the author and cannot be used, copyed |
---|
3 | * or modified without permission. |
---|
4 | * |
---|
5 | * Copyright (C) 2004 the author |
---|
6 | *---------------------------------------------------------------------- |
---|
7 | * Author: Rafael de P. Soares |
---|
8 | * Paula B. Staudt |
---|
9 | * $Id: cstr.mso 1 2006-06-20 17:33:53Z rafael $ |
---|
10 | *--------------------------------------------------------------------*# |
---|
11 | |
---|
12 | using "streams"; |
---|
13 | |
---|
14 | #* |
---|
15 | * Generic PFR model with constant mass holdup |
---|
16 | * |
---|
17 | * Requires the information of: |
---|
18 | * - Reaction values |
---|
19 | * - Heat of reaction |
---|
20 | * - Pressure profile |
---|
21 | *# |
---|
22 | Model pfr |
---|
23 | PARAMETERS |
---|
24 | ext PP as CalcObject (Brief = "External Physical Properties"); |
---|
25 | ext NComp as Integer(Brief="Number of components"); |
---|
26 | NReac as Integer(Brief="Number of reactions"); |
---|
27 | stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix"); |
---|
28 | NDisc as Integer(Brief="Number of points of discretization", Default=10); |
---|
29 | Mw(NComp) as molweight (Brief="Component Mol Weight"); |
---|
30 | |
---|
31 | L as length(Brief="Reactor Length"); |
---|
32 | Across as area(Brief="Cross section area"); |
---|
33 | |
---|
34 | SET |
---|
35 | Mw = PP.MolecularWeight(); |
---|
36 | |
---|
37 | VARIABLES |
---|
38 | in Inlet as stream; |
---|
39 | out Outlet as stream; |
---|
40 | str(NDisc+1) as stream_therm; |
---|
41 | vel(NDisc+1) as velocity; |
---|
42 | vol(NDisc+1) as vol_mol; |
---|
43 | rho(NDisc+1) as dens_mass; |
---|
44 | |
---|
45 | q(NDisc) as heat_rate; |
---|
46 | M(NComp, NDisc) as mol (Brief = "Molar holdup"); |
---|
47 | C(NComp, NDisc) as conc_mol(Brief="Components concentration"); |
---|
48 | E(NDisc) as energy (Brief="Total Energy Holdup on element"); |
---|
49 | |
---|
50 | r(NReac, NDisc) as reaction_mol; |
---|
51 | Hr(NReac, NDisc) as heat_reaction; |
---|
52 | |
---|
53 | EQUATIONS |
---|
54 | "Vapourisation Fraction" |
---|
55 | str.v = Inlet.v; |
---|
56 | |
---|
57 | "Inlet boundary" |
---|
58 | str(1).F = Inlet.F; |
---|
59 | str(1).T = Inlet.T; |
---|
60 | str(1).P = Inlet.P; |
---|
61 | str(1).z = Inlet.z; |
---|
62 | |
---|
63 | "Outlet boundary" |
---|
64 | Outlet.F = str(NDisc+1).F; |
---|
65 | Outlet.T = str(NDisc+1).T; |
---|
66 | Outlet.P = str(NDisc+1).P; |
---|
67 | Outlet.z = str(NDisc+1).z; |
---|
68 | Outlet.h = str(NDisc+1).h; |
---|
69 | Outlet.v = str(NDisc+1).v; |
---|
70 | |
---|
71 | for z in [1:NDisc] |
---|
72 | for c in [1:NComp] |
---|
73 | "Component Molar Balance" |
---|
74 | diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c)) |
---|
75 | + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc; |
---|
76 | end |
---|
77 | |
---|
78 | "Energy Balance" |
---|
79 | diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h + |
---|
80 | sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z); |
---|
81 | |
---|
82 | "Energy Holdup" |
---|
83 | E(z) = sum(M(:,z))*str(z+1).h - str(z+1).P*Across*L/NDisc; |
---|
84 | |
---|
85 | "mass flow is considered constant" |
---|
86 | str(z+1).F*vol(z+1) = str(z).F*vol(z); # FIXME: is this correct? No (constant velocity: only for equimolar) |
---|
87 | # rho(z+1)*vel(z+1) = rho(z)*vel(z); # FIXME: this is correct! But does not converge. |
---|
88 | |
---|
89 | "Molar concentration" |
---|
90 | C(:,z) * Across*L/NDisc = M(:,z); |
---|
91 | |
---|
92 | "Molar fraction" |
---|
93 | str(z+1).z = C(:,z) * vol(z+1); |
---|
94 | end |
---|
95 | |
---|
96 | for z in [1:NDisc+1] |
---|
97 | "Specific Volume" |
---|
98 | vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z); |
---|
99 | |
---|
100 | "Specific Mass" |
---|
101 | rho(z) = sum(str(z).z*Mw)/vol(z); |
---|
102 | |
---|
103 | "Velocity" |
---|
104 | vel(z)*Across = str(z).F*vol(z); |
---|
105 | end |
---|
106 | end |
---|