Partial Differential Equation Toolbox |

Hints and Suggestions for Using Command-Line Functions

Several examples of command-line function usage are given in Common PDE Problems.

Use the export facilities of the GUI as much as you can. They provide data structures with the correct syntax, and these are good starting points that you can modify to suit your needs.

A good way to produce a Geometry M-file describing a geometry outside of the possibilities provided by the GUI is to draw a similar geometry using the GUI, export the Decomposed Geometry matrix, and write a Geometry M-file with `wgeom`. The special segments can then be edited by hand. An example of a hand-tailored Geometry M-file is `cardg`. See also the reference page for `pdegeom`.

Working with the system matrices and vectors produced by `assema` and assemb can sometimes be valuable. When solving the same equation for different loads or boundary conditions, it pays to assemble the stiffness matrix only once. Point loads on a particular node can be implemented by adding the load to the corresponding row in the right side vector. A nonlocal constraint can be incorporated into the `H` and `R` matrices.

An example of a hand-written Coefficient M-file is `circlef` that produces a point load. You can find the full example in `pdedemo7` and on the `assempde` reference page.

The routines for adaptive mesh generation and solution are powerful but can lead to dense meshes and thus long computation times. Setting the `Ngen` parameter to one limits you to a single refinement step. This step can then be repeated to show the progress of the refinement. The `Maxt` parameter helps you stop before the adaptive solver generates too many triangles. An example of a hand-written triangle selection function is `circlepick`, used in `pdedemo7`. Remember that you always need a decomposed geometry with `adaptmesh`.

Deformed meshes are easily plotted by adding offsets to the Point matrix `p`. Assuming two variables stored in the solution vector `u`:

-     np=size(p,2);
      pdemesh(p+scale*[u(1:np) u(np+1:np+np)]',e,t)

The time evolution of eigenmodes is obtained by, e.g.,

-     u1=u(:,mode)*cos(sqrt(l(mode))*tlist) % hyperbolic

for positive eigenvalues in hyperbolic problems, or

-     u1=u(:,mode)*exp(-l(mode)*tlist); % parabolic

in parabolic problems. This makes nice animations, perhaps together with deformed mesh plots.

| Data Structures and Utility Functions |  | Common PDE Problems |