CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   I faced difficulty in a fortran error (http://www.cfd-online.com/Forums/main/4543-i-faced-difficulty-fortran-error.html)

J. Kim March 19, 2002 06:35

I faced difficulty in a fortran error
 
Dear all,

I faced an error in fortran compiler: Divide by zero I found out the casue of that. However, I did not know a way to solve it. Here is a error.

---------------- KmT=475.0e-6 KmD=155.0e-3 CDT=2.36e-10 CDD=2.57e-10

C RENEW ATP CONCENTRATION AT BOTTOM WALL

DO 510 I=1,L1

F_ATP=F(I,1,5)*VmaxT/(KmT*CDT)-S/(CDT)

F(I,1,5)=F(I,2,5)+F_ATP*YDIF(2) 510 CONTINUE C RENEW ADP CONCENTRATION AT BOTTOM WALL

DO 520 I=1,L1

F_ADP=F(I,1,6)*VmaxD/(KmD*CDD)-F(I,1,5)*VmaxT/(KmT*CDD)

F(I,1,6)=F(I,2,6)+F_ADP*YDIF(2) 520 CONTINUE

---------------- As you can see, the values of KmT*CDT, CDT, KmD*CDD, and KmT*CDD is very small like the unit.

How can I change them? I would be appreciated for this if you would help me.

STN March 19, 2002 06:59

Re: I faced difficulty in a fortran error
 
Hi Kim....

Could you tell which, exactly, line is error ?

Is it this line " F_ATP=F(I,1,5)*VmaxT/(KmT*CDT)-S/(CDT)" or "F_ADP=F(I,1,6)*VmaxD/(KmD*CDD)-F(I,1,5)*VmaxT/(KmT*CDD)"?

If yes, It may because KmT or KmD is not define as REAL or DOUBLEPRECISION parameter. Normaly, FORTRAN define all parameter which has I,J,K,L,M,N in the first letter is INTEGER.So your KmT or KmD is ZERO.

Hope this help.. STN

Seb Perron March 19, 2002 09:36

Re: I faced difficulty in a fortran error
 
1) First to make sure that all you variables are declared with the appropriate type, add

implicit none

at the first line of your routine.

2) Compute both

dtmp0=KmT*CDT

and

dtmp1=KmT*CDD

and before making the division, do a simple check on their value.

Good luck.

J. Kim March 19, 2002 10:21

Re: I faced difficulty in a fortran error
 
Thanks really for your warm answer.

Like you gave me comment, I already did so. There is still error: Divied by zero.... Are there any solution? I will post the problem again. --------------------- ..... KmT=475.0e-6 KmD=155.0e-3 CDT=2.36e-10 CDD=2.57e-10 ..... DO 510 I=1,L1

F_ATP=F(I,1,5)*VmaxT/(KmT*CDT)-S/(CDT)

F(I,1,5)=F(I,2,5)+F_ATP*YDIF(2) 510 CONTINUE

DO 520 I=1,L1

F_ADP=F(I,1,6)*VmaxD/(KmD*CDD)-F(I,1,5)*VmaxT/KmT*CDD)

F(I,1,6)=F(I,2,6)+F_ADP*YDIF(2) 520 CONTINUE

----------------

----------------------

Wen Long March 19, 2002 11:20

Re: I faced difficulty in a fortran error
 
Hi, Kim:

Maybe your KmT, KmD and CDT are too small, and divition by a small number is apt to make errors. Can you normalize it first?

Say, KmT_1=Kmt/1.0e-6, KmD=KmD/1.0e-3 ...

Then you devide by (KmT_1*KmD) and times the result with 1.0e+9,

hope this helps,

wen

Francisco March 19, 2002 13:19

Re: I faced difficulty in a fortran error
 
Dear J.Kim,

Ive pasted your piece of code into my Fortran compiler (F90 for Windows) and with slight modifications (which I hope did not change the divison operation), it seemed to work (no divison by zero). Here is the small code I used:

program kim

implicit none

real*8 KmT, KmD,CDT,CDD,F_ATP,F_ADP,S,VmaxD,VmaxT

KmT=475.0e-6

KmD=155.0e-3

CDT=2.36e-10

CDD=2.57e-10

F_ATP=VmaxT/(KmT*CDT)-S/(CDT)

F_ADP=VmaxD/(KmD*CDD)-F_ATP*VmaxT/(KmT*CDD)

write(*,*) F_ATP,F_ADP,CDT

pause

end

Obviously, I might have removed the source of error, but try it yourself.

Best regards,

Francisco.


J. Kim March 19, 2002 18:36

Re: Thanks for your good comment.
 


All times are GMT -4. The time now is 08:35.