Page 62 - Process Modelling and Simulation With Finite Element Methods
P. 62
FEMLAB and the Basics of Numerical Analysis 49
The final MATLAB manipulation we will consider here is interrogation of
the finite element matrix. The f em structure does not hold the finite element
stiffness matrix, but rather contains the information necessary for FEMLAB
functions to construct it. This activity is a vital part of the finite element method,
and the FEMLAB function that does it is called assemble. Type in the
command below:
>> [K,L,M,N] =assemble (fem) ;
>>K/30
You should now see a MATLAB sparse representation of a matrix, all of the
elements of which are 1, -2, and 1, arranged on different diagonals. This is the
stiffness matrix of the finite element method, and up to the ordering of the
unknowns, is equivalent to (1.21). If you return to the Subdomain Settings,
element tab, and select Lagrange quadratic elements, and repeat the solution,
exporting FEM and assemble K as above, you will note that although sparse, the
matrix is distinctly different from the Lagrange linear elements.
Exercise
1.5 The coefficient form has a pde term a u. Repeat the implementation of the
reaction-diffusion example, but this time entering a = 0.833 andf=O for the
subdomain settings. Now compare the stationary linear and nonlinear solver
solutions. Can you explain why this formulation leads to this result? What
effect does this formulation of the problem have on the stiffness matrix K.
Can you think of a difficulty that might occur if the Da is chosen so that the
diagonal element is nearly zero in magnitude, i.e. Da Ax2 = 2?
1.5 Method 4: Linear Systems Analysis
Central to MATLAB, and hence to FEMLAB, is linear systems analysis. In this
section, we will briefly review the concepts of linear operator theory - typically
lumped as “matrix equations” in undergraduate engineering mathematics
modules. The good news is that it is not necessary to do any matrix
manipulations yourself. That was the ruison d’etre for MATLAB: to serve as a
user interface to libraries of subroutines for engineering matrix computations.
Much of the history of scientific computing is encapsulated in efficient and
sparse methods for matrix computations. An excellent guide to matrix
computations, but surely for experts, is the book of Golub and Van Loan [3].
However, at the introductory level to MATLAB, a good and readable survey can
be found in the up-to-date book by Hanselman and Littlefield [4].