Solving CSTR design equations
Posted February 18, 2013 at 09:00 AM | categories: nonlinear algebra | tags: reaction engineering
Updated March 06, 2013 at 04:29 PM
Given a continuously stirred tank reactor with a volume of 66,000 dm^3 where the reaction \(A \rightarrow B\) occurs, at a rate of \(-r_A = k C_A^2\) (\(k=3\) L/mol/h), with an entering molar flow of F_{A0} = 5 mol/h and a volumetric flowrate of 10 L/h, what is the exit concentration of A?
From a mole balance we know that at steady state \(0 = F_{A0} - F_A + V r_A\). That equation simply states the sum of the molar flow of A in in minus the molar flow of A out plus the molar rate A is generated is equal to zero at steady state. This is directly the equation we need to solve. We need the following relationship:
- \(F_A = v0 C_A\)
from scipy.optimize import fsolve Fa0 = 5.0 v0 = 10. V = 66000.0 # reactor volume L^3 k = 3.0 # rate constant L/mol/h def func(Ca): "Mole balance for a CSTR. Solve this equation for func(Ca)=0" Fa = v0 * Ca # exit molar flow of A ra = -k * Ca**2 # rate of reaction of A L/mol/h return Fa0 - Fa + V * ra # CA guess that that 90 % is reacted away CA_guess = 0.1 * Fa0 / v0 CA_sol, = fsolve(func, CA_guess) print 'The exit concentration is {0} mol/L'.format(CA_sol)
The exit concentration is 0.005 mol/L
It is a little confusing why it is necessary to put a comma after the CA_sol in the fsolve command. If you do not put it there, you get brackets around the answer.
Copyright (C) 2013 by John Kitchin. See the License for information about copying.