Changeset 421 for trunk/eml/reactors/gibbs.mso
 Timestamp:
 Nov 29, 2007, 10:05:51 AM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/eml/reactors/gibbs.mso
r414 r421 18 18 * 19 19 * Description: 20 21 20 * Thermodynamic equilibrium modeling of a reactor using Gibbs 22 21 * free energy minimization approach. 23 24 * 25 22 * 26 23 * Assumptions: 27 24 * * single and twophases involved 28 25 * * thermodynamic equilibrium 29 30 26 * * steadystate 31 32 * 33 27 * 34 28 * Specify: 35 36 29 * * inlet stream 37 30 * * number of elements related to components 38 39 31 * * matrix of elements by components 40 41 32 * * equilibrium temperature 42 33 * … … 58 49 Brief = "Model of a generic vapourphase Gibbs CSTR"; 59 50 Info = " 60 Requires the information of: 61 * number of elements 62 * matrix of elements (elements by compoments) 51 == Assumptions == 52 * thermodynamic equilibrium 53 * steadystate 54 55 == Specify == 56 * inlet stream 57 * number of elements related to components 58 * matrix of elements by components 59 * equilibrium temperature 63 60 "; 64 61 … … 71 68 72 69 VARIABLES 73 out Outlet as vapour_stream ; # Outlet stream70 out Outlet as vapour_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}"); 74 71 75 72 G(NComp) as energy_mol (Brief="Gibbs freeenergy change of formation"); 76 lambda(NElem) as energy_mol (Brief="Lagrangian multiplier"); 77 activ(NComp) as Real (Brief="Activity", Lower=1e20); 78 phi(NComp) as fugacity (Brief="Fugacity coefficient", Default=1); 73 lambda(NElem) as energy_mol (Brief="Lagrangian multiplier", Symbol="\lambda"); 74 activ(NComp) as Real (Brief="Activity", Symbol="\hat{a}", Lower=1e20); 79 75 80 76 rate(NComp) as reaction_mol (Brief="Overall component rate of reaction"); 81 conv(NComp) as Real (Brief="Fractional conversion of component", Default=0);77 conv(NComp) as Real (Brief="Fractional conversion of component", Symbol="X", Default=0); 82 78 Fi(NComp) as flow_mol (Brief="Component molar flow rate"); 83 79 84 80 EQUATIONS 85 81 "Outlet stream" 86 Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*V ;82 Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Vr; 87 83 88 84 "Mechanical equilibrium" … … 105 101 106 102 # "Gibbs freeenergy of formation without Cp correction" 107 # G = PP.IdealGasGibbsOfFormationAt25C()*Outlet.T/To+PP.IdealGasEnthalpyOfFormationAt25C()*(1Outlet.T/To); 103 # G = PP.IdealGasGibbsOfFormationAt25C()*Outlet.T/To 104 # + PP.IdealGasEnthalpyOfFormationAt25C()*(1  Outlet.T/To); 108 105 109 106 for i in [1:NComp] … … 122 119 end 123 120 end 124 125 121 end 126 122 127 "Fugacity coefficient"128 phi = PP.VapourFugacityCoefficient(Outlet.T,Outlet.P,Outlet.z);129 130 123 "Activity" 131 activ = phi*Outlet.P*Outlet.z/fs; 124 activ = PP.VapourFugacityCoefficient(Outlet.T,Outlet.P,Outlet.z) 125 *Outlet.P*Outlet.z/fs; 132 126 end 133 127 … … 142 136 Brief = "Model of a generic liquidphase Gibbs CSTR"; 143 137 Info = " 144 Requires the information of: 145 * number of elements 146 * matrix of elements (elements by compoments) 138 == Assumptions == 139 * thermodynamic equilibrium 140 * steadystate 141 142 == Specify == 143 * inlet stream 144 * number of elements related to components 145 * matrix of elements by components 146 * equilibrium temperature 147 147 "; 148 148 … … 155 155 156 156 VARIABLES 157 out Outlet as liquid_stream ; # Outlet stream157 out Outlet as liquid_stream(Brief="Outlet stream", PosX=1, PosY=1, Symbol="_{out}"); 158 158 159 159 G(NComp) as energy_mol (Brief="Gibbs freeenergy change of formation"); 160 lambda(NElem) as energy_mol (Brief="Lagrangian multiplier"); 161 activ(NComp) as Real (Brief="Activity", Lower=0); 162 gamma(NComp) as fugacity (Brief="Activity coefficient", Default=1); 163 160 lambda(NElem) as energy_mol (Brief="Lagrangian multiplier", Symbol="\lambda"); 161 activ(NComp) as Real (Brief="Activity", Symbol="\hat{a}", Lower=0); 162 164 163 rate(NComp) as reaction_mol (Brief="Overall component rate of reaction"); 165 conv(NComp) as Real (Brief="Fractional conversion of component", Default=0);164 conv(NComp) as Real (Brief="Fractional conversion of component", Symbol="X", Default=0); 166 165 Fi(NComp) as flow_mol (Brief="Component molar flow rate"); 167 166 168 167 EQUATIONS 169 168 "Outlet stream" 170 Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*V ;169 Outlet.F*Outlet.z = Outletm.F*Outletm.z + rate*Vr; 171 170 172 171 "Mechanical equilibrium" … … 189 188 190 189 # "Gibbs freeenergy of formation without Cp correction" 191 # G = PP.IdealGasGibbsOfFormationAt25C()*Outlet.T/To+PP.IdealGasEnthalpyOfFormationAt25C()*(1Outlet.T/To); 190 # G = PP.IdealGasGibbsOfFormationAt25C()*Outlet.T/To 191 # + PP.IdealGasEnthalpyOfFormationAt25C()*(1  Outlet.T/To); 192 192 193 193 for i in [1:NComp] … … 206 206 end 207 207 end 208 209 208 end 210 209 211 "Activity coefficient"212 gamma = PP.LiquidFugacityCoefficient(Outlet.T,Outlet.P,Outlet.z);213 214 210 "Activity" 215 activ = gamma*Outlet.z*exp(PP.LiquidVolume(Outlet.T,Outlet.P,Outlet.z)*(Outlet.P  Ps)/Rg/Outlet.T); 211 activ = PP.LiquidFugacityCoefficient(Outlet.T,Outlet.P,Outlet.z)*Outlet.z 212 *exp(PP.LiquidVolume(Outlet.T,Outlet.P,Outlet.z)*(Outlet.P  Ps)/Rg/Outlet.T); 216 213 end
Note: See TracChangeset
for help on using the changeset viewer.