In my last post, I said I had not been inclined to tackle the orthogonal collocation method. I became inclined.
I couldn't resist making a direct comparison of the computing times, and I wanted plots that contained results from both methods. Also, I have been meaning to learn the method for computation of effectiveness parameters.
Integration methods used with the collocation method
Mathcad has several integration methods, including methods for stiff systems. According to Finlayson (1980), the problem shown in the last posting is stiff near the hotspot. Therefore, I used the Radau and the BDF (backward difference formula) methods for stiff systems. I also used the Rkadapt routine which is an adaptive step size fourth order Runge-Kutta method. All methods worked and obtained the same answers.
The Radau and BDF methods use a Jacobian matrix of the derivative vector. Mathcad was used to obtain the symbolic definition of this matrix. It took 59 seconds to compute the Jacobian. However, this matrix needs to be computed just once in the worksheet. Multiple integrations can be conducted within the same worksheet without having to recalculate this matrix. Thus, the time to compute the Jacobian is not included in the integration times below.
The ODE integration routines all use adaptive step sizes. Values for the variables were saved for 100 axial points. For the hopscotch method, 400 axial steps were used, and 100 of those were used for the plots.
The collocation method used 6 interior radial collocation points. The weighting function used to determine the location of the points was W(x) = 1-x^2. For the hopscotch method, 21 radial points were used for the comparison below.
Polynomials in x squared were used for the collocation method due to the symmetry condition.
Comparison of computed results
The plots below show the direct comparisons for the radially averaged temperatures and conversion.
Finlayson reported that the analytical value of the conversion at Z = 0.6 is 0.92. The collocation method predicted 0.90 and the hopscotch method predicted 0.95. Thus, the errors were very comparable.
The plot above indicates some instability near the temperature peak with the orthogonal collocation method, even when using an ODE solver for stiff equations. The hopscotch method did not have that problem.
In the previous posting, I stated that Figure 5-11(a) in Finlayson showed a possible violation of the zero slope constraint at the centerline. The plot above shows that the constraint is satisfied at the Z = 0.5 location with collocation. It could be that the Finlayson plot did not accurately represent the computed results. Also, the Finlayson results appeared to use W = 1 for the weighting function. This conclusion was based on the locations of the collocation points.
The following times were obtained for the collocation method, using the indicated ODE solvers:
The Rkadapt routine performed surprisingly well.
The time for the hopscotch method was 0.12. (The 0.36 s reported previously for the hopscotch method may have been obtained while other tasks were being performed.)
The time differences should not be significant for most applications.
The orthogonal collocation method does not offer a great advantage in computation time or accuracy for the example problem.
With the current Mathcad 15 capability, the collocation method would require much more effort to set up the derivative matrix for a problem with multiple mass balances (i.e. species). This is not a problem with the hopscotch method which has a more natural indexing method. I have requested that the Mathcad program allow use of multiple vectors and scalars in ODE and PDE equations.
The collocation method, even with Finlayson's excellent book as a guide, had a huge cognition barrier for me, even after I understood the general principles. The method introduces many new variables and constants. Also, the method is not generic because different weighting factors and different polynomials are recommended based on the problem.
Mathcad makes computation of the collocation points and all of the matrices easy, once the problem has been setup. However, I don't see an easy way of automating the method to allow different number of collocation points. There are several manual steps currently involved in setting up (1) the determination of the collocation points and (2) the derivative matrix for the ODE problem.
Finlayson, B.A., Nonlinear Analysis in Chemical Eng., p. 192-206, McGraw-Hill (1980)
Finlayson, B.A. “Packed Bed Reactor Analysis by Orthogonal Collocation.” Chemical Engineering Science 26 (1971): 1081–1091.
The Finlayson (1971) reference is an article that discusses this same problem and variations.