!
! sddfn_demo.f90
!
! Fotran 90 program that will use DDE_SOLVER_M to solve the DDEs defined
! in the vector field: sddfn
!
! This file was generated by the program VFGEN (Version:2.1.0)
! Generated on  3-Jun-2007 at 12:24
!
!

PROGRAM sddfn_demo

USE DEFINE_sddfn_DDEs
USE DDE_SOLVER_M

IMPLICIT NONE

INTEGER, DIMENSION(2) :: NVAR = (/NEQN,NLAGS/)

TYPE(DDE_SOL) :: SOL
TYPE(DDE_OPTS) :: OPTS

DOUBLE PRECISION, DIMENSION(2) :: TSPAN

INTEGER :: I,J
CHARACTER(7+6*NEQN) :: F
DOUBLE PRECISION :: relerr, abserr, stoptime

! Set the solver parameters: relative error, abs. error, stop time
relerr = 1D-7
abserr = 1D-9
stoptime = 10.0

TSPAN(1) = 0.0
TSPAN(2) = stoptime
OPTS = DDE_SET(RE=relerr,AE=abserr)

SOL = DDE_SOLVER(NVAR,sddfn_ddes,sddfn_beta,sddfn_history,TSPAN,OPTIONS=OPTS)

F = "(E12.5"//REPEAT(",E12.5",NEQN)//")"
DO I = 1, SOL%NPTS
    WRITE(*,FMT=F) SOL%T(I), (SOL%Y(I,J),J=1,NEQN)
END DO

END PROGRAM sddfn_demo
