CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   fortran code - boundary layer - frank white (https://www.cfd-online.com/Forums/main/16330-fortran-code-boundary-layer-frank-white.html)

 Ed February 9, 2009 15:16

fortran code - boundary layer - frank white

Hello CFD-programmers

In the appendix of the book "viscous fluid flow" [frank white], there is a fortran code that solves boundary layer problems, such as blasius, using runge-kutta gills method.

I copied the code and tried to compile it, but the fortran language is older than f77 and I really have no idea how to make it run.

Does anybody have a working code or can someone help me to transform the (short) code into fortran 77 ???

(I apologize in case I violate any copyright policy by publishing the following lines. Please say if so.)

Notation:

N: NUMBER OF DIFFERENTIAL EQUATIONS TO BE SOLVED

Y: ARRAY OF N DEPENDENT VARIABLES

F: ARRAY OF THE N DERIVATIVES OF THE VARIABLES Y

X: INDEPENDENT VARIABLE

H: STEP SIZE DELTA-X

M: INDEX USED IN THE SUBROUTINE WHICH MUST BE SET TO ZERO BY THE PROGRAMMER BEFORE THE FIRST CALL

K: INTEGER FROM THE SUBROUTINE WHICH IS USED AS THE ARGUMNET OF A COMPUTED GO TO STATEMENT IN THE MAIN PROGRAM

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&

PROGRAM WHITE_SOLVER

DIMENSION Y(10), F(10)

READ X, N, XLIM, H, M, (Y(I), I = 1, N)

8 IF(X - XLIM)6,6,7

6 CALL RUNGE(N, Y, F, X, H, M, K)

GO TO (10,20), K

C BLASIUS: f''' + f*f'' = 0

10 F(1) = -Y(1)*Y(3)

F(2) = Y(1)

F(3) = Y(2)

GO TO 6

c\$\$\$C BLASIUS: f''' + f*f'' = 0

c\$\$\$C POHLHAUSEN: theta'' + Pr*f*theta' = 0

c\$\$\$ 10 F(1) = -Y(1)*Y(3)

c\$\$\$ F(2) = Y(1)

c\$\$\$ F(3) = Y(2)

c\$\$\$ F(4) = Y(3)

c\$\$\$ F(5) = EXP(-PR*Y(4))

c\$\$\$ GO TO 6

20 WRITE X, (Y(I), I = 1, N)

GO TO 8

7 STOP

END

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&

SUBROUTINE RUNGE(N, Y, F, X, H, M, K)

DIMENSION Y(10), F(10), Q(10)

M = M + 1

GO TO (1, 4, 5, 3, 7), M

1 DO 2 I = 1, N

2 Q(I) = 0.

A = 0.5

GO TO 9

3 A = 1. + SQRT(2.)/2.

C A = 1.7071067811865475244

4 X = X + 0.5*H

5 DO 6 I = 1, N

Y(I) = Y(I) + A*(F(I)*H - Q(I))

6 Q(I) = 2.*A*H*F(I) + (1. - 3.*A)*Q(I)

A = 1. - SQRT(2.)/2.

C A = 0.2928932188134524756

GOTO 9

7 DO 8 I = 1, N

8 Y(I) = Y(I) + H*F(I)/6. - Q(I)/3.

M = 0

K = 2

GO TO 10

9 K = 1

10 RETURN

END

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&

 Ananda Himansu February 12, 2009 18:30

Re: fortran code - boundary layer - frank white

Except for the "READ X" needing to be replaced with "READ *, X" or "READ (*,*) X", nothing really springs out at me. I thought things like computed GOTOs and arithmetic IFs were obsolescent in F77 but not obsolete until F90, though I could be wrong. Why don't you tell the readers what the F77 compiler barfs at, rather than asking for the whole code to be modernized? This way, no one will have to admit to being old enough to remember FORTRAN IV. I assume you know how to arrange characters in the first six columns for fixed format, and that the way they appear here is only because of HTML peculiarities.

 All times are GMT -4. The time now is 13:14.