- Timestamp:
- Oct 9, 2009, 5:15:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/eml/reactors/pfr.mso
r354 r858 23 23 24 24 ATTRIBUTES 25 25 26 Pallete = true; 27 26 28 Brief = "Model of a Generic PFR with constant mass holdup"; 29 27 30 Icon = "icon/pfr"; 31 28 32 Info = 33 29 34 "== Requires the information of == 35 30 36 * Reaction values 37 31 38 * Heat of reaction 39 32 40 * Pressure profile 41 33 42 "; 34 43 44 45 35 46 PARAMETERS 36 47 48 49 37 50 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 51 38 52 outer NComp as Integer (Brief="Number of components"); 53 39 54 NReac as Integer (Brief="Number of reactions"); 55 40 56 stoic(NComp, NReac) as Real (Brief = "Stoichiometric Matrix"); 57 41 58 NDisc as Integer (Brief="Number of points of discretization", Default=10); 59 42 60 Mw(NComp) as molweight (Brief="Component Mol Weight"); 61 43 62 L as length (Brief="Reactor Length"); 63 44 64 Across as area (Brief="Cross section area"); 45 65 66 67 46 68 SET 47 69 70 71 48 72 Mw = PP.MolecularWeight(); 49 73 74 75 50 76 VARIABLES 51 77 78 79 52 80 in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5076, Symbol="_{in}"); 81 53 82 out Outlet as stream (Brief = "Outlet Stream", PosX=1, PosY=0.5236, Symbol="_{out}"); 54 83 55 str(NDisc+1) as streamPH; 56 vel(NDisc+1) as velocity; 84 85 86 str(NDisc+1) as vapour_stream; 87 57 88 vol(NDisc+1) as vol_mol; 89 58 90 rho(NDisc+1) as dens_mass; 59 91 92 93 60 94 q(NDisc) as heat_rate; 95 96 97 61 98 M(NComp, NDisc) as mol (Brief = "Molar holdup"); 99 62 100 Mt(NDisc) as mol (Brief = "Molar holdup"); 101 63 102 C(NComp, NDisc) as conc_mol (Brief="Components concentration", Lower=-1e-6); 103 64 104 E(NDisc) as energy (Brief="Total Energy Holdup on element"); 105 65 106 r(NReac, NDisc) as reaction_mol; 107 66 108 Hr(NReac, NDisc) as heat_reaction; 67 109 110 #Hf(NComp, NDisc) as heat_reaction; 111 112 113 68 114 EQUATIONS 69 115 116 117 70 118 "Inlet boundary" 119 71 120 str(1).F = Inlet.F; 121 72 122 str(1).T = Inlet.T; 123 73 124 str(1).P = Inlet.P; 125 74 126 str(1).z = Inlet.z; 75 127 128 129 76 130 "Outlet boundary" 131 77 132 Outlet.F = str(NDisc+1).F; 133 78 134 Outlet.T = str(NDisc+1).T; 135 79 136 Outlet.P = str(NDisc+1).P; 137 80 138 Outlet.z = str(NDisc+1).z; 139 81 140 Outlet.h = str(NDisc+1).h; 141 82 142 Outlet.v = str(NDisc+1).v; 83 84 for z in [1:NDisc] 85 for c in [1:NComp-1] 143 144 145 146 for z in [1:NDisc] 147 148 for c in [1:NComp] 149 86 150 "Component Molar Balance" 151 87 152 diff(M(c,z)) = (str(z).F*str(z).z(c) - str(z+1).F*str(z+1).z(c)) 153 88 154 + sum(stoic(c,:)*r(:, z)) * Across*L/NDisc; 155 89 156 end 90 157 158 159 91 160 "Energy Balance" 161 92 162 diff(E(z)) = str(z).F*str(z).h - str(z+1).F*str(z+1).h + 163 93 164 sum(Hr(:,z)*r(:,z)) * Across*L/NDisc - q(z); 94 165 166 167 95 168 "Energy Holdup" 169 96 170 E(z) = Mt(z)*str(z+1).h - str(z+1).P*Across*L/NDisc; 97 171 172 173 98 174 "mass flow is considered constant" 99 str(z+1).F*vol(z+1) = str(z).F*vol(z); # FIXME: is this correct? No (constant velocity: only for equimolar) 100 #rho(z+1)*vel(z+1) = rho(z)*vel(z); # FIXME: this is correct! But does not converge. 101 175 176 str(z+1).F*vol(z+1)*rho(z+1) = str(z).F*vol(z)*rho(z); 177 178 179 102 180 "Molar concentration" 181 103 182 C(:,z) * Across*L/NDisc = M(:,z); 104 105 "Sum of M" 106 Mt(z) = sum(M(:,z)); 107 183 184 185 108 186 "Geometrical constraint" 187 109 188 Across*L/NDisc = Mt(z) * vol(z); 110 189 190 191 111 192 "Molar fraction" 193 112 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 113 202 end 114 203 115 for z in [1:NDisc+1] 204 205 206 for z in [1:NDisc+1] 207 116 208 "Specific Volume" 209 117 210 vol(z) = PP.VapourVolume(str(z).T, str(z).P, str(z).z); 118 211 212 213 119 214 "Specific Mass" 215 120 216 rho(z) = PP.VapourDensity(str(z).T, str(z).P, str(z).z); 121 217 122 "Velocity"123 vel(z)*Across = str(z).F*vol(z);124 218 end 125 219 end
Note: See TracChangeset
for help on using the changeset viewer.