This problem consists of three numerical calculations that involve the coupled reactiondiffusion system where D A and

Question:

This problem consists of three numerical calculations that involve the coupled reaction–diffusion systemdCA DA dx d-CB DB- dx = k1CA - KCB -K1CA + KCB

where DA and DB are the diffusion coefficients for species A and B, respectively, and k1 and kare reaction rates. The boundary conditions for these equations areCA(X= 0) = 0 CB(x = 0) = 1 dc A dx = 0 at (x = 1)

dcB dx = 0 at (x1)

You will write three different programs for this problem, but each one builds on the previous one. It may be helpful to copy-and-paste between programs.

(a) Write a MATLAB program that computes the composition as a function of position using centered finite differences with DA = 2, DB = 1, k1 = 9, and k2 = 10. What are all of the equations that you will need in the numerical solution? For the numerical solution, use a sparse matrix, especially if you want to use a large number of grid points. Your program should automatically plot the concentrations of A and B as a function of position.

(b) While the concentrations are fixed at the left boundary, the concentrations at the right boundary are harder to predict. In this problem, develop a bracketing method that determines the value of k2 = k2 such that cA(x = 1) = cB(x = 1) for DA = DB = 1 and k1 = 10. In this bracketing method, you should pick some value of k2 and use the integration method from part (a) to compute the values of cA and cB at the right boundary. If the ratio of concentrations cA/cB is not within to 1 ± 10−6, your program should update the value of k2 in some intelligent manner until it converges to within the latter tolerance. There are many ways to design this bracketing method, so this is an opportunity for you to demonstrate your creativity in the numerical method. Explain how your bracketing method works and report the value of k2 that gives equal concentrations at x = 1.

(c) Use the programs from the previous two problems to explore how the value of k2 depends on the diffusion coefficient DB with DA = 1 and k1 = 10. Copying from the programs you have already written, make a new MATLAB file that loops through the values DB = 0.1, 0.2, . . . , 10 and automatically determines the corresponding value of k2. Your program should also plot k2 versus DB.


Data from Problem 23

Write a MATLAB program that uses finite difference to solvedy dx = xy

on x ∈ [0, 1] subject to y(0) = 1 and y′(1) = 0 anddx2 = Sp

on x ∈ [0, 1] subject to y(0) = 1 and y′(1) = 0. Use the solution to the linear problem, y″ = x3y as the initial guess. Your program should plot the solutions to both the linear and the nonlinear problems on the same graph.


Data from Problem 22

Write a MATLAB program that solves the coupled system of equationsdx dz d'y dz = xey = x+y

subject to x(1) = 0.8, y(1) = 1, dx/dz = 0 at z = 0, and dy/dz = x at z = 0 using interleaved variables. Your program should generate a plot of x(z) and y(z).

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: