pde2path: Brief structural and function overview
To implement a continuation problem for pde2path the user needs to supply some variables and functions.
The first step is usually of the form p=[];
p=stanparam(p),
which creates a standard pde2path problem struct p, and
initializes most fields in p to standard values.
Then of course we need to set the problem dependent fields.
We recommend to
put this initialization into a function
such as
acinit
(from ac1D_simple, see Section 2 in the "Allen-Cahn tutorial", for a description)
A minimal setting contains:
- Function handles to routines defining the PDE (sG) and the boundary conditions.
- Domain and mesh initializations, and, in the OOPDE setting, FEM operator initializations via oosetfemops
- Initial conditions and settings for the continuation to be done.
- Additionally, function handles for Jacobians ( sGjac) are recomended and usually simple to implement.
Main fields in the structure p
The data in a pde2path structure p is organized as follows. Most values for stationary problems are initialized to standard values via stanparam, while p.hopf is initialized via hostanparam.- fuha: struct of function handles; in particular defining the PDE (G=0), boundary condition and Jacobian (Gu).
- nc,sw: structs of numerical controls such as p.nc.tol, p.nc.nq, ..., and switches such as p.sw.bifcheck, ...
- u,np,nu: the solution u ( including all parameters / auxiliary variables in u(p.nu+1:end) ), the number of nodes p.np in the mesh, and the number of nodal values p.nu of PDE-variables
- tau,branch: tangent tau(1:p.nu+p.nc.nq+1), and the branch, filled via bradat.m and p.fuha.outfu.
- sol: struct of other values/fields calculated at runtime
- eqn: the tensors c; a; b for the simple FEM setup
- pdeo: an OOPDE pde object, containing the geometry data, mesh, and FEM data; if the legacy pdetoolbox setup is used, then the geometry and mesh are in p.mesh
- plot,file: structs of switches (and, e.g., figure numbers and directory name) for plotting and file output
- time,pm: structs of timing information, and pmcont switches
- fsol: switches for the interface to fsolve.
- mat: problem matrices, e.g., mass / stiffness matrices M, K for the the simple FEM setting, and drop and fill for periodic BC; by default, the fields mat is not saved to disk.
- hopf: Hopf data, initialized by hoswibra, and further filled at runtime.
Functions typically called during init (in the OOPDE setting)
- p=stanparam(p): sets many parameters to "standard" values; typically called during initialization; also serves as a documentation of the meaning of parameters. See also here.
- pdeo=stanpdeo1D(lx,h): generate pde-object in the OOPDE setting; see also stanpdeo2D, stanpdeo3D
- p=oosetfemops(p): set the FEM operators such as M, K
- p=setfn(p,name): set output directory to name (or "p", if name omitted).
Main functions for user calls
- p=cont(p): continuation of problem p.
- p=pmcont(p): parallel multi-predictor version of cont.
- p=findbif(p,varargin): bifurcation detection via change of stability index; alternative to bifurcation detection in cont or pmcont.
- p=swibra(dir,bpnr,var): branch-switching.
- p=hoswibra(dir,bpnr,var): Hopf branch-switching.
- p=swipar(p,var): switch parametrization, see also swiparf.
- p=spcontini(dir,name,npar): initialization for "spectral continuation".
- p=spcontexit(dir,name): exit spectral continuation.
- p=setpar(p,par): set parameter values, see also par=getpar(p,varargin).
Most basic plotting routines
- plotbra(p,var): plot branch in p, see also plotbraf, and the settings in p.plot field.
- plotsol(p,wnr,cmp,style): plot solution, see also plotsolu and plotsolf.
- hoplot(p,wnr,cnr,var): plot periodic orbit contained in p.hopf.y.
Misc additional routines
- [u,...]=nloop(p,u1) : Newton-loop for (G(u);q(u))=0 (often called for preparation).
- p=loadp(dir,pname,varargin): load point pname from dir; varargin to set new dir.
- p=meshref(p): adaptively refine mesh, see also p=meshadac(p).
- err=errcheck(p): compute error-estimate.
- p=tint(p,dt,nt,pmod): time integration of u_t = -G(u); see also tintx for a version with more output.
- p=tints(p,dt,nt,pmod,nu): time integration for semilinear case, see also tintxs.