PDETWO Example 1:
Supposed one wanted to solve the following system of partial
differential equations on the interval [0,1] x [0,1].
We desire the solution of the PDE above with
boundary conditions given by
With initial conditions given by
It terns out that this equation has an exact solution given by
This corresponds to the first example in the original reference to
PDETWO (given above). This is quite simple to solve with the
pdetwo gateway in octave. First the user must specify an octave
function "F.m" which evaluates the right hand side of the PDE
expressed in the following form
The incoming arguments to the octave function F.m are
t,x,y,u,ux,uy, duxx, and duyy (for each component of u). Here t
is the scalar time, x & y the scalar grid points, u a vector of
the NPDE unknowns, ux a vector of the x derivatives of these
unknowns, uy a vector of the y derivatives of these unknowns, and
duxx/duyy a matrix expressing the following derivatives
and
respectively.
With the background we can write our F.m function for evaluating the right hand
side of our PDEs. In addition to F.m, PDETWO requires the
information on the horizontal and vertical diffusion coefficients
DXX and DYY. This is provided in the form of two octave functions
DIFF_H.m and
DIFF_V.m .
PDETWO requires two sets of boundary conditions of the form
and
To implement this in octave we must specify two boundary
conditions functions. The vertical boundary condition function
will return AV, BV, and CV. The horizontal boundary condition
function will return AH, BH, and CH. Each are allowed input
arguments of t,x,y, and u (with the same meanings as above). Here
the horizontal boundary condition function is BNDRY_H.m, and the
vertical boundary condtion function is BNDRY_V.m.
Finally the user must specify the initial conditions. In this
example the initial conditions are computed and passed into
pdecol.m. The initial conditions are compute with UINIT.m. An initial
condition function is not explicitly called by the FORTRAN pdetwo
code and is simply used for convenience.
Once this code is written a person can call "pdetwo.m". Here we
present an example pdetwo_Script.m driver file.
Finally, we can reap the benefits of our work by viewing the
solution to our problem:
Note that this is a replica of the plot given in the Sincovec and
Madsen paper but for a more refined mesh.
John Weatherwax
Last modified: Thu Jul 6 21:20:27 EDT 2006