Vous êtes sur la page 1sur 2

y, m z, m

0.00 0.00
1.97 0.30
3.41 0.60
3.74 0.90
3.85 1.20
3.85 1.50
3.85 1.80
3.85 2.10
3.84 2.40
3.84 2.70
3.84 3.00
3.84 3.30
3.84 3.50
1.92 3.50
0.00 3.50
Faculty of Maritime Engineering, Biological, Ocean and Natural Resources Sciences

Applied Programming I

Homework #2 Nov. 04, 2013

1.- The friction coefficient, f, for turbulent flows inside tubes may be calculated solving the
implicit equation:

|
|
.
|

\
|
+ =
2 1 2 1
51 2
7 3
0 2
1
/
D
/
f Re
.
.
D /
l og .
f
,
where D / is the relative roughness, and,
D
Re is the Reynolds number taking the diameter
as the reference length.

For different values of relative roughness ( D / c =0.0001, 0.001, 0.01 y 0.05), and varying the
Reynolds number, between 2.5x10
3
and 1x10
8
, calculate the friction factor, f. To find the
roots of equation for f, apply Newton-Raphson method, and use function subprograms (for
the function and its derivative) explained in class.

Prepare a log-log graph with the results, including a curve taken from a Fluid Mechanics
book (Fox-McDonald or Streeter). To facilitate the plotting, write your results (f for different
values of
D
Re ) in a file, with a name typed from the keyboard. Then import that file from
Excel and prepare a graph, with logarithmic scales. The name of the result file must be read
from the screen.


2.- Prepare a program to calculate the position of the center of gravity of a tank with constant
section, when the ship inclines up to a certain angle of heel. The input data are the number
and the table of offsets (y, z), the original height of liquid and the angle of heel. The results
are: the liquid height at centerline, and the coordinates of the original and new center of
gravity. Use at least two subroutines: one to read the data, and, another to develop the
calculations. All data needed for the calculations must be read from an external file, and
shared between subprograms using common blocks.






















3.- Develop an Static library containing a subroutine to solve a system of linear algebraic
equations. The solution scheme must include Pivotting
1
, and you may take the source
code from the appendix of these class notes or any Numerical Analysis book.

The input variables for the subroutine must be: title for the example, the order of the equation
system, the coefficient matrix, the independent term vector, and the solution vector.

To check the project, prepare a main program, that calls the subroutine, and in the VF
Project include the Static library. In the report, include an example.



For each problem you have to start with a Description of the program
(<250 words), and comment on the results. Do not forget: for each problem you must
report the employed number of hours to solve them, and reviewed references.


To be delivered by: Friday Nov. 15
th
, 11h40 am, before the second evaluation


jrml/2013


1
You have to review your class notes from Numerical Analysis.

Vous aimerez peut-être aussi