Lab Quiz

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Indian Institute of Technology, Guwahati

Department of Mechanical Engineering


Numerical Analysis, ME542
Jan- May, 2022
End Semester Examination

Please read the instructions carefully

(a) This question paper has two (02) questions. The total marks are 60.
(b) All results have to be printed up to 4 decimal places. There is no step marking.
(c) Make a folder named as your roll number on the desktop. Inside that make two
subfolders Question_1 and Question_2. All files for each question should be put
inside their respective folders.
(d) The codes are also to be submitted in the respective folders.

Question 1 (30 Marks) Let us consider following higher order ODE

y 00 − y = 8ex subjected to y(0) = 4, y 0 (0) = 6.

We want to find distribution of y and y 0 in 0 < x < 4 by Runge-Kutta of Fourth


order (RK4) method.
Write a C code to solve this system by RK4 method with N = 2, 5, 10. Here, N is
the number of steps in the RK4 method. Find the value of y(4) and y 0 (4) for each
value of N and print them in a single output file output_1.txt which has N + 1 rows
and three columns (x, one for y(4) and another for y 0 (4)).

Solving system of ODEs:


Consider the following initial value problem:

u0 (x) = f (x, u, v), u(a) = u0 ;


v 0 (x) = g(x, u, v), v(a) = v0 ;

where we want to find u(x) and v(x) in a < x < b such that both u and v satisfy
above coupled ODEs.
Runge-Kutta of Fourth order (RK4) for system of ODEs:

1 1
un+1 = un + (k1 + 2k2 + 2k3 + k4 ) vn+1 = vn + (l1 + 2l2 + 2l3 + l4 )
6 6
k1 = hf (xn , un , vn ) l1 = hg(xn , un , vn )
h k1 l1 h k1 l1
k2 = hf (xn + , un + , vn + ) l2 = hg(xn + , un + , vn + )
2 2 2 2 2 2
h k2 l2 h k2 l2
k3 = hf (xn + , un + , vn + ) l3 = hg(xn + , un + , vn + )
2 2 2 2 2 2
k4 = hf (xn+1 , un + k3 , vn + l3 ) l4 = hg(xn+1 , un + k3 , vn + l3 )

1
Figure 1: A bar undergoing large deformation

Question 2 (30 Marks) Figure 1 depicts a bar, a-b, having initial length l0 = 0.5 m and
axial stiffness as ka N/m, making an angle θ0 = 15◦ with the horizontal. It undergoes
large deformation due to a vertical force P , the corresponding configuration is
illustrated by the dashed line, a-b0 , in Fig.1. The corresponding vertical displacement
of point b is denoted by b-b0 = δ. Express the normalized force ( kaPl0 ) in terms of the
vertical displacements δ. Now find out the values of the displacements δ for which the
normalized load become zero. You need to write a small code in C or C++ following
the modified false position method (refer Fig. 2) for solving the problem.

2
Figure 2: Modified false position method

You might also like