Run-time error M6201: math -log: DOMAIN error

  • Thread starter Thread starter js6201
  • Start date Start date
  • Tags Tags
    Domain Error Log
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
js6201
Messages
7
Reaction score
0
Hi all,
I am facing the problem while executing my fortran (77) program.
please help me how to fix it.
As I understood, the error means that the domain of log function has included zero values or negative values...But I could not understand...In my case... there are no zero or negative values...ㅜㅜ...

Homework Statement


run-time error M6201: math -log: DOMAIN error

Homework Equations


4th-order runge-kutta method
Ordinary differential equation

I attached the fortran source code below...
[ /CODE ]

Program Runge

REAL t, dt, dt2, beta, sd0
REAL k1(20000), k2(20000), k3(20000), k4(20000)
REAL D(20000), m1(20000), m2(20000), m3(20000), m4(20000)
REAL rat(20000), fc(20000)
integer i

open(unit=1,file="input",form="formatted",status="unknown")
read(1,*) n0d,t0,tf,gk,c
read(1,*) sd0,denp,kadot,kbdot,visB1

t=t0
dt=(tf-t0)/n0d
H=dt/6.d0
dfc=2000E-6
beta=dlog10(2.d0/3.d0)/log10(dfc/sd0)
D(1)=sd0
m1(1)=0.0
m2(1)=0.0
m3(1)=0.0
k1(1)=0.0
k2(1)=0.0
k3(1)=0.0
k4(1)=0.0
fc(1)=3.0*((D(1)/sd0)**beta)
rat(1)=beta*log(D(1)/sd0)+1

i=2

DO WHILE (i. le. n0d)

rat(i)=beta*log(D(i-1)/sd0)+1.0
fc(i)=3.0*(D(i-1)/sd0)**(beta)

k1(i)=(gk*(sd0**beta)/rat(i))*((kadot/3)*(c/denp)*((sd0)**
& (fc(i)-3))*(D(i-1)**(-fc(i)+4-beta))-(kbdot/3)*((visB1)**0.5)*
& (sd0**(-1.0+(1/3)*fc(i)))*(D(i-1)**(2-beta-fc(i)/3))*((D(i-1)
& -sd0)**1.0))

m1(i)=real(D(i-1)+k1(i)/2.0d0)

k2(i)=(gk*(sd0**beta)/rat(i))*((kadot/3)*(c/denp)*((sd0)**
& (fc(i)-3))*(m1(i)**(-fc(i)+4-beta))-(kbdot/3)*((visB1)**0.5)*
& (sd0**(-1.0+(1/3)*fc(i)))*(m1(i)**(2-beta-fc(i)/3))*((m1(i)
& -sd0)**1.0))

m2(i)=real(D(i-1)+k2(i)/2.0d0)

k3(i)=(gk*(sd0**beta)/rat(i))*((kadot/3)*(c/denp)*((sd0)**
& (fc(i)-3))*(m2(i)**(-fc(i)+4-beta))-(kbdot/3)*((visB1)**0.5)*
& (sd0**(-1.0+(1/3)*fc(i)))*(m2(i)**(2-beta-fc(i)/3))*((m2(i)
& -sd0)**1.0))

m3(i)=real(D(i-1)+k3(i))

k4(i)=(gk*(sd0**beta)/rat(i))*((kadot/3)*(c/denp)*((sd0)**
& (fc(i)-3))*(m3(i)**(-fc(i)+4-beta))-(kbdot/3)*((visB1)**0.5)*
& (sd0**(-1.0+(1/3)*fc(i)))*(m3(i)**(2-beta-fc(i)/3))*((m3(i)
& -sd0)**1.0))

D(i)=real(D(i-1)+H*(k1(i)+2*(k2(i)+k3(i))+k4(i)))

open(unit=1000,file="flocsize",form="formatted",status="unknown")
open(unit=2000,file="result",form="formatted",status="unknown")

write(1000,*) t, m1(i), m2(i), m3(i), D(i)
write(2000,*) i, k1(i), k2(i), k3(i), k4(i)
write(*,*) i, D(i)

i=i+1
t=t+dt

END DO
END
 
Last edited:
Physics news on Phys.org
When posting source code, please use [ CODE ] [ /CODE ] tags (without the spaces) to enclose the code to preserve the original spacing.

You may think you have no zeros or negative values, but your code disagrees. You are reading input data from files, so it's impossible to tell where the problem might be occurring.

The best I can recommend is that you inserts WRITE statements in your code before each line where a LOG or DLOG function is executed and print out the values of the arguments being supplied to these functions.

When reporting errors, compilers and runt-time units sometimes include line numbers where the error occurred. It's always helpful to include this information with any request for help.