AUTO の流れ:continuation は,extrbv stupbv stplbv (adapt) -> extrbv を反復しながら行っている.


main.c main

autlib1.c autoae -> cnrlae

//Generate the starting point
stpnt
pvli

newlab //Determine a suitable starting label and branch number
sthd //Write constants
stplae //Write plotting data for the starting point
stprae //Starting procedure (to get second point on first branch)
swpnt //Initialize computation of the next bifurcating branch

stplae //Store plotting data for first point on the bifurcating branch
swprc //Determine the second point on the bifurcating branch
stplae //Store plotting data for second point

contae //Provide initial approximation to the next point on the branch
solvae //Find the next solution point on the branch

lcspae //Check for user supplied parameter output parameter-values

main

-> autobv (if(list.type==AUTOBV) list.type は,set_function_pointers 内で,iap の値で決定される.)

-> cnrlbv

-> rsptbv, setrtn, stdrbv, sthd, stplbv, extrbv

Ex1 : c=ab.1

AUTO > run(c="ab.1")
Starting ab ...
# call autoae
# call sthd

BR PT TY LAB PAR(1) L2-NORM U(1) U(2)
1 1 EP 1 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00
1 33 LP 2 1.057390E-01 1.484391E+00 3.110230E-01 1.451441E+00
...


Ex2 : c="ab.2"

AUTO> run(c="ab.2",s="ab1")
Starting ab ...
# call autobv
# call cnrlbv
# call rsptbv
# call STPNT_TYPE_BVP(*stpnt) in rsptbv
# call stpnps
# call funi in stpnps
# call setrtn
# call sthd (output to fort.7)
# call stplbv (output to fort.8)

BR PT TY LAB PAR(1) L2-NORM MAX(1) MAX(2) PERIOD
# call extrbv
# call stplbv
# call extrbv
# call stupbv
# call stplbv
# call adapt
# call extrbv
# call stupbv
# call stplbv
# call extrbv
# call stupbv
# call stplbv
# call extrbv
# call stupbv
...
# call extrbv
# call stupbv
# call stplbv
4 30 6 1.198815E-01 3.987129E+00 9.919113E-01 7.020342E+00 2.721044E+00
# call adapt
# call extrbv
# call stupbv


stplbv -> wrtbv8 を呼んで, fort.8 に軌道座標を出力している.

軌道の座標は,rsptbv 内で計算して ups 内に保存している.

rsptbv

-> STPNT_TYPE_BVP( (*stpnt) ), adapt, stupbv


sthd では,fort.7 に出力.

continuation は,extrbv stupbv stplbv (adapt) -> extrbv を反復しながら行っている.

STPNT_TYPE_BVP in auto_c.h

/* This is the type for all functions that can be used at starting points
for BVPs */
#define STPNT_TYPE_BVP(X) int X(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsrs, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu)
...
//autlib1.c
STPNT_TYPE_BVP(stpnbv);
STPNT_TYPE_BVP(stpnub);
...

//autlib3.c
STPNT_TYPE_BVP(stpnps);
STPNT_TYPE_BVP(stpnpo);
STPNT_TYPE_BVP(stpnbl);


adapt

-> newmsh interp


c.ab.2 では, stpnps が呼ばれる.

stpnps

-> findlb, readlb, funi, scaleb

パラメータ変更毎に,istop==1 となれば L5 に飛んで stplae で,出力している.

istop は,

lcspae 終了後の iap->istop で更新される.

lcspae は,

Check for user supplied parameter output parameter-values

Check for fold

Check for branch point

Check for Hopf bifurcation

のために呼ばれる.

lcspae

Detection of Singular Points
// This subroutine uses the secant method to accurately locate special
// points (branch points, folds, Hopf bifurcations, user zeroes).
// These are characterized as zeroes of the function FNCS supplied in the call.

// This subroutine calls CONT and SOLVAE with varying stepsize RDS.
// The special point is assumed to have been found with sufficient
// accuracy if the ratio between RDS and the user supplied value of
// DS is less than the user-supplied toler du.
...

lcspae は,FNCS_TYPE_AE( (* fncs) ) を引数にしており,内部で次を実行する.

  q1 = (*fncs)(iap, rap, par, icp, &chng, funi, m1aaloc, 
aa, rlcur, rlold, rldot, u, uold, udot,
rhs, dfdu, dfdp, iuz, vuz);

FNCS_TYPE_AE は,auto_c.h 内で次のように定義されている.

