'UnboundLocalError: local variable 'rmeff' referenced before assignment
Hey I'm trying to compute the concentration of a tubular reactor with two reaction, I get this error thrown each time I run the code, I tried putting the variable in the function as global still doesnt work
RmCO = (KmCO * Cb**q * Cd**p)
RmCO2 = (KmCO2 * Ca**n * Cb**m)
Phi = (Dp/6)* np.sqrt(((kp+1)/kp)*(KmCO2 * RhoParticle/DCO2eff))
eff = (np.tanh(Phi))/Phi
MR = ((RmCO2/1000)*RhoParticle*Dmean*(n+m))/(beta*Ca)
WP = ((Phi*(1/np.tanh(Phi)))-1)*3
rmpore = 1/(eff*RmCO2)
rmex = 1/(beta*Amext*(Ca-np.real(COeq)))
rmeff = 1/(rmex+rmpore)
RmCOeff = 1/(1/(0.001*RmCO))
rCO2 = - rmeff
rH2 = - ((b/a) * rmeff) - (3 * RmCOeff)
rCO = ((c/a) * rmeff) - RmCOeff
rH2O = ((d/a) * rmeff) + RmCOeff
rCH4 = RmCOeff
dCO2dz = (RhoBulk * rCO2) / Us
dH2dz = (RhoBulk * rH2) / Us
dCOdz = (RhoBulk * rCO) / Us
dH2Odz = (RhoBulk * rH2O) / Us
dCH4dz = (RhoBulk * rCH4) / Us
ReH = (Us*Dp)/Kinematic_viscosity
Cpavg= (CpCO2(T)*(a/(a+b)) + CpH2(T)*(b/(a+b))) / 4 #conversion of Kj/kg.k to j/kg.K
Pr = mue(T) * Cpavg / thermalC(T)
U = 0.504 * ((thermalC(T)/Dp) * ((ReH)**0.67) * ((Pr)**0.4) * ((Dp/Di)**0.375))
G = Rho_mix*Us
Ua = (U * (4/Do))
Tw = (950 + 273)
dTdz = ((-rmeff * DelH(T)* RhoBulk) - (Ua*(T-Tw)))/(G*Cpavg)
return [dTdz,dCO2dz,dH2dz,dCOdz,dH2Odz,dCH4dz]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
