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

---------------- 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

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

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

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

 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,

I´ve 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

KmT=475.0e-6

KmD=155.0e-3

CDT=2.36e-10

CDD=2.57e-10

F_ATP=VmaxT/(KmT*CDT)-S/(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.