Assume that you want to solve the convection-diffusion equation
You start FEMLAB by typing
>> femlab
in the MATLAB command window.
The Model Navigator is invoked.
The Model Navigator is a dialog box used to control the overall
settings of a FEMLAB session. It has five pages, one of which is the
New page used for initialising application mode models.
Select PDE modes on the New page. Expand the sub-tree
PDE modes by double-clicking in the tree control.
To start a new problem using the Coefficient, Linear stationary
PDE mode,
select Coefficient and press OK to confirm and to close
the Model Navigator.
The GUI is opened in the Coefficient, Linear stationary PDE mode.
The current mode is displayed on the bar at the top of the FEMLAB
window.
Options and Settings
The overall settings of the GUI often need to be adjusted. This could
include, for example, altering the axis limits settings, if the
geometry you wish to draw does not fit the default settings.
Open the Axes/Grid Settings dialog box from the Options
menu.
On the Axis page, enter -0.1, 1.1, -0.1, and 1.1 as
X min, X max, Y min, and Y max,
respectively.
On the Grid page, deselect the Auto check box. Enter
0.2 as X (spacing) and 0.2 as Y (spacing).
Press OK to close the dialog box and to apply the settings.
Draw Mode
First we define the geometry of the model in the draw mode.
Draw mode is the state of the GUI after leaving the
Model Navigator by pressing the OK button.
Draw a square with corners in (0,0), (0,1), (1,1), and (1,0).
Press the Draw Rectangle button on the draw toolbar and,
using the right mouse button, click-and-drag to create the square.
You will find the draw toolbar to the left in the GUI window. (You
can also choose Rectangle/Square from the Options menu.)
The snap-to-grid option is selected by default - this will aid you
in aligning the pointer to a rectangular grid and finding the exact
coordinates.
Boundary Mode
The boundary conditions are set in the boundary mode. You select a
boundary by clicking on it in the GUI or by selecting the
corresponding boundary number in the Boundary selection
list box in the Boundary Conditions dialog box.
To define the boundary conditions, select
Specify Boundary Conditions... on the Boundary
menu. This will open the Boundary Conditions dialog
box.
Select the left boundary in the figure window by clicking on it. Then
enter 1 into the r edit field and press Apply.
Next do the same for the right and upper boundaries.
Since the default boundary condition in this mode is the homogeneous
Dirichlet boundary condition, corresponding to h=1 and
r=0, we do not need to set anything for the lower boundary.
Finally press OK to confirm your settings and to close
the dialog box.
PDE Mode
The PDE coefficients are set in the PDE mode. The way to select
subdomains, areas bounded by curves, is similar to that of selecting
boundaries in the boundary mode. You select by clicking directly on
the subdomain in the GUI or by selecting from the list box in the
PDE Specification dialog box.
To set the PDE coefficients, select PDE Specification... on
the PDE menu - this will open the PDE Specification
dialog box.
Select the square in the figure window by clicking on it.
Type 0.01 into the c edit field, 0 into the f
edit field, and 1 1 into the edit field
to model convection in the y=x direction.
Press OK to close the dialog box.
Mesh Mode
In the mesh mode, you mesh the geometry of the model.
To initialize the mesh, press the Initialize Mesh toolbar button
(or select Initialize Mesh on the
Mesh menu).
Refine the mesh by pressing the Refine Mesh toolbar button
(or select Refine Mesh on the
Mesh menu).
Solve Mode
In solve mode, you can fine tune the solver parameters in the
Solver Parameters dialog box.
Enter the Solver Parameters dialog box by pressing the
=? toolbar button. On the General page, check
the Streamline diffusion option to stabilize this
hyperbolic problem and the Adaption option to invoke
the adaptive solver.
Press OK to close the dialog box.
Press the = toolbar button to solve the problem and
plot the solution. Note the characteristic layer across the
line y=x, and the outflow layer at x=1.
Plot Mode
In plot mode you have access to different visualization tools in the
Plot Parameters dialog box. You also have access to the plot
toolbar, that will appear as default in plot mode, to quickly switch
between different plot types.
Open the Plot Parameters dialog box by selecting
Parameters... on the Plot menu. Try different
visualization options.
To see how the automatic mesh refinement has worked, re-enter
Mesh Mode by selecting it on the Mesh menu. Comments?