echo off
%On utilise la toolbox ``\texttt{pde}\footnote{Cf.
%\href{http://www.comsol.se/Matlab/pde\_tb.html}
%{\texttt{http://www.comsol.se/Matlab/pde\_tb.html}}, \\
%voir aussi
% \href{http://www.indiana.edu/~statmath/math/matlab/pde.html}
% {\texttt{http://www.indiana.edu/{}\~{}statmath/math/matlab/pde.html}}}''
%de \texttt{matlab}:
%
%{\Small     \linespread{0.8}
%\begin{verbatim}
%
% Partial Differential Equation Toolbox.
% Version 1.0.1   15-Nov-1996
%
% New Features.
%   Readme      - Important release information about the PDE Toolbox
%                 (double click on Readme, or type "whatsnew directoryname",
%                  i.e. "whatsnew pde" to display this file).
%
% PDE algorithms.
%   adaptmesh   - Adaptive mesh generation and PDE solution.
%   assema      - Assemble area integral contributions.
%   assemb      - Assemble boundary condition contributions.
%   assempde    - Assemble a PDE problem.
%   hyperbolic  - Solve hyperbolic problem.
%   parabolic   - Solve parabolic problem.
%   pdeeig      - Solve eigenvalue PDE problem.
%   pdenonlin   - Solve nonlinear PDE problem.
%   poisolv     - Fast solution of Poisson's equation on a rectangular grid.
%
% User interface algorithms and utilities.
%   pdecirc     - Draw circle.
%   pdeellip    - Draw ellipse.
%   pdemdlcv    - Convert Matlab 4.2c Model M-files for use with Matlab 5.
%   pdepoly     - Draw polygon.
%   pderect     - Draw rectangle.
%   pdetool     - PDE Toolbox graphical user interface (GUI).
%
% Geometry algorithms.
%   csgchk      - Check validity of Geometry Description matrix.
%   csgdel      - Delete borders between minimal regions.
%   decsg       - Decompose Constructive Solid Geometry into minimal regions.
%   initmesh    - Build an initial triangular mesh.
%   jigglemesh  - Jiggle internal points of a triangular mesh.
%   pdearcl     - Interpolation between parametric representation and arc length.
%   poimesh     - Make regular mesh on a rectangular geometry.
%   refinemesh  - Refines a triangular mesh.
%   wbound      - Write boundary condition specification data file.
%   wgeom       - Write geometry specification data file.
%
% Plot functions.
%   pdecont     - Shorthand command for contour plot.
%   pdegplot    - Plot a PDE geometry.
%   pdemesh     - Plot a PDE triangular mesh.
%   pdeplot     - Generic PDE Toolbox plot function.
%   pdesurf     - Shorthand command for surface plot.
%
% Utility algorithms.
%   dst         - Discrete sine transform.
%   idst        - Inverse discrete sine transform.
%   pdeadgsc    - Pick bad triangles using a relative tolerance criterion.
%   pdeadworst  - Pick bad triangles relative to the worst value.
%   pdecgrad    - Compute the flux of a PDE solution.
%   pdeent      - Indices of triangles neighboring a given set of triangles.
%   pdegrad     - Compute the gradient of the PDE solution.
%   pdeintrp    - Interpolate function values to triangle midpoints.
%   pdejmps     - Error estimates for adaption.
%   pdeprtni    - Interpolate function values to mesh nodes.
%   pdesde      - Indices of edges adjacent to a set of subdomains.
%   pdesdp      - Indices of points in a set of subdomains.
%   pdesdt      - Indices of triangles in a set of subdomains.
%   pdesmech    - Compute structural mechanics tensor functions.
%   pdetrg      - Triangle geometry data.
%   pdetriq     - Measure the quality of mesh triangles.
%   poiasma     - Boundary point matrix contributions for Poisson's equation.
%   poicalc     - Fast solution of Poisson's equation on a rectangular grid.
%   poiindex    - Indices of points in canonical ordering for rectangular grid.
%   sptarn      - Solve generalized sparse eigenvalue problem.
%   tri2grid    - Interpolate from PDE triangular mesh to rectangular mesh.
%
% User defined algorithms.
%   pdebound    - Boundary M-file.
%   pdegeom     - Geometry M-file.
%
% Demonstrations.
%   pdedemo1    - Exact solution of Poisson's equation on unit disk.
%   pdedemo2    - Solve Helmholtz's equation and study the reflected waves.
%   pdedemo3    - Solve a minimal surface problem.
%   pdedemo4    - Solve PDE problem using subdomain decomposition.
%   pdedemo5    - Solve a parabolic PDE (the heat equation).
%   pdedemo6    - Solve a hyperbolic PDE (the wave equation).
%   pdedemo7    - Adaptive solution with point source.
%   pdedemo8    - Solve Poisson's equation on rectangular grid.
%
% Copyright (c) 1994-96 by The MathWorks, Inc.
%       $Revision: 1.6 $  $Date: 1996/11/01 20:31:16 $
%
%\end{verbatim}
%
%
%Programme pdesect.m:
%
%\begin{verbatim}
%
%PDEsect         FEM Solution sur secteur

echo on
clear
clc
%       Solve Poisson's equation
%        -div(grad(u))=1
%       sur secteur      with u=0 on the boundary.
%       Compare with exact solution.
pause % Strike any key to continue.
clc

%       Problem definition
%g='secteur'; % The unit circle
%b='sectb1'; % 0 on the boundary
%c=1;
%a=0;
%f=1;
%       A coarse initial mesh
g='parab';
%[p,e,t]=initmesh(g,'hmax',1);
[p,e,t]=initmesh(g,'hmax',0.25);
pause % Strike any key to continue.
plot(p(1,:),p(2,:),'o');
hold on;
for jj=1:size(t,2),
   xj(1)=p(1,t(1,jj));xj(2)=p(1,t(2,jj));xj(3)=p(1,t(3,jj));
   yj(1)=p(2,t(1,jj));yj(2)=p(2,t(2,jj));yj(3)=p(2,t(3,jj));
   plot(xj,yj);
end;
c=1;
a=0;
f='0*x';
b='bparab'; % 0 on the boundary
  [matK,phi]=assempde(b,p,e,t,c,a,f);...
matK
phi'
  u=matK\phi;
pdeplot(p,e,t,'xydata',u,'mesh','on','contour','on');
