Skip to content

Commit

Permalink
Merge pull request #273 from dynamicslab/parametric_library
Browse files Browse the repository at this point in the history
Parametric library
  • Loading branch information
znicolaou authored Jan 6, 2023
2 parents a299cd8 + 46a8965 commit f6b970b
Show file tree
Hide file tree
Showing 104 changed files with 7,728 additions and 524 deletions.
15 changes: 15 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/c.cycle_even
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dat='cycle_even.dat'
NDIM= 4, IPS = 9, IRS = 0, ILP = 1
PAR={1:-1,11:50.26548245743669}
ICP = [1,11,2,3,4]
NTST= 256, NCOL= 4, IAD = 1, ISP = 2, ISW = 1, IPLT= 0, NBC= 0, NINT= 0
NMX= 1000, NPR= 1, MXBF= 0, IID = 2, ITMX= 10, ITNW= 7, NWTN= 3, JAC= 0
EPSL= 1e-05, EPSU = 1e-05, EPSS = 1e-05
DS = 0.001, DSMIN=1e-10, DSMAX= 1e-2, IADS= 1
NPAR = 15, THL = {}, THU = {2:0,3:0,4:0}
UZR = {1: [-1,0.1,2.5,5,7.5,10.0]}
RL0=-5.0
RL1=10.1
A1=0.8
IEQUIB = 0
IREV = [0,1,0,1]
15 changes: 15 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/c.cycle_odd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dat='cycle_odd.dat'
NDIM= 4, IPS = 9, IRS = 0, ILP = 1
PAR={1:-1,11:50.26548245743669}
ICP = [1,11,2,3,4]
NTST= 256, NCOL= 4, IAD = 1, ISP = 2, ISW = 1, IPLT= 0, NBC= 0, NINT= 0
NMX= 1000, NPR= 1, MXBF= 0, IID = 2, ITMX= 10, ITNW= 7, NWTN= 3, JAC= 0
EPSL= 1e-05, EPSU = 1e-05, EPSS = 1e-05
DS = 0.001, DSMIN=1e-10, DSMAX= 1e-2, IADS= 1
NPAR = 15, THL = {}, THU = {2:0,3:0,4:0}
UZR = {1: [-1,0.1,2.5,5,7.5,10.0]}
RL0=-5.0
RL1=1.0
A1=0.8
IEQUIB = 0
IREV = [1,0,1,0]
12 changes: 12 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/c.periodic_E
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dat='periodic.dat'
NDIM= 4, IPS = 4, IRS = 0, ILP = 1
ICP = [1,11,2,3,4]
PAR={1:-1,11:6.283185307179586}
NTST= 35, NCOL= 4, IAD = 1, ISP = 1, ISW = 1, IPLT= 0, NBC= 4, NINT= 0
NMX= 1000, NPR= 1, MXBF= 0, IID = 2, ITMX= 10, ITNW= 7, NWTN= 3, JAC= 0
EPSL= 1e-07, EPSU = 1e-07, EPSS = 1e-05
DS = 1e-6, DSMIN=1e-20, DSMAX= 1e-2, IADS= 1
NPAR = 4, THL = {}, THU = {2:0,3:0,4:0}
UZR = {1: [-1,0,2.5,5,7.5,10.0]}
RL0=-2.0
RL1=10.1
10 changes: 10 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/c.steady_E
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NDIM= 4, IPS = 1, IRS = 0, ILP = 1
ICP = [1,11,2,3,4]
NTST= 35, NCOL= 4, IAD = 1, ISP = 2, ISW = 1, IPLT= 0, NBC= 0, NINT= 0
NMX= 1000, NPR= 20, MXBF= 0, IID = 2, ITMX= 10, ITNW= 7, NWTN= 3, JAC= 1
EPSL= 1e-07, EPSU = 1e-07, EPSS = 1e-05
DS = 0.01, DSMIN=0.0001, DSMAX= 0.05, IADS= 1
NPAR = 15, THL = {}, THU = {2:0,3:0,4:0}
UZR = {1: [0.0,2.5,5,7.5,10.0]}
RL0=-0.1
RL1=10.1
141 changes: 141 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/cycle_even.dat

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/cycle_odd.dat

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/even.auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import numpy as np
import os

even=run('snaking_E',c='cycle_even')
sols=[]
pars=[]
for i in range(len(even[0])):
u=even(i+1)['U(1)']
t=even(i+1)['t']
e=even(i+1)['PAR(1)']
r=even(i+1)['PAR(2)']
b=even(i+1)['PAR(3)']
c=even(i+1)['PAR(4)']
T=even(i+1)['PAR(11)']
norm=even(i+1)['L2-NORM']
sols=sols+[np.vstack([t,u]).T]
pars=pars+[[e,r,b,c,T,norm]]

np.save('even_sols.npy',sols)
np.save('even_pars.npy',pars)
cl()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 21 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/odd.auto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import numpy as np
import os

odd=run('snaking_E',c='cycle_odd')
sols=[]
pars=[]
for i in range(len(odd[0])):
u=odd(i+1)['U(1)']
t=odd(i+1)['t']
e=odd(i+1)['PAR(1)']
r=odd(i+1)['PAR(2)']
b=odd(i+1)['PAR(3)']
c=odd(i+1)['PAR(4)']
T=odd(i+1)['PAR(11)']
norm=odd(i+1)['L2-NORM']
sols=sols+[np.vstack([t,u]).T]
pars=pars+[[e,r,b,c,T,norm]]

np.save('odd_sols.npy',sols)
np.save('odd_pars.npy',pars)
cl()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import numpy as np
import os

periodic=run('snaking_E_T',c='periodic_E')
sols=[]
pars=[]
for i in range(len(periodic[0])):
u=periodic(i+1)['U(1)']
t=periodic(i+1)['t']
e=periodic(i+1)['PAR(1)']
r=periodic(i+1)['PAR(2)']
b=periodic(i+1)['PAR(3)']
c=periodic(i+1)['PAR(4)']
T=periodic(i+1)['PAR(11)']
norm=periodic(i+1)['L2-NORM']
sols=sols+[np.vstack([t,u]).T]
pars=pars+[[e,r,b,c,T,norm]]

np.save('periodic_sols.npy',sols)
np.save('periodic_pars.npy',pars)
cl()
141 changes: 141 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/periodic.dat

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
160 changes: 160 additions & 0 deletions examples/17_parameterized_pattern_formation/data/auto/snaking_E.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
!----------------------------------------------------------------------
!----------------------------------------------------------------------
! cir : Homoclinic Bifurcation in an Electronic Circuit
! (the same equations as in demo tor)
!----------------------------------------------------------------------
!----------------------------------------------------------------------

SUBROUTINE FUNC(NDIM,U,ICP,PAR,IJAC,F,DFDU,DFDP)
! ---------- ----

IMPLICIT NONE
INTEGER, INTENT(IN) :: NDIM, ICP(*), IJAC
DOUBLE PRECISION, INTENT(IN) :: U(NDIM), PAR(*)
DOUBLE PRECISION, INTENT(OUT) :: F(NDIM)
DOUBLE PRECISION, INTENT(INOUT) :: DFDU(NDIM,NDIM), DFDP(NDIM,*)

DOUBLE PRECISION E
DOUBLE PRECISION P
DOUBLE PRECISION R
DOUBLE PRECISION B
DOUBLE PRECISION C
DOUBLE PRECISION DRDE
DOUBLE PRECISION DBDE
DOUBLE PRECISION DCDE

E=PAR(1)
P=2
R=-6.9142484373744839e-01-7.3260087859986806e-02*E-2.7462906764622484e-03*E*E
B=1.7910887544563148e+00-3.0554994266613233e-01*E-2.4878961651300643e-02*E*E
C=7.5841639153560658e-01+5.5761858956235276e-02*E+5.1480291789433611e-03*E*E
DRDE=-7.3260087859986806e-02-2.7462906764622484e-03*E*2
DBDE=-3.0554994266613233e-01-2.4878961651300643e-02*E*2
DCDE=5.5761858956235276e-02+5.1480291789433611e-03*E*2

F(1)= U(2)
F(2)= U(3)
F(3)= U(4)
F(4)= R*U(1)-P*U(3)-U(1)+B*U(1)**3-C*U(1)**5

IF(IJAC.EQ.0)RETURN

DFDU(1,1)=0.0d0
DFDU(1,2)=1.0d0
DFDU(1,3)=0.0d0
DFDU(1,4)=0.0d0

DFDU(2,1)=0.0d0
DFDU(2,2)=0.0d0
DFDU(2,3)=1.0d0
DFDU(2,4)=0.0d0

DFDU(3,1)=0.0d0
DFDU(3,2)=0.0d0
DFDU(3,3)=0.0d0
DFDU(3,4)=1.0d0

DFDU(4,1)=R-1.0d0+3.0d0*B*U(1)**2-5.0d0*C*U(1)**4
DFDU(4,2)=0.0d0
DFDU(4,3)=-P
DFDU(4,4)=0.0d0

IF(IJAC.EQ.1)RETURN

! *Parameter derivatives
DFDP(1,1)=0.0d0
DFDP(2,1)=0.0d0
DFDP(3,1)=0.0d0
DFDP(4,1)=U(1)*DRDE+U(1)**3*DBDE-U(1)**5*DCDE

END SUBROUTINE FUNC

SUBROUTINE STPNT(NDIM,U,PAR,T)
! ---------- -----

IMPLICIT NONE
INTEGER, INTENT(IN) :: NDIM
DOUBLE PRECISION, INTENT(INOUT) :: U(NDIM),PAR(*)
DOUBLE PRECISION, INTENT(IN) :: T

!----------------------------------------------------------------------
! Problem parameters (only PAR(1-9) are available to the user) :

U(1)=0.0
U(2)=0.0
U(3)=0.0
U(4)=0.0
PAR(1)=0.0 ! E

!----------------------------------------------------------------------
! If IEQUIB >0 put initial equilibrium in PAR(11+i), i=1,...,NDIM :

PAR(12) = 0.0
PAR(13) = 0.0
PAR(14) = 0.0
PAR(15) = 0.0


END SUBROUTINE STPNT

SUBROUTINE PVLS(NDIM,U,PAR)
! ---------- ----

IMPLICIT NONE
INTEGER, INTENT(IN) :: NDIM
DOUBLE PRECISION, INTENT(IN) :: U(NDIM)
DOUBLE PRECISION, INTENT(INOUT) :: PAR(*)
! Homoclinic bifurcations COMMON block needed here :
COMMON /BLHOM/ ITWIST,ISTART,IEQUIB,NFIXED,NPSI,NUNSTAB,NSTAB,NREV
INTEGER ITWIST,ISTART,IEQUIB,NFIXED,NPSI,NUNSTAB,NSTAB,NREV
INTEGER I

DOUBLE PRECISION E
DOUBLE PRECISION P
DOUBLE PRECISION R
DOUBLE PRECISION B
DOUBLE PRECISION C

E=PAR(1)
P=2
R=-6.9142484373744839e-01-7.3260087859986806e-02*E-2.7462906764622484e-03*E*E
B=1.7910887544563148e+00-3.0554994266613233e-01*E-2.4878961651300643e-02*E*E
C=7.5841639153560658e-01+5.5761858956235276e-02*E+5.1480291789433611e-03*E*E

PAR(2)=R
PAR(3)=B
PAR(4)=C

! If IEQUIB =0 put analytic equilibrium in PAR(11+i), i=1..NDIM

IF(IEQUIB.EQ.0)THEN
DO I=1,NDIM
PAR(11+I)= 0.0
ENDDO
ENDIF

END SUBROUTINE PVLS

!----------------------------------------------------------------------
SUBROUTINE BCND(NDIM,PAR,ICP,NBC,U0,U1,FB,IJAC,DBC)
! ---------- ----

IMPLICIT NONE
INTEGER, INTENT(IN) :: NDIM,ICP(*),NBC,IJAC
DOUBLE PRECISION, INTENT(IN) :: PAR(*),U0(NDIM),U1(NDIM)
DOUBLE PRECISION, INTENT(OUT) :: FB(NBC)
DOUBLE PRECISION, INTENT(INOUT) :: DBC(NBC,*)

FB(1)=U0(1)
FB(2)=U1(1)
FB(3)=U0(3)
FB(4)=U1(3)

END SUBROUTINE BCND
!----------------------------------------------------------------------

SUBROUTINE ICND
END SUBROUTINE ICND

SUBROUTINE FOPT
END SUBROUTINE FOPT
Loading

0 comments on commit f6b970b

Please sign in to comment.