Main Content

Poisson's Equation on Unit Disk: PDE Modeler App

This example shows how to solve the Poisson's equation on a unit disk and evaluate the numeric solution error.

This example uses the PDE Modeler app. For a programmatic workflow, see Poisson's Equation on Unit Disk. Because the app and the programmatic workflow use different meshers, they yield slightly different results.

The problem formulation is –Δu = 1 in Ω, u = 0 on ∂Ω, where Ω is the unit disk. The exact solution is

u(x,y)=1x2y24

To solve this problem in the PDE Modeler app, follow these steps:

  1. Open the PDE Modeler app by using the pdeModeler command.

  2. Display grid lines by selecting Options > Grid.

  3. Align new shapes to the grid lines by selecting Options > Snap.

  4. Draw a circle with the radius 1 and the center at (0,0). To do this, first click the ellipse with the marked center button. Then right-click the origin and drag to draw a circle. Right-clicking constrains the shape you draw so that it is a circle rather than an ellipse. If the circle is not a perfect unit circle, double-click it. In the resulting dialog box, specify the exact center location and radius of the circle.

  5. Check that the application mode is set to Generic Scalar.

  6. Specify the boundary conditions. To do this, switch to boundary mode by clicking the rectangle with an arrow button or selecting Boundary > Boundary Mode. Select all boundaries by selecting Edit > Select All. Then select Boundary > Specify Boundary Conditions and specify the Dirichlet boundary condition u = 0. This boundary condition is the default (h = 1, r = 0), so you do not need to change it.

  7. Specify the coefficients by selecting PDE > PDE Specification or clicking the partial derivative button on the toolbar. Specify c = 1, a = 0, and f = 1.

  8. Specify the maximum edge size for the mesh by selecting Mesh > Parameters. Set the maximum edge size to 0.1.

  9. Initialize the mesh by selecting Mesh > Initialize Mesh or clicking the triangle button.

    Mesh on the unit disk

  10. Solve the PDE by selecting Solve > Solve PDE or clicking the partial derivative with the green triangle button on the toolbar. The toolbox assembles the PDE problem, solves it, and plots the solution.

    Solution in color on the unit disk

  11. Compare the numerical solution to the exact solution:

    1. Select Plot > Parameters.

    2. In the resulting dialog box, select user entry from the Color drop-down menu.

    3. Plot the absolute error in the solution by typing the MATLAB® expression u-(1-x.^2-y.^2)/4 in the User entry field.

    Error values in color

  12. Refine the mesh by selecting Mesh > Refine Mesh or clicking the triangle divided into smaller triangles button.

    Refined mesh on the unit disk

  13. Compare the numerical solution to the exact solution for the refined mesh. Plot the absolute error.

    Error values in color

  14. Export the mesh data and the solution to the MATLAB workspace by selecting Mesh > Export Mesh and Solve > Export Solution, respectively.