1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Jan 20, 2016 #1
    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...ㅜㅜ...

    1. The problem statement, all variables and given/known data
    run-time error M6201: math -log: DOMAIN error

    2. Relevant 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: Jan 20, 2016
  2. jcsd
  3. Jan 20, 2016 #2

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Run-time error M6201: math -log: DOMAIN error
  1. Interpolation error. (Replies: 1)

  2. Pressure errors (Replies: 3)

  3. Oscilloscope error (Replies: 1)

Loading...