| 1 | !---------------------------------------------------------------------- |
| 2 | !---------------------------------------------------------------------- |
| 3 | ! cusp.f90 - cusp normal form |
| 4 | !---------------------------------------------------------------------- |
| 5 | !---------------------------------------------------------------------- |
| 6 | |
| 7 | SUBROUTINE FUNC(NDIM,U,ICP,PAR,IJAC,F,DFDU,DFDP) |
| 8 | !--------- ---- |
| 9 | |
| 10 | ! Evaluates the algebraic equations or ODE right hand side |
| 11 | |
| 12 | ! Input arguments : |
| 13 | ! NDIM : Dimension of the algebraic or ODE system |
| 14 | ! U : State variables |
| 15 | ! ICP : Array indicating the free parameter(s) |
| 16 | ! PAR : Equation parameters |
| 17 | |
| 18 | ! Values to be returned : |
| 19 | ! F : Equation or ODE right hand side values |
| 20 | |
| 21 | ! Normally unused Jacobian arguments : IJAC, DFDU, DFDP (see manual) |
| 22 | |
| 23 | IMPLICIT NONE |
| 24 | INTEGER, INTENT(IN) :: NDIM, IJAC, ICP(*) |
| 25 | DOUBLE PRECISION, INTENT(IN) :: U(NDIM), PAR(*) |
| 26 | DOUBLE PRECISION, INTENT(OUT) :: F(NDIM) |
| 27 | DOUBLE PRECISION, INTENT(INOUT) :: DFDU(NDIM,NDIM),DFDP(NDIM,*) |
| 28 | |
| 29 | DOUBLE PRECISION x, mu, lambda |
| 30 | |
| 31 | x = U(1) |
| 32 | lambda = PAR(1) |
| 33 | mu = PAR(2) |
| 34 | F(1)= mu + lambda*x - x**3 |
| 35 | |
| 36 | END SUBROUTINE FUNC |
| 37 | |
| 38 | !----------------------------------------------------------------------- |
| 39 | !----------------------------------------------------------------------- |
| 40 | |
| 41 | SUBROUTINE STPNT(NDIM,U,PAR,T) |
| 42 | !--------- ----- |
| 43 | |
| 44 | ! Input arguments : |
| 45 | ! NDIM : Dimension of the algebraic or ODE system |
| 46 | |
| 47 | ! Values to be returned : |
| 48 | ! U : A starting solution vector |
| 49 | ! PAR : The corresponding equation-parameter values |
| 50 | |
| 51 | ! Note : For time- or space-dependent solutions this subroutine has |
| 52 | ! the scalar input parameter T contains the varying time or space |
| 53 | ! variable value. |
| 54 | |
| 55 | IMPLICIT NONE |
| 56 | INTEGER, INTENT(IN) :: NDIM |
| 57 | DOUBLE PRECISION, INTENT(INOUT) :: U(NDIM),PAR(*) |
| 58 | DOUBLE PRECISION, INTENT(IN) :: T |
| 59 | |
| 60 | ! Initialize the equation parameters |
| 61 | PAR(1:2) = (/ 1.0d0, 0.0d0 /) |
| 62 | |
| 63 | ! Initialize the solution |
| 64 | U(1) = 0.0d0 |
| 65 | |
| 66 | END SUBROUTINE STPNT |
| 67 | |
| 68 | !---------------------------------------------------------------------- |
| 69 | !---------------------------------------------------------------------- |
| 70 | |
| 71 | SUBROUTINE BCND(NDIM,PAR,ICP,NBC,U0,U1,FB,IJAC,DBC) |
| 72 | !--------- ---- |
| 73 | |
| 74 | ! Boundary Conditions |
| 75 | |
| 76 | ! Input arguments : |
| 77 | ! NDIM : Dimension of the ODE system |
| 78 | ! PAR : Equation parameters |
| 79 | ! ICP : Array indicating the free parameter(s) |
| 80 | ! NBC : Number of boundary conditions |
| 81 | ! U0 : State variable values at the left boundary |
| 82 | ! U1 : State variable values at the right boundary |
| 83 | |
| 84 | ! Values to be returned : |
| 85 | ! FB : The values of the boundary condition functions |
| 86 | |
| 87 | ! Normally unused Jacobian arguments : IJAC, DBC (see manual) |
| 88 | |
| 89 | IMPLICIT NONE |
| 90 | INTEGER, INTENT(IN) :: NDIM, ICP(*), NBC, IJAC |
| 91 | DOUBLE PRECISION, INTENT(IN) :: PAR(*), U0(NDIM), U1(NDIM) |
| 92 | DOUBLE PRECISION, INTENT(OUT) :: FB(NBC) |
| 93 | DOUBLE PRECISION, INTENT(INOUT) :: DBC(NBC,*) |
| 94 | |
| 95 | !X FB(1)= |
| 96 | !X FB(2)= |
| 97 | |
| 98 | END SUBROUTINE BCND |
| 99 | |
| 100 | !---------------------------------------------------------------------- |
| 101 | !---------------------------------------------------------------------- |
| 102 | |
| 103 | SUBROUTINE ICND(NDIM,PAR,ICP,NINT,U,UOLD,UDOT,UPOLD,FI,IJAC,DINT) |
| 104 | !--------- ---- |
| 105 | |
| 106 | ! Integral Conditions |
| 107 | |
| 108 | ! Input arguments : |
| 109 | ! NDIM : Dimension of the ODE system |
| 110 | ! PAR : Equation parameters |
| 111 | ! ICP : Array indicating the free parameter(s) |
| 112 | ! NINT : Number of integral conditions |
| 113 | ! U : Value of the vector function U at `time' t |
| 114 | |
| 115 | ! The following input arguments, which are normally not needed, |
| 116 | ! correspond to the preceding point on the solution branch |
| 117 | ! UOLD : The state vector at 'time' t |
| 118 | ! UDOT : Derivative of UOLD with respect to arclength |
| 119 | ! UPOLD : Derivative of UOLD with respect to `time' |
| 120 | |
| 121 | ! Normally unused Jacobian arguments : IJAC, DINT |
| 122 | |
| 123 | ! Values to be returned : |
| 124 | ! FI : The value of the vector integrand |
| 125 | |
| 126 | IMPLICIT NONE |
| 127 | INTEGER, INTENT(IN) :: NDIM, ICP(*), NINT, IJAC |
| 128 | DOUBLE PRECISION, INTENT(IN) :: PAR(*) |
| 129 | DOUBLE PRECISION, INTENT(IN) :: U(NDIM), UOLD(NDIM), UDOT(NDIM), UPOLD(NDIM) |
| 130 | DOUBLE PRECISION, INTENT(OUT) :: FI(NINT) |
| 131 | DOUBLE PRECISION, INTENT(INOUT) :: DINT(NINT,*) |
| 132 | |
| 133 | !X FI(1)= |
| 134 | |
| 135 | END SUBROUTINE ICND |
| 136 | |
| 137 | !---------------------------------------------------------------------- |
| 138 | !---------------------------------------------------------------------- |
| 139 | |
| 140 | SUBROUTINE FOPT(NDIM,U,ICP,PAR,IJAC,FS,DFDU,DFDP) |
| 141 | !--------- ---- |
| 142 | ! |
| 143 | ! Defines the objective function for algebraic optimization problems |
| 144 | ! |
| 145 | ! Supplied variables : |
| 146 | ! NDIM : Dimension of the state equation |
| 147 | ! U : The state vector |
| 148 | ! ICP : Indices of the control parameters |
| 149 | ! PAR : The vector of control parameters |
| 150 | ! |
| 151 | ! Values to be returned : |
| 152 | ! FS : The value of the objective function |
| 153 | ! |
| 154 | ! Normally unused Jacobian argument : IJAC, DFDP |
| 155 | |
| 156 | IMPLICIT NONE |
| 157 | INTEGER, INTENT(IN) :: NDIM, ICP(*), IJAC |
| 158 | DOUBLE PRECISION, INTENT(IN) :: U(NDIM), PAR(*) |
| 159 | DOUBLE PRECISION, INTENT(OUT) :: FS |
| 160 | DOUBLE PRECISION, INTENT(INOUT) :: DFDU(NDIM),DFDP(*) |
| 161 | |
| 162 | !X FS= |
| 163 | |
| 164 | END SUBROUTINE FOPT |
| 165 | |
| 166 | !---------------------------------------------------------------------- |
| 167 | !---------------------------------------------------------------------- |
| 168 | |
| 169 | SUBROUTINE PVLS(NDIM,U,PAR) |
| 170 | !--------- ---- |
| 171 | |
| 172 | IMPLICIT NONE |
| 173 | INTEGER, INTENT(IN) :: NDIM |
| 174 | DOUBLE PRECISION, INTENT(IN) :: U(NDIM) |
| 175 | DOUBLE PRECISION, INTENT(INOUT) :: PAR(*) |
| 176 | |
| 177 | !---------------------------------------------------------------------- |
| 178 | ! NOTE : |
| 179 | ! Parameters set in this subroutine should be considered as ``solution |
| 180 | ! measures'' and be used for output purposes only. |
| 181 | ! |
| 182 | ! They should never be used as `true'' continuation parameters. |
| 183 | ! |
| 184 | ! They may, however, be added as ``over-specified parameters'' in the |
| 185 | ! parameter list associated with the AUTO-Constant NICP, in order to |
| 186 | ! print their values on the screen and in the ``p.xxx file. |
| 187 | ! |
| 188 | ! They may also appear in the list associated with AUTO-Constant NUZR. |
| 189 | ! |
| 190 | !---------------------------------------------------------------------- |
| 191 | ! For algebraic problems the argument U is, as usual, the state vector. |
| 192 | ! For differential equations the argument U represents the approximate |
| 193 | ! solution on the entire interval [0,1]. In this case its values must |
| 194 | ! be accessed indirectly by calls to GETP, as illustrated below. |
| 195 | !---------------------------------------------------------------------- |
| 196 | ! |
| 197 | ! Set PAR(2) equal to the L2-norm of U(1) |
| 198 | !X PAR(2)=GETP('NRM',1,U) |
| 199 | ! |
| 200 | ! Set PAR(3) equal to the minimum of U(2) |
| 201 | !X PAR(3)=GETP('MIN',2,U) |
| 202 | ! |
| 203 | ! Set PAR(4) equal to the value of U(2) at the left boundary. |
| 204 | !X PAR(4)=GETP('BV0',2,U) |
| 205 | ! |
| 206 | ! Set PAR(5) equal to the pseudo-arclength step size used. |
| 207 | !X PAR(5)=GETP('STP',1,U) |
| 208 | ! |
| 209 | !---------------------------------------------------------------------- |
| 210 | ! The first argument of GETP may be one of the following: |
| 211 | ! 'NRM' (L2-norm), 'MAX' (maximum), |
| 212 | ! 'INT' (integral), 'BV0 (left boundary value), |
| 213 | ! 'MIN' (minimum), 'BV1' (right boundary value). |
| 214 | ! |
| 215 | ! Also available are |
| 216 | ! 'STP' (Pseudo-arclength step size used). |
| 217 | ! 'FLD' (`Fold function', which vanishes at folds). |
| 218 | ! 'BIF' (`Bifurcation function', which vanishes at singular points). |
| 219 | ! 'HBF' (`Hopf function'; which vanishes at Hopf points). |
| 220 | ! 'SPB' ( Function which vanishes at secondary periodic bifurcations). |
| 221 | !---------------------------------------------------------------------- |
| 222 | |
| 223 | |
| 224 | END SUBROUTINE PVLS |
| 225 | |
| 226 | !---------------------------------------------------------------------- |
| 227 | !---------------------------------------------------------------------- |