!---------------------------------------------------------------------- ! Redoing the local bifurcation of the model analysed by ! Martin Boer, ch. 4 of thesis. ! Cycle-to-cycle connection 3D food chain ! ! Homoclinic, but set up also for heteroclinic ! ! U(1-3) = limit cycle ! U(4-6) = eigenfunction (ef) stable ! U(7-9) = limit cycle again ("second cycle") ! U(10-12) = ef unstable ! U(13-15) = connecting orbit ! ! George van Voorn, June 20th 2007 ! Bart Oldeman, December 2008 !---------------------------------------------------------------------- SUBROUTINE RHS(N,U,PAR,F,DFDU,IJAC) ! ---------- --- IMPLICIT NONE INTEGER N DOUBLE PRECISION U(N),PAR(*),F(N),DFDU(N,N) LOGICAL IJAC DOUBLE PRECISION f1,f2 DOUBLE PRECISION d1,d2,x,y,z,a1,a2,b1,b2 ! Declaring variables x=U(1) y=U(2) z=U(3) ! Parameter values d1=PAR(1) d2=PAR(2) a1 = 5.d0 a2 = 0.1d0 b1 = 3.d0 b2 = 2.d0 f1=a1/(1d0 + b1*x) f2=a2/(1d0 + b2*y) ! Formulas F(1)= x*(1d0 - x) - f1*x*y F(2)= f1*x*y - d1*y - f2*y*z F(3)= f2*y*z - d2*z IF(.NOT.IJAC)RETURN ! Jacobian elements DFDU(1,1)=1d0-2*x-f1*y+b1*x*y*(f1**2)/a1 DFDU(1,2)=-f1*x DFDU(1,3)=0.0d0 DFDU(2,1)=f1*y-b1*x*y*(f1**2)/a1 DFDU(2,2)=f1*x-d1-f2*z+b2*y*z*(f2**2)/a2 DFDU(2,3)=-f2*y DFDU(3,1)=0.0d0 DFDU(3,2)=f2*z-b2*y*z*(f2**2)/a2 DFDU(3,3)=f2*y-d2 END SUBROUTINE RHS SUBROUTINE FUNC(NDIM,U,ICP,PAR,IJAC,F,DFDU,DFDP) ! ---------- --- IMPLICIT NONE INTEGER NDIM,ICP(*),IJAC DOUBLE PRECISION U(NDIM),PAR(*),F(NDIM),DFDU(NDIM,*),DFDP(NDIM,*) DOUBLE PRECISION A(3,3) CALL RHS(3,U,PAR,F,A,NDIM/=3) IF(NDIM==3)RETURN F(1:3) = PAR(11)*F(1:3) IF(NDIM==6)THEN ! Variational equations ! PAR(11) = cycle period ! PAR(12) = log(FM) F(4:6) = PAR(11)*MATMUL(A(:,:),U(4:6))-PAR(12)*U(4:6) RETURN ENDIF ! Adjoint variational equations ! PAR(11) = cycle period ! PAR(4) = log(FM) F(4:6) = -PAR(11)*MATMUL(TRANSPOSE(A(:,:)),U(4:6))-PAR(4)*U(4:6) ! Functions limit cycle doubled U(7-9) ! We pretend this is a second different cycle CALL RHS(3,U(7:9),PAR,F(7:9),A,.TRUE.) F(7:9) = PAR(6)*F(7:9) ! Period=PAR(6), obviously equal to PAR(11), U(10-12) ! PAR(5) = log(FM) F(10:12) = -PAR(6)*MATMUL(TRANSPOSE(A(:,:)),U(10:12))-PAR(5)*U(10:12) IF(NDIM==12)RETURN ! Connection rescaled, PAR(7) = Tc CALL RHS(3,U(13:15),PAR,F(13:15),A,.FALSE.) F(13:15) = PAR(7)*F(13:15) END SUBROUTINE FUNC SUBROUTINE STPNT(NDIM,U,PAR) ! ---------- --- IMPLICIT NONE INTEGER NDIM DOUBLE PRECISION, INTENT(INOUT) :: U(NDIM), PAR(*) DOUBLE PRECISION FLOQ,epsilon IF(NDIM==12)THEN ! extending from NDIM=6 to NDIM=12 U(7:12)=U(1:6) RETURN ELSEIF(NDIM==15)THEN ! extending from NDIM=12 to NDIM=15 epsilon=PAR(13) U(13:15)=PAR(14:16) + epsilon*PAR(17:19) RETURN ENDIF ! 0.16