+
Skip to content

More minor bugs, mostly related to not initializing variables #10

Open
@mecej4g

Description

@mecej4g
  1. When running the LSODIS example, the following error is encountered:
Runtime Error: M_da1/dainvgs.inc, line 104: Reference to undefined variable DLSS%NLU
Program terminated by fatal error

This happens because DAINVGS() is called from line 2042 of M_main/dlsodis.inc, and DAINVGS updates DLSS%NLU on line 104. One solution is to move or duplicate the following initialization on line 2081 of M_main/dlsodis.inc to a location prior to the call on line 2042.

   dlss%nlu = 0
  1. When running the LSODKR example, the call to DLSODKR returns sometimes with ISTATE = 1 or 2. As the comments in the source code of DLSODKR state, the output argument JROOT is set only when ISTATE = 3. To avoid using/printing the undefined value of JROOT, add the following line after the call to DLSODKR:

    if (istate .ne. 3) jroot = 0

  2. When I run LSODPK, one of the cases gives this error:

 Solution with mf = 10
   t       nstep  nfe  nni  nli  npe  nq    h          avdim    ncf rate    lcf rate
Runtime Error: M_matrix/daxpy.inc, line 107: Reference to undefined variable DX(I)

To fix this, in subroutine SETPAR add this initialization:

acoef(1:2*np,1:2*np) = 0.0d0
  1. Another error in the LSODPK run:
 Solution with mf = 21

   t       nstep  nfe  nni  nli  npe  nq    h          avdim    ncf rate    lcf rate
Runtime Error: M_da1/dspiom.inc, line 217: Subscript 1 of IPVT (value 0) is out of range (1:*)
Program terminated by fatal error

The culprit is the following line in dspiom.inc .

if ( ll>1.and. Ipvt(lm1)==lm1 ) prod = prod*Hes(ll,lm1)

When ll equals 1, lm1 = 0, and the compiler may choose to evaluate the part of the expression following .and. regardless of the value of the part preceding .and. The fix is to replace this line by the following lines.

     if ( ll>1) then
         if (Ipvt(lm1)==lm1 ) prod = prod*Hes(ll,lm1)
     endif
  1. In subroutines fweb and jacbg of LSODPK.f90, the size of the argument cc should be 2*neq, not neq as it is in the Netlib sources. I note that you changed the dimension to (*) in both instances, and that fix is fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载