- #1
abdulsulo
- 14
- 0
Hello guys I am trying to write a code which is below;
But my results seems to be fairly wrong.
I noticed some of my real numbers are not what I assigned them. For example Ks shows on the watch window as 9.9999999E-5.
How can I fix such situation?
<<Moderator's note: added code tags>>
But my results seems to be fairly wrong.
I noticed some of my real numbers are not what I assigned them. For example Ks shows on the watch window as 9.9999999E-5.
How can I fix such situation?
Fortran:
program hw1
REAL:: G,DVIS,Ks, EPS,LENGTH,D,Vs,Re,Vi,V0,FFACT,DELt,I,Vi1,H,T,PHO
G=9.81
D=0.3
H=8
Ks=1E-4
T=60
DVIS=0.001
PHO=1000
EPS=0.01
DELt=0.02
write(*,*) Ks
write(*,*) G
write(*,*) H
write(*,*) T
write(*,*) DVIS
write(*,*) PHO
write(*,*) EPS
write(*,*) DELt
WRITE(*,*) 'INPUT CYLINDER DIAMETER'
READ(*,*) D
WRITE(*,*) 'LENGTH'
READ(*,*) LENGTH
IF (LENGTH==50) THEN
Vs=6.586
ELSE IF (LENGTH==100) THEN
Vs=5.00
ELSE IF (LENGTH==200) THEN
Vs=3.669
ELSE IF (LENGTH==500) THEN
Vs=2.36
END IF
write(*,*) Ks
Re=PHO*Vs*D/DVIS
write(*,*) Re
FFACT=0.25/((log((Ks/(3.7*D))+(5.74/Re**0.9)))**2)
write(*,*) FFACT
Vi=0
write(*,*) Vi
DO I=0.02, 200, 0.02
if (I==0.02) THEN
Vi1=Vi+(DELt*(H)*G/LENGTH)
Vi=Vi1
write(*,*) Vi1
ELSE
Re=PHO*Vi*D/DVIS
FFACT=0.25/((log((Ks/(3.7*D))+(5.74/Re**0.9)))**2)
Vi1=Vi+(DELt*(H-((1+(FFACT*LENGTH/D))*((Vi**2)/(2*G))))*G/LENGTH)
Vi=Vi1
write(*,*) Vi1
end if
end do
pause
end program