{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Set1Solutions - ChE 101 2012 Problem Set 1 Solutions 1(a i...

Info icon This preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
ChE 101 2012 Problem Set 1 Solutions 1. (a) i. function varargout = eulers_method ( ode_func , t0 , tf , n , y0 ) t = l i n s p a c e ( t0 , tf , n +1) ; y = zeros ( length ( y0 ) , n +1) ; y ( : , 1 ) = y0 ; h = ( tf - t0 ) / n ; f o r i = 1 : n y ( : , i +1) = y ( : , i ) + h * ode_func ( t ( i ) , y ( : , i ) ) ; end varargout = { y , t } ; ii. A. dc A dt = k b c B - k f c A dc B dt = k f c A - k B c B B. Based on conservation of mass, we know that at all times, c A + c B = c A, 0 + c B, 0 Substituting into the first ODE, we see that dc A dt + ( k f + k b ) c A = k b ( c A, 0 + c B, 0 ) We then define the following variables for convenience: ω k f + k b θ k b ( c A, 0 + c B, 0 ) This yields the simplified equation dc A dt + ωc A = θ To make the equation separable, we multiply by the integrating factor μ = e ωt 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The product rule then gives us the result d dt c A e ωt = θe ωt Integrating with initial condition c A (0) = c A, 0 , we find that c A e ωt - c A, 0 = θ ω ( e ωt - 1 ) c A ( t ) = c A, 0 - θ ω e - ωt + θ ω = k f c A, 0 - k b c B, 0 k f + k b e - ( k f + k b ) t + k b k f + k b ( c A, 0 + c B, 0 ) Based on overall mass conservation, we also know that c B ( t ) = c A, 0 + c B, 0 - c A ( t ) = k b c B, 0 - k f c A, 0 k f + k b e - ( k f + k b ) t + k f k f + k b ( c A, 0 + c B, 0 ) Notice that for t ( k f + k b ) - 1 , the system reaches an equilibrium with c A, eq = k b k f + k b ( c A, 0 + c B, 0 ) c B, eq = k f k f + k b ( c A, 0 + c B, 0 ) Furthermore, notice that c B, eq c A, eq = k f k b = K eq , so our kinetics are indeed consistent with thermodynamic equilibrium. C. Plots of the trajectories of species A and B are shown in Figure 1 below. For teaching purposes, the Matlab code used to generate the plot is shown below: c l e a r c l c c l o s e a l l s e t (0 , ' DefaultTextInterpreter ' , ' l a t e x ' ) t0 = 0 ; tf = 5 ; t = l i n s p a c e ( t0 , tf , 1000) ; kf = 1 ; kb = 1 ; cA0 = 75; cB0 = 25; cA = ( kf * cA0 - kb * cB0 ) /( kf + kb ) * exp ( - ( kf + kb ) * t ) + kb /( kf + kb ) * ( cA0 + cB0 ) ; cB = ( kb * cB0 - kf * cA0 ) /( kf + kb ) * exp ( - ( kf + kb ) * t ) + kf /( kf + kb ) * ( cA0 + cB0 ) ; f i g u r e ( ' Position ' , [ 0 240 800 600]) axes ( ' FontSize ' , 16) plot ( t , cA , t , cB ) a xi s tight x l a b e l ( ' Time ( seconds ) ' , ' FontSize ' , 18) y l a b e l ( ' Species Concentrations (M) ' , ' FontSize ' , 18) leg = legend ( ' A ' , ' B ' ) ; s e t ( leg , ' FontSize ' , 18) s e t ( leg , ' I n t e r p r e t e r ' , ' l a t e x ' ) s e t ( leg , ' Location ' , ' best ' ) s e t ( leg , ' Box ' , ' on ' ) 2
Image of page 2
0 1 2 3 4 5 25 30 35 40 45 50 55 60 65 70 75 Time (seconds) Species Concentrations (M) A B Figure 1: Analytical solution for the kinetics of reversible isomerization. iii. A comparison of the analytical solution and the results from Euler’s method is shown in Figure 2. Matlab code used to generate Figure 2 is shown below. tf = 1 ; odefunc = @ ( t , y ) [ kb * y (2) - kf * y (1) ; kf * y (1) - kb * y (2) ] ; n = 10; [ y_euler , t_euler ] = eulers_method ( odefunc , t0 , tf , n , [ cA0 ; cB0 ] ) ; t = l i n s p a c e ( t0 , tf , 1000) ; cA = ( kf * cA0 - kb * cB0 ) /( kf + kb ) * exp ( - ( kf + kb ) * t ) + kb /( kf + kb ) * ( cA0 + cB0 ) ; cB = ( kb * cB0 - kf * cA0 ) /( kf + kb ) * exp ( - ( kf + kb ) * t ) + kf /( kf + kb ) * ( cA0 + cB0 ) ; f i g u r e ( ' Position ' , [ 0 240 800 600]) axes ( ' FontSize ' , 14) plot ( t , cA , ' - b ' , t_euler , y_euler ( 1 , : ) , ' * b ' , t , cB , ' - r ' , t_euler , y_euler - ( 2 , : ) , ' * r ' ) a xi s tight x l a b e l ( ' Time ( seconds ) ' , ' FontSize ' , 16) y l a b e l ( ' Species Concentrations (M) ' , ' FontSize ' , 16) leg = legend ( '$ A $ ( a n a l y t i c a l s o l u t i o n ) ' , '$ A $ ( Euler ' ' s method ) ' , '$ B $ ( - a n a l y t i c a l s o l u t i o n ) ' , '$ B $ ( Euler ' ' s method ) ' ) ; s e t ( leg , ' FontSize ' , 14) 3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
0 0.2 0.4 0.6 0.8 1 25 30 35 40 45 50 55 60 65 70 75 Time (seconds) Species Concentrations (M) A (analytical solution) A (Euler’s method) B (analytical solution) B (Euler’s method) Figure 2: Simulation of isomerization kinetics using Euler’s method.
Image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern