0% found this document useful (0 votes)
211 views

Assignment: 1: X X X e

The document describes 8 problems assigned as part of a Computational Fluid Dynamics course. The problems involve writing programs to: 1) Evaluate exponential functions using series approximations and compare single vs double precision values. 2) Determine machine epsilon. 3) Find numbers divisible by 3, digits summing to 11, and value of pi. 4) Format values of pi differently. 5) Determine accuracy of series solutions to steady state heat equations. 6) Determine accuracy of series solutions to transient heat equations. 7) Solve transcendental equations to find eigenvalues. 8) Read solar radiation data from files, output to files, and plot the flux vs time curve.

Uploaded by

jvNKJVDKJVSJ
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)
211 views

Assignment: 1: X X X e

The document describes 8 problems assigned as part of a Computational Fluid Dynamics course. The problems involve writing programs to: 1) Evaluate exponential functions using series approximations and compare single vs double precision values. 2) Determine machine epsilon. 3) Find numbers divisible by 3, digits summing to 11, and value of pi. 4) Format values of pi differently. 5) Determine accuracy of series solutions to steady state heat equations. 6) Determine accuracy of series solutions to transient heat equations. 7) Solve transcendental equations to find eigenvalues. 8) Read solar radiation data from files, output to files, and plot the flux vs time curve.

Uploaded by

jvNKJVDKJVSJ
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/ 6

ME 652 Computational Fluid Dynamics

