Академический Документы
Профессиональный Документы
Культура Документы
Kathryn Gillow
22nd January 2007
FEM Motivation
Partial differential equations model a wide range of problems in biological and physical sciences.
FEM Motivation
Partial differential equations model a wide range of problems in biological and physical sciences. The most interesting (and realistic) PDE models are typically complex and cannot be solved analytically.
FEM Motivation
Partial differential equations model a wide range of problems in biological and physical sciences. The most interesting (and realistic) PDE models are typically complex and cannot be solved analytically. Need to resort to numerical methods to get an approximate solution to the PDE.
Model D Problem
Consider the ODE
Model D Problem
Consider the ODE
Model D Problem
Consider the ODE
Model D Problem
Consider the ODE
prescribe solution value, Dirichlet boundary condition; e.g. prescribe ux of solution value, Neumann boundary condition; e.g.
Model D Problem
Consider the ODE
prescribe solution value, Dirichlet boundary condition; e.g. prescribe ux of solution value, Neumann boundary condition; e.g.
Weak Formulation
(Also known as variational formulation or integral form.) Idea: multiply the equation by a (test) function and integrate over the range of interest. Gives
Weak Formulation
(Also known as variational formulation or integral form.) Idea: multiply the equation by a (test) function and integrate over the range of interest. Gives
for all
We have
Suppose and then we choose and . Then the weak formulation is: nd such that , and
with
and
We have
Suppose
and
then we have
We have
for all .
Suppose
and
such that
then we have
Suppose have
if
We have
and
then we
such that
and
for all
with
into subintervals FEM idea: split the interval (elements) and approximate the solution by a polynomial on each subinterval.
Nodes:
otherwise
1
0
i.e.
where
Example
Let
and
so we solve
in
with boundary conditions and . The exact solution is . The weak formulation is to nd such that and
for all
with
and
From
. . .
we get
. . .
Introduction to the Mathematics of the Finite Element Method p. 18/33
Introduction to the Mathematics of the Finite Element Method p. 19/33
Gives
Similarly
and
so let
Also
etc.
...
...
...
Introduction to the Mathematics of the Finite Element Method p. 23/33
Since we require we have that corresponds to removing rst column from matrix problem.
Since we require we have that corresponds to removing rst column from matrix problem.
we should Since the test functions must satisfy not use corresponds to removing rst row from matrix.
Since we require we have that corresponds to removing rst column from matrix problem.
we should Since the test functions must satisfy not use corresponds to removing rst row from matrix.
which can be , .
Matlab Code
% solve -u=1 on (0,1) with u(0)=0 and u(1)=0 using FEM N=4; % number of elements x=linspace(0,1,N+1); % set up mesh h=1/N; % h=constant mesh size K=zeros(N+1,N+1); % set up empty stiffness matrix f=zeros(N+1,1); % set up global load vector for i=1:N % loop over elements Kele=[1 -1;-1 1]/h; % compute entries in element stiffness matrix fele=[h/2;h/2]; % compute entries in element load vector K(i:i+1,i:i+1)=K(i:i+1,i:i+1)+Kele; % add to global stiffness matrix f(i:i+1)=f(i:i+1)+fele; % add to global load vector end K(1,:)=[]; % apply Dirichlet boundary condition by K(:,1)=[]; % removing first row and column of stiffness matr f(1)=[]; % and first row of load vector U=K\f; % compute solution to matrix problem U=[0;U]; % add value at x=0 to solution vector plot(x,U,rx-) % plot solution hold on fplot(x-0.5*x2,[0,1],b) % plot exact solution
Introduction to the Mathematics of the Finite Element Method p. 25/33
Results
0.5 FEM solution exact solution
0.4
0.3
0.2
0.1
0 0
0.2
0.4
0.6
0.8
References
K ENNETH E RIKSSON , D ON E STEP, P ETER H ANSBO & C LAES J OHNSON . Computational Differential Equations. CUP 1996. J.N. R EDDY. An Introduction to the Finite Element Method. McGraw Hill 1993. E NDRE S LI . Finite Element Methods for Partial Differential Equations. See
http://web.comlab.ox.ac.uk/oucl/work/endre.suli/fem.ps
1.5
0.5 2
2D Example
0.5
1.5
2D Weak Formulation
As before we multiply by interest to get
2D Weak Formulation
As before we multiply by interest to get
This might look a bit complicated but . . . . . . fortunately there are software packages which will do it all for you!!
2D Example: Solution
2
1.8
1.6
1.4
1.5
1.2
1
0.8
0.5
0.6
0 2
0.4
1.5 2 1 1 0.5 0.5 0 0 1.5
0.2
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
2D Adaptive Example
2
1.8
0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 2 1.5 1 1 0.5 0 0 0.5 1.5 2
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8