Partial Differential Equation Toolbox |

Suggested Modeling Method

Although the PDE Toolbox offers you a great deal of flexibility in the ways that you can approach the problems and interact with the toolbox functions, there is a suggested method of choice for modeling and solving your PDE problems using the `pdetool` GUI. There are also a number of shortcuts that you can use in certain situations.

Note There are platform-dependent keyboard accelerators available for many of the most common `pdetool` GUI activities. Learning to use the accelerator keys may improve the efficiency of your `pdetool` sessions.

The basic flow of actions is indicated by the way the graphical buttons and the menus are ordered from left to right. You work your way from left to right in the process of modeling, defining, and solving your PDE problem using the `pdetool` GUI:

- When you start, `pdetool` is in a Draw mode, where you can use the four basic solid objects to draw your Constructive Solid Geometry (CSG) model. You can also edit the set formula. The solid objects are selected using the five leftmost buttons (or from the Draw menu).
- To the right of the Draw mode buttons you find buttons through which you can access all the functions that you need to define and solve the PDE problem: define boundary conditions, design the triangular mesh, solve the PDE, and plot the solution.

The following sequence of actions covers all the steps of a normal `pdetool` session:

1. Use `pdetool` as a drawing tool to make a drawing of the 2-D geometry on which you want to solve your PDE. Make use of the four basic solid objects and the grid and the "snap-to-grid" feature. The GUI starts in the Draw mode, and you can select the type of object that you want to use by clicking the corresponding button or by using the Draw pull-down menu. Combine the solid objects and the set algebra to build the desired CSG model.
2. Save the geometry to a model file. The model file is an M-file, so if you want to continue working using the same geometry at your next PDE Toolbox session, simply type the name of the model file at the MATLAB prompt. The `pdetool` GUI then starts with the model file's solid geometry loaded. If you save the PDE problem at a later stage of the solution process, the model file also contains commands to recreate the boundary conditions, the PDE coefficients, and the mesh.
3. Move to the next step in the PDE solving process by clicking the button. The outer boundaries of the decomposed geometry are displayed with the default boundary condition indicated. If the outer boundaries do not match the geometry of your problem, reenter the Draw mode. You can then correct your CSG model by adding, removing or altering any of the solid objects, or change the set formula used to evaluate the CSG model.

Note The set formula can only be edited while you are in the Draw mode.

1. If the drawing process resulted in any unwanted subdomain borders, remove them by using the Remove Subdomain Border or Remove All Subdomain Borders option from the Boundary menu.

   You can now define your problem's boundary conditions by selecting the boundary to change and open a dialog box by double-clicking the boundary or by using the Specify Boundary Conditions. . . option from the Boundary menu.

4. Initialize the triangular mesh. Click the button or use the corresponding Mesh menu option Initialize Mesh. Normally, the mesh algorithm's default parameters generate a good mesh. If necessary, they can be accessed using the Parameters. . . menu item.
5. If you need a finer mesh, the mesh can be refined by clicking the Refine button. Clicking the button several times causes a successive refinement of the mesh. The cost of a very fine mesh is a significant increase in the number of points where the PDE is solved and, consequently, a significant increase in the time required to compute the solution. Do not refine unless it is required to achieve the desired accuracy. For each refinement, the number of triangles increases by a factor of four. A better way to increase the accuracy of the solution to elliptic PDE problems is to use the adaptive solver, which refines the mesh in the areas where the estimated error of the solution is largest. See the reference page for `adaptmesh` for an example of how the adaptive solver can solve a Laplace equation with an accuracy that requires more than 10 times as many triangles when regular refinement is used.
6. Specify the PDE from the PDE Specification dialog box. You can access that dialog box using the PDE button or the PDE Specification. . . menu item from the PDE menu.

Note This step can be performed at any time prior to solving the PDE since it is independent of the CSG model and the boundaries. If the PDE coefficients are material dependent, they are entered in the PDE mode by double-clicking the different subdomains.

7. Solve the PDE by clicking the = button or by selecting Solve PDE from the Solve menu. If you do not want an automatic plot of the solution, or if you want to change the way the solution is presented, you can do that from the Plot Selection dialog box prior to solving the PDE. You open the Plot Selection dialog box by clicking the button with the 3-D solution plot icon or by selecting the Parameters. . . menu item from the Plot menu.
8. Now, from here you can choose one of several alternatives:

   Export the solution and/or the mesh to the MATLAB main workspace for further analysis.

   Visualize other properties of the solution.

   Change the PDE and recompute the solution.

   Change the mesh and recompute the solution. If you select Initialize Mesh, the mesh is initialized; if you select Refine Mesh, the current mesh is refined. From the Mesh menu, you can also jiggle the mesh and undo previous mesh changes.

   Change the boundary conditions. To return to the mode where you can select boundaries, use the button or the Boundary Mode option from the Boundary menu.

   Change the CSG model. You can reenter the draw mode by selecting Draw Mode from the Draw menu or by clicking one of the Draw mode icons to add another solid object. Back in the Draw mode, you are able to add, change, or delete solid objects and also to alter the set formula.

In addition to the recommended path of actions, there are a number of shortcuts, which allow you to skip over one or more steps. In general, the `pdetool` GUI adds the necessary steps automatically.

- If you have not yet defined a CSG model, and leave the Draw mode with an empty model, `pdetool` creates an L-shaped geometry with the default boundary condition and then proceeds to the action called for, performing all the steps necessary.
- If you are in the Draw mode and click the button to initialize the mesh, `pdetool` first decomposes the geometry using the current set formula and assigns the default boundary condition to the outer boundaries. After that, an initial mesh is created.
- If you click the refine button to refine the mesh before the mesh has been initialized, `pdetool` first initializes the mesh (and decomposes the geometry, if you were still in the Draw mode).
- If you click the = button to solve the PDE and you have not yet created a mesh, `pdetool` initializes a mesh before solving the PDE.
- If you select a plot type and choose to plot the solution, `pdetool` checks to see if there is a solution to the current PDE available. If not, `pdetool` first solves the current PDE. The solution is then displayed using the selected plot options.
- If you have not defined your PDE, `pdetool` solves the default PDE, which is Poisson's equation:

- (This corresponds to the generic elliptic PDE with c = 1, a = 0, and f = 10.) For the different application modes, different default PDE settings apply.

| Creating Rounded Corners |  | Object Selection Methods |