/*This is the type for all functions which can be used to detect
special points for algebraic problems */
#define FNCS_TYPE_AE(X) doublereal X(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, logical *chng, FUNI_TYPE( (*funi) ), integer *m1aaloc, doublereal **aa, doublereal *rlcur, doublereal *rlold, doublereal *rldot, doublereal *u, doublereal *uold, doublereal *udot, doublereal *rhs, doublereal *dfdu, doublereal *dfdp, integer *iuz, doublereal *vuz)

...

// それぞれ,fp9 への出力を担う.
FNCS_TYPE_AE(fnbpae); // BP Function

FNCS_TYPE_AE(fnlpae); // Fold Function
FNCS_TYPE_AE(fnhbae); // Hopf Function,Eigenvalues
FNCS_TYPE_AE(fnuzae); // User Func.


fnbpae in autlib1.c は次のようなもの.

doublereal 
fnbpae(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, logical *chng, FUNI_TYPE( (*funi) ), integer *m1aaloc, doublereal **aa, doublereal *rlcur, doublereal *rlold, doublereal *rldot, doublereal *u, doublereal *uold, doublereal *udot, doublereal *rhs, doublereal *dfdu, doublereal *dfdp, integer *iuz, doublereal *vuz)
{
/* System generated locals */
doublereal ret_val;

/* Local variables */
integer ntop, ntot, iid, ibr;
doublereal det;



iid = iap->iid;
ibr = iap->ibr;
ntot = iap->ntot;
ntop = (ntot + 1) % 10000;

det = rap->det;
ret_val = det;
*chng = TRUE_;

/* If requested write additional output on unit 9 : */

if (iid >= 2 && iap->mynode == 0) {
fprintf(fp9,"%4li%6li BP Function %14.5E\n",ibr,ntop,ret_val);
}

return ret_val;
} /* fnbpae_ */

iap は,次のような型 iap_type の変数である.

typedef struct {
/* 1 */ integer ndim;
/* 2 */ integer ips;
/* 3 */ integer irs;
/* 4 */ integer ilp;
/* 5 */ integer ntst;
/* 6 */ integer ncol;
/* 7 */ integer iad;
/* 8 */ integer iads;
/* 9 */ integer isp;
/* 10 */ integer isw;
/* 11 */ integer iplt;
/* 12 */ integer nbc;
/* 13 */ integer nint;

#ifdef MANIFOLD
/* 13a*/ integer nalc; /* The number of arclength constraints (k) */
#endif
/* 14 */ integer nmx;
/* 15 */ integer nuzr;
/* 16 */ integer npr;
/* 17 */ integer mxbf;
/* 18 */ integer iid;
/* 19 */ integer itmx;
/* 20 */ integer itnw;
/* 21 */ integer nwtn;
/* 22 */ integer jac;
/* 23 */ integer ndm;
/* 24 */ integer nbc0;
/* 25 */ integer nnt0;
/* 26 */ integer iuzr;
/* 27 */ integer itp;
/* 28 */ integer itpst;
/* 29 */ integer nfpr;
/* 30 */ integer ibr;
/* 31 */ integer nit;
/* 32 */ integer ntot;
/* 33 */ integer nins;
/* 34 */ integer istop;
/* 35 */ integer nbif;
/* 36 */ integer ipos;
/* 37 */ integer lab;
/* 41 */ integer nicp;
/* The following are not set in init_.

They have to do with the old parallel version. */
/* 38 */ integer mynode;
/* 39 */ integer numnodes;
/* 40 */ integer parallel_flag;
} iap_type;

これは,main 文の中で init 関数を用いて初期かされるが,

init 自体は,autlib1.c 内で次のように定義されている.

