In this problem, we will look at the convergence of the solution to a boundary value problem
Question:
In this problem, we will look at the convergence of the solution to a boundary value problem as a function of the grid spacing. Consider the reaction–diffusion equation
where the spatially dependent reaction term is
The boundary conditions for the problem are c(−1) = 1 and c(1) = 0.5.
You should write a MATLAB code that solves this problem using centered finite differences for grid spacings Δx = 1/2, 1/4, . . . , 1/1024. For the smallest value of Δx = Δxmin, make a plot of the concentration versus position. We will estimate the error in the solution by comparing the value of the solution at x = 0 for the different values of Δx. Define the error of the solution as
In other words, lets assume that the finest grid spacing corresponds to a “perfect” solution and assess the fractional error at the other values of x. Make a semilog-x plot of ϵ versus Δx.
Step by Step Answer:
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis