Assign 2 Sol
Assign 2 Sol
(0, )
(1)
Such that = 0 1 = | 1 =
= 2 = | 2 = Weak Formulation Given a(x) =1, b(x) = 0, c(x) =1, e1 =d2 =0, d1 =e2 =1, g =0, h =-1, (x) =0; (1) becomes
2 2
+ = 0
0 < <
(2)
Such that = 0 = 0 = 0 = 0
Multiplying (2) with a test function w(x) and integrating over the domain 0 < x <
2 + = 0 2
2 2 +
0
= 0
0 0
| 0
= 0
0
0 0
= 0
(3)
Since we already know the value at u (), w () = 0. Also from the natural boundary condition u (0) = 0. So (3) reduces to
0
= 0
(4)
( )2 < , = 1
( )2 < , = 0
= 0
0
Galerkin Formulation
The weak form of the problem can be written as , = 0 Where , =
0
(5)
Let and such that = 1, = 0 and = 1. Therefore (5) becomes , = 0 Substituting = + in the above equation we get , = , Hence the galerkin form of the problem is For equation 2 find = + where , such that for all , = , (6)
Results
Following are the results of the Finite Element code implemented for the above galerkin form in MATLAB
Number of elements=10
Comparison of FEM and Exact Solution 1 0.8 0.6 0.4 0.2 FEM Exact
u(x)
0.5
1.5 x
2.5
Number of elements=20
Comparison of FEM and Exact Solution 1 0.8 0.6 0.4 0.2 FEM Exact
u(x)
0.5
1.5 x
2.5
Number of elements=100
Comparison of FEM and Exact Solution 1 0.8 0.6 0.4 0.2 FEM Exact
u(x)
0.5
1.5 x
2.5