init(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, doublereal *thl, doublereal **thu_pointer, integer **iuz_pointer, doublereal **vuz_pointer, logical *eof,integer nalc)
{
...




main 内 solvae で数値積分? FUNI_TYPE( (*funi) ) を引数にしており,

内部で,実行している.

(*funi)(iap, rap, ndim, u, uold, icp, par, 2, f, dfdu, dfdp);

FUNI_TYPE の定義 in auto_c.h

/*This is the type for all functions which can be used as "funi" the function
which evaluates the right hand side of the equations and generates

the Jacobian*/
#define FUNI_TYPE(X) int X(const iap_type *iap, const rap_type *rap, integer ndim, doublereal *u, const doublereal *uold, const integer *icp, doublereal *par, integer ijac, doublereal *f, doublereal *dfdu, doublereal *dfdp)

...

typedef struct {
FUNI_TYPE( (*funi) );
STPNT_TYPE_AE( (*stpnt) );
PVLI_TYPE_AE( (*pvli) );
} autoae_function_list;

typedef struct {
int type;
autobv_function_list bvlist;
autoae_function_list aelist;
} function_list;
...

/* autlib3.c */
FUNI_TYPE(fnlp);
STPNT_TYPE_AE(stpnlp);
FUNI_TYPE(fnc1);
STPNT_TYPE_AE(stpnc1);
FUNI_TYPE(fnc2);
STPNT_TYPE_AE(stpnc2);
FUNI_TYPE(fnds);
FUNI_TYPE(fnti);
FUNI_TYPE(fnhd);
STPNT_TYPE_AE(stpnhd);
FUNI_TYPE(fnhb);
STPNT_TYPE_AE(stpnhb);
FUNI_TYPE(fnhw);
STPNT_TYPE_AE(stpnhw);
FUNI_TYPE(fnps);
BCNI_TYPE(bcps);
ICNI_TYPE(icps);

int pdble(const iap_type *iap, const rap_type *rap, integer *ndim, integer *ntst, integer *ncol, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal *tm, doublereal *par);
STPNT_TYPE_BVP(stpnps);
FUNI_TYPE(fnws);
FUNI_TYPE(fnwp);
int stpnwp(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fnsp);
FUNI_TYPE(fnpe);
ICNI_TYPE(icpe);
FUNI_TYPE(fnpl);
BCNI_TYPE(bcpl);
ICNI_TYPE(icpl);
int stpnpl(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fnpd);
BCNI_TYPE(bcpd);
ICNI_TYPE(icpd);
int stpnpd(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fntr);

int bctr(const iap_type *iap, const rap_type *rap, integer ndim, doublereal *par, const integer *icp, integer nbc, const doublereal *u0,const doublereal *u1, doublereal *f, integer ijac, doublereal *dbc);
ICNI_TYPE(ictr);

int stpntr(iap_type *iap, rap_type *rap, doublereal *par, integer *icp, integer *ntsr, integer *ncolrs, doublereal *rlcur, doublereal *rldot, integer *ndxloc, doublereal **ups, doublereal **udotps, doublereal **upoldp, doublereal *tm, doublereal *dtm, integer *nodir, doublereal *thl, doublereal *thu);
FUNI_TYPE(fnpo);
BCNI_TYPE(bcpo);
ICNI_TYPE(icpo);
STPNT_TYPE_BVP(stpnpo);
FUNI_TYPE(fnbl);
BCNI_TYPE(bcbl);
ICNI_TYPE(icbl);
STPNT_TYPE_BVP(stpnbl);
FUNI_TYPE(funi);
BCNI_TYPE(bcni);
ICNI_TYPE(icni);
...


で,funi は autlib3.c の 4363 行目から定義されている.

/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */
/* Routines for Interface with User Supplied Routines */

/* (To generate Jacobian by differencing, if not supplied analytically) */
/* ----------------------------------------------------------------------- */
/* ----------------------------------------------------------------------- */

/* ---------- ---- */
/* Subroutine */ int
funi(const iap_type *iap, const rap_type *rap, integer ndim, doublereal *u, const doublereal *uold, const integer *icp, doublereal *par, integer ijac, doublereal *f, doublereal *dfdu, doublereal *dfdp)
{
...
user.func(ndim, u, icp, par, ijc, f, dfdu, dfdp);
...
user.func(ndim, u, icp, par, 0, f1zz, dfdu, dfdp);
...

この中で,ユーザー定義の func が実行されている.

user は, user_function_list 型の変数で,

auto_f2c.h 内で,次のように定義されている.

const user_function_list user = { func, stpnt, bcnd, icnd, fopt, pvls, 0 };

この,func, stpnt, bcnd, icnd, fopt, pvls がユーザー定義の関数与える.

function_list は,main.c 内 main 関数の中で次のように初期化されている.

...
function_list list 
...
set_function_pointers(iap,&list);

set_function_pointers は次のようになっている.(autlib1.c)

int set_function_pointers(const iap_type iap,function_list *data) {
if ( (iap.ips == 0 || iap.ips == 1) && abs(iap.isw) != 2) {
/* ** Algebraic systems. */

if (iap.irs == 0) {
data->type = AUTOAE;
data->aelist.funi = funi;
data->aelist.stpnt = stpnus;
data->aelist.pvli = pvlsae;
} else {
data->type = AUTOAE;
data->aelist.funi = funi;
data->aelist.stpnt = stpnae;
data->aelist.pvli = pvlsae;
}
} else if (iap.ips == 11 && abs(iap.isw) != 2) {
/* ** Waves : Spatially homogeneous solutions, */

if (iap.irs == 0) {
data->type = AUTOAE;
...