Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

ODE soving with DLSODE in Intel Fortran composer 2013

Imran_A_
Beginner
1,166 Views

I am solving a problem involving the solution of a large system of ODEs. I use DLSODE to solve my differential equations using the standard        CALL DLSODE(FEX,[NEQ],Y,T,TOUT,ITOL,[RTOL],[ATOL],ITASK,ISTATE,IOPT,RWORK,LRW,IWORK,LIW,JEX,MF)

JEX is the name of subroutine for Jacobian matrix, but I am using a numerical Jacobian. Therefore, I just declare a dummy variable REAL*8 :: JEX, without writing a subroutine for the Jacobian following the following instructions from the documentation of DLSODE:

JAC   :EXT    Name of subroutine for Jacobian matrix (MF =
                   21 or 24).  If used, this name must be declared
                   EXTERNAL in calling program.  If not used, pass a
                   dummy name.
  The form of JAC must be:

                   SUBROUTINE JAC (NEQ, T, Y, ML, MU, PD, NROWPD)
                   INTEGER  NEQ, ML, MU, NROWPD
                   DOUBLE PRECISION  T, Y(*), PD(NROWPD,*)

However this leads to the error:

  error #6635: This actual argument must be the name of a procedure and not a data object.   [JEX] .

I am using option MF=25 for numerical jacbian, where LSODE internally calculates the Jacobian for the function file internally. So writing an external subroutine for it does not make sense.

This did not give any issues when I used an integration with Visual studio 2008.

I would appreciate any help.

 

 

0 Kudos
5 Replies
mecej4
Honored Contributor III
1,166 Views

You probably asked the compiler to check arguments to subroutines, or compiled the sources together, enabling the compiler to check interfaces. Furthermore, the compiler does not know that the dummy Jacobian subroutine will never be called.

If turning off interface checking fails to fix the problem, you will need to provide more details including the code used, compiler version and options used, etc.

0 Kudos
Imran_A_
Beginner
1,166 Views

Thanks for your response.

The compiler does not seem to know that the Jacobian will never be called. Previously I had Intel Fortran composer XE 2003 integrated with Visual studio 2005 and everything was fine with compiling my code. Now I integrated Intel Fortran composer XE 2003 with Visual Studio 2010 and I start seeing this issue.

I declared the numerical Jacobian as a dummy as directed in the DLSODE. For user defined Jacobians, I am required to provide a subroutine for the Jacoian but for numerical jacobian, DLSODE calculates it internally. In the call for DLSODE, I set the integer MF to be 25 (for numerical Jacobian)

 !-------------------------------------------------------------------------------------
   ! PARAMETERS USED IN THE MAIN PROGRAM
   !-------------------------------------------------------------------------------------
   REAL*8 :: T, TOUT
   INTEGER :: SSTIME ! STEADY STATE TIME
   REAL*8 :: JEX                            ! NUMBERICAL JOCOBIAN USED, NO NEED TO HAVE A SUBROUTINE FOR JEX
   REAL*8, ALLOCATABLE :: Y(:)

DLSODE has been around for decades. There surely has to be a way around this issue.

 

0 Kudos
Steven_L_Intel1
Employee
1,166 Views

Yes, there are several ways around the issue. Your code is not valid Fortran and the compiler is detecting that. Many compilers in the past did not do any sort of checking of arguments to procedures with "implicit interface", a frequent cause of errors. Intel Fortran has had the capability, for many years, of detecting such errors through an option called "Generated Interface Checking". The advice to just pass any kind of variable essentially instructs you to create an invalid program in the hopes that the compiler doesn't notice.

You could turn off this feature - project property Diagnostics > Check routine interfaces  - set to No.

Or you could create a dummy routine JEX, like:

SUBROUTINE JEX
END

and then say EXTERNAL JEX in the source that calls DLSODE (and get rid of the REAL*8 declaration.)

0 Kudos
andrew_4619
Honored Contributor II
1,166 Views

You are passing a real(8) scalar JEX to something declared as EXTERNAL JAC. *If* you have interface checking on that will give the error. An easy fix would be to have the dummy routine that follows and have USE my_jac_func in the routine that call DLSODE:

Module my_jac_func
implicit none
contains
SUBROUTINE JEX (NEQ, T, Y, ML, MU, PD, NROWPD)
   INTEGER  NEQ, ML, MU, NROWPD
   DOUBLE PRECISION  T, Y(*), PD(NROWPD,*)
   return
end subroutine jex
end Module my_jac_func

It would seem Steve got in a reply as i typed....

 

0 Kudos
Imran_A_
Beginner
1,166 Views

Thanks a lot. The issue is resolved by dropping the REAL*8 declaration and declaring JEX as an external and writing a dummy routine for JEX. The code then runs fine.

0 Kudos
Reply