Assignment: 1
1. Write a program to evaluate the function using the series approximation (Note
that + + + + =
! 3 ! 2
1
3 2
x x
x e
x
). The evaluation is considered complete when two successive
summations do not differ by more than 10
-5
. Use your program to evaluate e
-x
for x = 1, 5,
10, 100. Compute the values using single and double precision.
2. The floating point arithmetic is characterized by machine epsilon, the smallest floating
point number such that 1+ >1. Write a program to determine epsilon for your machine.
The most common way to do this is to initialise a variable to 1, and keep halving it and
adding it to 1 and checking if the result is greater than 1.
3. Write a computer program to determine
(a) Numbers between -100 and +100 that are exactly divisible by 3.
(b) Numbers between 0 and 10
5
whose sum of the digits is 11.
(c) Value of from sin ( / 2) = 1 and tan ( / 4) = 1.
4. Print the following:
(a) The value of in F format.
(b) The value of in E format.
(c) The value of in Free format.
5. The series solution to a steady 2 D conduction problem is given by:
) sinh( ) sin(
) sinh(
] ) 1 ( 1 [ 2
) , (
1
a
y n
a
x n
n n
y x T
n
n
t t
t t

=

=
For square computational domain of length = a, determine minimum values of n for 5-digit
accuracy in computed value of T(0.25,0.50), T(0.50,0.50), T(0.75,0.50), T(0.50,0.25),
T(0.50,0.75). The boundary conditions are 0 ) 0 , ( ) , ( ) , 0 ( = = = = = = y x T y a x T y x T ,
1 ) , ( = = a y x T . Assume a=1.
6. The series solution to a transient 1 D Conduction problem is given by:


=
) (
3
) sin(
8
) , (
2 2
odd n
t n a
nx
n
e
t x T
t

If the length of computational domain is taken as , determine minimum values of n for 5
digit accuracy in computed value of ) 01 . 0 , 2 / ( = = t x T t , ) 5 . 0 , 2 / ( = = t x T t ,
) 75 . 0 , 2 / ( = = t x T t , ) 1 , 2 / ( = = t x T t . The initial and boundary conditions are
), ( ) 0 , ( x x t x T = = t 0 ) , ( ) , 0 ( = = = = t x T t x T t . Assume 1 ) / ( =
p
c k .
7. Solve the transcendental equation (use any method) cot (b) = ( k / h) to determine first
five (5) values of
n
. Given: b = 5 cm, k = 30 W / m-K, h = 15 W / m
2
K.
8. The following data relate to solar radiation:
Time 9 10 11 12 13 14 15 16
Flux (kW/m
2
) 0.6 0.79 0.9 0.94 1.02 0.96 0.6 0.4
Write a computer program to read the above data from an input file. Confirm the reading
through an output file where Time and Flux data will be in two columns with proper format.
Also prepare Flux vs. Time plot. Calculate the energy falling on 1 m
2
area from 9 to 16 hours
(i.e. Area under the curve).


















ME 652 Computational Fluid Dynamics
Assignment: 2
Problem: 1.Consider open-channel flow of water in a circular pipe of diameter D. The water
level is at a height h from the lowest point in the cross-section of the pipe. Compute the value
of the ratio h/D using the bisection method, when (a) 20% (b) 40% (c) 60% and (d) 80% of
the cross-sectional area is occupied by air.
Problem: 2. Consider the generalised equation of state given by Redlich-Kwong:



Where a = 0.4275 (R
2
T
c
2.5
)/p
c
and b = 0.08664 RT
c
/p
c
, T
c
and p
c
being the critical
temperature and pressure respectively, R is gas constant. Using this equation of state for
water at a pressure of 1 bar, compute the value of the specific volume of water vapour using
the Secant and the Newtons methods, at temperatures varying from 100 to 300 in steps
of 50. Compare your result with the values given in steam table. Plot the error as a function
iteration number for both the methods and comment.
Problem: 3. Use Newtons method to find the roots of:
(a) f(x) = x
2
-2x+1
(b) f(x) = x
2
-3x+2.
Both the functions have a root x=1. For both the cases, start with an initial guess x(0) = 1.1.
Use double precision variables in your program. Terminate your iterations when the absolute
value of f(x) is less than 10
-12
. Tabulate the value of x(k), e(k) = x(k)-1 and f(x(k)) for each
iteration. Print out the number of iterations required for convergence for each case. What is
the ratio e (k+1)/e(k) for the two cases? Comment on the rates of convergence for two cases.
Problem: 4. Consider the quadratic equation, x
2
- 2.2 x + 1.2. Note the roots of the equation
are 1 and 1.2. You are asked to find the roots of the above equation using fixed point iteration
with, x = x + g(x), where is a relaxation parameter. Perform the following steps and
comment on the result with valid justifications
a. Starting with the initial guess x = 1.10, = 1.00, perform 50 iterations
b. Starting with the initial guess x = 1.21, = 1.00, perform 50 iterations
c. Starting with the initial guess x = 1.21, = -1.00, perform 50 iterations
d. Starting with the initial guess x = 1.21, = -5.00, perform 50 iterations
e. Starting with the initial guess x = 1.21, = -8.00, perform 50 iterations
Problem: 5. Consider . The root is approximately 0.58. Starting from
this guess, use fixed point iteration to get the root.

Problem: 6. Using the knowledge of FMHT regarding the uniform flow over a Rankine half
body, find the location in the surface of Rankine half body where the velocity will be
maximum and the magnitude of maximum velocity.






















ME 652 Computational Fluid Dynamics
Assignment: 3
Problem: 1. Assume any 4 X 4 matrix such that the diagonal is dominant. Assume any vector
say {1, 1, 1, 1} and generate the right hand vector. Now write a gauss elimination algorithm
without partial pivoting and solve the above problem. Now take the same matrix and
rearrange the rows such that the diagonal dominance is destroyed. Resolve the problem and
obtain the solution, and compare the obtained solution with that of the actual answer. Now,
also add partial pivoting to your algorithm and re-solve the problem. Comment on your
results. (Note that the last part is only to automate pivoting whose solution procedure would
be same as part 1).

Problem: 2. Write an algorithm to solve Problem 1 using Crout's method.

Problem: 3. Consider general diagonal, lower triangular and upper triangular matrices that
form the coefficient matrix for a system of linear algebraic equations. The right hand side of
the system of equations is assumed to be known. Write a program that can solve for the
unknowns of the system of equations. The program should be capable reading the appropriate
number elements of the matrix from a given file, given the total number of equations and
print out the solution. (The program needs to be able to accept coefficient matrices bigger
than 10 X 10, in general, and the right hand side will form the last column making the largest
matrix that needs to be read in, a 10 X 11). To test the program, take arbitrary [L] and [U],
say for e.g. 4 X 4. Evaluate the RHS vector by assuming the {x} to be known, e.g. x
1
= x
2
=
x
3
= x
4
= 1.0 for the above 4 X 4. Now use your program with the coefficient matrix and the
computed RHS and the solution your program gives should be the assumed {x}.

Problem: 4. Write a tridiagonalmatrixalgorithm (TDMA). Solve the following problem:
(
(
(
(
(
(
(
(
(
(
(
(

2 1 0 0 0 0 0 0 0
1 2 1 0 0 0 0 0 0
0 1 2 1 0 0 0 0 0
0 0 1 2 1 0 0 0 0
0 0 0 1 2 1 0 0 0
0 0 0 0 1 2 1 0 0
0 0 0 0 0 1 2 1 0
0 0 0 0 0 0 1 2 1
0 0 0 0 0 0 0 1 2

1
0
0
0
0
0
0
0
1
9
8
7
6
5
4
3
2
1
x
x
x
x
x
x
x
x
x

Note that the value of each unknown in the above equation is 1.

Problem: 5. Solve the following system using the program developed in 1

+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
=

(
(
(
(
(
(
(
(
(
(
(

9
1
8
1
7
1
6
1
5
1
8
1
7
1
6
1
5
1
4
1
7
1
6
1
5
1
4
1
3
1
6
1
5
1
4
1
3
1
2
1
5
1
4
1
3
1
2
1
1
9
1
8
1
7
1
6
1
5
1
8
1
7
1
6
1
5
1
4
1
7
1
6
1
5
1
4
1
3
1
6
1
5
1
4
1
3
1
2
1
5
1
4
1
3
1
2
1
1
5
4
3
2
1
x
x
x
x
x

Note that the exact answer is 1,1,1,1,1. Run the problem with both single and double
precision. Comment on the results.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy