0% found this document useful (0 votes)
70 views13 pages

Me15btech11030 hw1 2018

This document provides the solution steps and results for a homework problem involving solving a differential equation numerically using finite element methods. The problem involves finding an approximate solution of the form u=a0+a1x+a2x^2 and comparing the accuracy of different numerical methods including collocation, subdomain, least squares, Galerkin, and method of moments. The document also solves the problem using a cubic approximation u=b0+b1x+b2x^2+b3x^3 and compares the accuracy of the different methods. RMS errors are calculated for each approximate solution. Plots of the analytical and approximate solutions are also presented.

Uploaded by

rahul alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views13 pages

Me15btech11030 hw1 2018

This document provides the solution steps and results for a homework problem involving solving a differential equation numerically using finite element methods. The problem involves finding an approximate solution of the form u=a0+a1x+a2x^2 and comparing the accuracy of different numerical methods including collocation, subdomain, least squares, Galerkin, and method of moments. The document also solves the problem using a cubic approximation u=b0+b1x+b2x^2+b3x^3 and compares the accuracy of the different methods. RMS errors are calculated for each approximate solution. Plots of the analytical and approximate solutions are also presented.

Uploaded by

rahul alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ME5130 - FEM

HW 1
RAHUL ALAM
ME15BTECH11030

1​. Given differential equation is


d2 u
dx2
+ u = 1 , boundary conditions : u(0)= 1, u(1)=0

Ans:
u = up + uh . up = particular solution, uh = homogeneous solution
First we will find uh .
d2 u
For that we have to consider, dx2
+u = 0
So, the homogeneous solution is, uh = Acos(x) + Bsin(x)

The RHS of the equation is constant. So, for particular solution, we can up = k.
So, up ll = 0 and from the given differential we get k = 1.
So, the analytical solution is,
u = Acos(x) + Bsin(x) + 1
Now from Boundary conditions,

At x = 0 ,
1 = A+0+1 ⇒A = 0
At x = 1 ,
−1
0 = Bsin(1) + 1 ⇒ B = sin(1)

So final analytical solution is ,


sin(x)
u = 1 − sin(1)
2​.​ In the differential equation in above question, let approx solution,
u = a0 + a1 x + a2 x2 ,

Ans.
u(0) = 1 = a0
u(1) = 1 + a1 + a2 = 0 ⇒ a1 = − a2 − 1

So, u = 1 − (a2 + 1)x + a2 x2 ​ ⇒ u = (1 − x) + a2 (x2 − x)


Here we have only 1 D.O.F --> a2
d2 u
R(u) ≡ dx2
+ u -1
2
d
R(u) ≡ − (a2 + 1)x + a2 x2 ) + (1 − (a2 + 1)x + a2 x2 ) − 1
dx2
(1
⇒ R(u) = − x + a2 (x2 − x + 2)

Now we apply MWR (Method of weighted residue) to find the approximate solutions.
We will use the below 5 methods to find approximate solutions. Also we will find the RMS


1
error for each approximate function using , ​RMS error = ∫(u − u) 2 dx
0

a) Collocation method:

W i = δ(x − xi ) and ∫ W i R(xi )dx = 0

And we have R(xi ) = 0 at one point


We choose xi = 0.5
⇒ R(0.5) = 0
⇒ R(0.5) = − 0.5 + a2 (0.52 − 0.5 + 2) = 0
2
⇒ a2 = 7
2 2
⇒ u = (1 − x) + 7 (x − x) and ​RMS error = 0.00606
ii) Sub-domain method:
1
Wi = 1 and ∫ W i R(xi )dx = 0
0
1
⇒ ∫(− x + a2 (x2 − x + 2))dx = 0
0
3
⇒ a2 = 11
3 2
⇒ u = (1 − x) + 11 (x − x) and ​RMS error = 0.00598
i​ii) Least square method:
1
∂R
W = ∂a2
2
= x − x + 2 and ∫ W Rdx = 0
0
1
⇒ ∫(x2 − x + 2)(− x + a2 (x2 − x + 2))dx = 0
0
165
⇒ a2 = 606
165 2
⇒ u = (1 − x) + 606 (x − x) and ​ RMS error = 0.00599

iv) Galerkin Method:


1
W = ∂u
∂a2 and ∫ W Rdx = 0
0
1
W = x2 − x ⇒ ∫(x2 − x)(− x + a2 (x2 − x + 2)) = 0 ⇒ a2 = 5
18
0
5 2
⇒ u = (1 − x) + 18 (x − x) and ​ RMS error = 0.0059
v) Method of moments:
1
i
W = x , i = DOF and ∫ W Rdx = 0
0
1
1
W = x ⇒ ∫ x(− x + a2 (x2 − x + 2)dx = 0 ⇒ a2 = 4
11
0
4 2
⇒ u = (1 − x) + 11 (x − x) and ​ RMS error = 0.0167
Below is the code for plotting analytical vs approximate solution for particular graph.

Here is the code for comparing all graphs in a plot.


3. In the differential equation in above question, let approx solution,  
  u = b0 + b1 x + b2 x2 + b3 x3  
Ans. 
u(0) = b0 = 1  
u(1) = 1 + b1 + b2 + b3 = 0 ⇒ b1 = − b2 − b3 − 1  
⇒ u = (1 − x) + b2 (x2 − x) + b3 (x3 − x)  
 
R(u) = d2 u
+ u − 1 ⇒ R(u) = − x + b2 (x2 − x + 2) + b3 (x3 + 5x)  
dx2
 
Now we apply MWR (Method of weighted residue) to find the approximate solutions.
We will use the below 5 methods to find approximate solutions. Also we will find the RMS


1
error for each approximate function using , ​RMS error = ∫(u − u) 2 dx
0

a) Collocation method:

W i = δ(x − xi ) and ∫ W i R(xi )dx = 0

And we have R(xi ) = 0 at 2 point b/w 0 and 1. We choose xi = 0.25 and xi = 0.5 .
29 81 1
R(0.25) = 0 ⇒ 16 b2 + 64 b3 = 4
7 21 1
R(0.5) = 0 ⇒ b
4 2
+ b
8 3
= 2

Solving we get, b2 = 0.0092 and b3 = 0.1843


⇒ u = 1 − x + 0.0092(x2 − x ) + 0.1843(x3 − x)
and ​RMS error = 0.00147
ii) Sub-domain method:
0.5 1
Wi = 1 and ∫ W i R(xi )dx = ∫ W i R(xi )dx = 0
0 0.5
0.5
11 41 1
∫ [− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0 ⇒ b
12 2
+ b
64 3
= 8
0
1
11 135 3
∫ [− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0 ⇒ b
12 2
+ b
64 3
= 8
0.5

Solving we get, b2 = 0.0174 and b3 = 0.1702


⇒ u = 1 − x + 0.0174(x2 − x ) + 0.1702(x3 − x)
and ​RMS error = 0.00101

i​ii) Least square method:


1
W1 = ∂R
∂b2 , W2 = ∂R
∂b3 and ∫ W i Rdx = 0
0
1
W 1 = x2 − x + 2 ⇒ ∫(x2 − x + 2)[− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0
0
101 101 11
⇒ b
30 2
+ b
20 3
= 12
1
W 2 = x + 5x3
⇒ ∫(x3 + 5x)[− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0
0
101 220 28
⇒ b
20 2
+ b
21 3
= 15

Solving we get, b2 = 0.0181 and b3 =0.1695


⇒ u = 1 − x + 0.0181(x2 − x ) + 0.1695(x3 − x)
and ​ RMS error = 0.00108
iv) Galerkin Method:
1
W1 = ∂u
∂b2 , W2 = ∂u
∂b3 and ∫ W i Rdx = 0
0
1
W 1 = x2 − x ⇒ ∫(x2 − x)[− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0
0
3 9 1
⇒ b
10 2
+ b
20 3
= 12
1
W2 = x − x 3
⇒ ∫(x3 − x)[− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0
0
9 76 2
⇒ b
20 2
+ b
105 3
= 15

Solving we get, b2 = 0.0216 and b3 =0.1707

⇒ u = 1 − x + 0.0216(x2 − x ) + 0.1707(x3 − x)
and ​ RMS error = 0.00019
v) Method of moments:
1
1 2
i
W = x , i = DOF ⇒ W 1 = x , W 2 = x and ∫ W Rdx = 0
0
1
11 28 1
W1 = x ⇒ ∫ x[− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0 ⇒ b
12 2
+ b
15 3
= 3
0
1
37 17 1
W2 = x 2
⇒ ∫ x 2 [− x + b2 (x2 − x + 2) + b3 (x3 + 5x)]dx = 0 ⇒ b
60 2
+ b
12 3
= 4
0

Solving we get, b2 = 0.0376 and b3 =0.1600

⇒ u = 1 − x + 0.0376(x2 − x ) + 0.1600(x3 − x)
and ​ RMS error = 0.00042
Here is the code for comparing all the approximate and analytical plots.

You might also like