Vous êtes sur la page 1sur 11


Applications Using the Partial Differential Equation Toolbox


The Partial Differential Equation (PDE) Toolbox extends MATLAB to provide a powerful and flexible environment for the study and solution of partial differential equations in two-dimensional space and time. The PDE Toolbox offers both a command line interface and a graphical user interface for preprocessing, solving, and postprocessing generic 2-D PDEs using the Finite Element Method (FEM).

MATLAB provides a powerful computing environment for control system design, signal processing, modeling, analysis, and algorithm development. Its accurate numeric computation and builtin visualization make it easy to work with complex systems and data arrays. MATLAB Toolboxes offer specialized functions and easy-to-use graphical user interface tools that speed up the solution of application-specific problems. SIMULINK adds an intuitive block-diagram tool to the MATLAB environment for interactive simulation of nonlinear dynamic systems. With the Real-Time Workshop, you can generate portable C code from SIMULINK block diagrams for rapid prototyping and implementation of real-time systems.

1996 by The MathWorks, Inc. All rights reserved. MATLAB and SIMULINK are registered trademarks, and Real-Time Workshop is a trademark of The MathWorks, Inc. Other product or brand names are trademarks or registered trademarks of their respective holders.



Partial differential equations are used as mathematical models for solving problems with physical phenomena in many branches of engineering and science. Heat transfer in solids, flow in porous media, electrostatics of conductive media, plane stress and strain in structural mechanics, and wave propagation are solved using various partial differential equations. The PDE Toolbox uses the FEM to solve partial differential equations. This method incorporates the powerful Delaunay triangulation algorithm to generate unstructured meshes for the specified geometries, and then solves for these meshes. In this technical brief, we will show how to use the Partial Differential Equation Toolbox to solve an example involving the static magnetic field of a motor. The Appendix describes in detail the different types of partial differential equations that can be solved using the PDE Toolbox.

PDE Toolbox Qualification

Before invoking the PDE Toolbox to solve your PDE problem, it is imperative that you perform the following initial steps to qualify that the PDE Toolbox can solve your PDE example: 1. Determine whether the geometry that defines or approximates the PDE solution can be represented in 2-D (planar geometry) or 2-D over time. 2. Determine which form of the PDE describes the underlying physics or mathematics of the problem that you wish to solve or study. (Refer to the Appendix.) 3. Verify that the form of the PDE studied is within the toolboxs capabilities, and further identify if a custom application mode already exists from the graphical user interface (GUI). (Refer to the Appendix) 4. Determine the approach: GUI or command line interface After following these steps for determining if the problem can be solved using the PDE Toolbox, the process for modeling and solving the PDE problems consists of: Defining the geometry Defining the boundary conditions Defining the PDE coefficients Automeshing the domain Defining the initial conditions (if required) and solve Postprocessing the solution for analysis The following example illustrates the use of the PDE Toolboxs GUI and one of its application modes (magnetostatics) to solve for the magnetic field of an electric motor.


Motor Design

The geometric design of electric motor components (stator, rotor, and coil winding) has an impact on the motors performance. In this example, we will compute the static magnetic field due to the stator winding in a single two-pole electric motor. After completing the initial analysis of the simple geometry, we can also study the effects on the static magnetic field resulting from the geometric changes to the other major motor components such as reduced air gap or complex tooth design. As mentioned, we first need to qualify that the problem fits the capabilities of the PDE Toolbox. Question 1: Can the geometry be defined or approximated as a 2-D (planar) geometry? The motor is a 3-D structure; however, if we consider it to be long, and neglect end effects, we can assume that the variation in the z-direction is negligible. Therefore, all z-direction derivatives can be removed from the formulation, and the 2-D representation can be used to study the magnetic field. Question 2: Which form of the PDE describes the underlying physics of mathematics of the motor problem that we wish to solve? We can represent the physics of the 2-D mathematical model formulated in terms of magnetic vector potential (0,0,A) by the elliptic PDE: 1 A J x 1 A x 1 A ( ) y y J 0

which J is the current density and is the magnetic permeability, which for magnetic materials is a nonlinear function of the strength of the magnetic flux. Question 3: Can this PDE problem be solved with the toolbox and, in addition, is there a custom application mode that already exists in the toolboxs GUI? This magnetic problem is in the form of a nonlinear elliptic PDE, which the toolbox is capable of solving. In addition, there exists an application mode for magnetostatics from within the GUI. Therefore, we can use the GUI rather than the command line to preprocess, solve, and postprocess this particular PDE example problem.
Presolution Process

Before beginning the solution process, we must gather the geometric design information and physical parameters. For the motor example, we will lay out the geometry as shown below. Notice that the geometry of the motor provides us with an opportunity to reduce the analysis to a quarter model by utilizing symmetric and antisymmetric boundary conditions to enforce the effects of the missing geometry. Using the finite element methods, we should always look for symmetries and antisymmetries that can reduce the computational size of the problem without effecting the results of the analysis. The geometry and physical parameters of the stator, coil, air, and rotor are also required.


Required Dimensions Stator core outside radius Stator core inside radius Stator tooth outside radius Stator tooth inside radius Rotor outside radius Tooth width Tooth stator support width

1.0 0.8 0.6 0.5 0.4 0.4 0.2

Material Properties Part Stator 1 Rotor Air gap Coil 1.0 1.0 Permeability 5000 0.05| A 2 Current Density J 0.0 200 0.0 0.0 1.0

Stator Coil Air Gap Rotor

Figure 1. The geometry of the motor including its stator, coil, air gap, and rotor elements.

Having gathered all of the pre-solution information necessary to solve for the static magnetic field, we can proceed to the solution using the PDE Toolbox. We launch the PDE Toolbox GUI by typing at the prompt:


We change the application mode from generic scalar to Magnetostatics by using the upper right hand pull-down menu within the toolbar. This sets the PDE equation form and coefficients to those used in Magnetostatics. We will set two options which will aid in the creation and visualization of the motor geometry. First, we select the Snap under the Options menu, and enable the grid by selecting Grid under the Options menu. The default axis display is not large enough to define the full motor geometry so we will need to select the Grid Spacing under the Options menu, and change the parameters to those mentioned below in the dialog box. We must also make sure that we enable the edit box by removing the check in the auto box for both the X and Y axes. This completes the option setup of the GUI for preprocessing, solving and postprocessing of the motor PDE example.

Figure 2. The grid spacing dialog box used during the creation of the motor geometry

Definition of Motor Geometry

We will now use the constructive solid geometry paradigm to develop the complex geometry of the quarter model of the motor. We use the Draw menu or toolbar icons to draw the following geometric elements with the following specifications:

Circles X Center 0.0 0.0 0.0 0.0 0.0 Y Center 0.0 0.0 0.0 0.0 0.0 Radius 1.0 0.8 0.6 0.5 0.4 Name C1 C2 C3 C4 C5

Rectangles/Squares Left Bottom -0.2 0.2 -0.1 0.2 0.0 0.0

Width 0.4 0.2 1.0

Height 0.7 0.7 1.0

Name R1 R2 SQ1

The constructive solid geometry should appear as in Figure 3. The geometry represents the union of five concentric circles and two rectangles. The quarter model is then formed by intersecting the

union of the circles and rectangles with the square. This is performed by editing the Set Formula dialog box just below the toolbar, and hitting Return on the keyboard. The resulting formula should read:
(C1 + C2 + C3 + C4 + C5 + R1 + R2 ) * SQ1

The effect of this command will be not be initiated until the boundary mode is selected and the boundary conditions are set. This is given in the next section.

Figure 3. The constructive solid geometry for the motor

Definition of Boundary Conditions

The geometry of the problem makes the magnetic vector potential A symmetric with respect to y and antisymmetric with respect to x. This allows us to use a quarter of the model for solving our PDE. By neglecting the field outside of the motor, we can limit the domain of interest to be that of the outer radius of the stator. Selection of the Boundary mode from the Boundary menu, causes the set formula to be calculated and displayed. While holding down the Shift key, click on the sub-domain boundaries indicated in the figure to select them, and then select Remove Subdomain Border under the Boundary menu to yield the correct quarter motor model. By returning to Grid Spacing under the Options menu, we can now reduce the limits to better focus on the quarter model geometry using the dialog box. Next, we select the boundaries along the x-axis using the Shift key and clicking on the x axis. We set the boundary conditions to a Neumann condition with g=0 and q=0 (antisymmetric), by using Set Boundary Conditions under the Boundary menu and its accompanying dialog box. The symmetric boundary condition Dirichlet (A=0) on the y-axis is the default boundary condition and, therefore, does not need to be set. Furthermore, by neglecting the field effects outside of the stator boundary, we are using the default Dirichlet (A=0) boundary condition on the outer radius of the stator.


Figure 4. The boundary conditions for the motor are set through a dialog box

Definition of PDE Coefficients

We must now define the PDE coefficients for the various components of the motor model. We enter the PDE mode by selecting it from the pull-down menu. Next, we select Show Subdomain Labels under the PDE menu to turn on the labels for the subdomains stator, rotor, air gap, and coil.

Figure 5. The PDE coefficients are defined for the subdomains of the motor's geometry

Double-click on each subdomain to define the PDE material parameters. In the coil, both and J are 1, so the default values do not need to be changed. In the stator and rotor there is no current (J=0), and is nonlinear and should be entered in the edit box for as:

The solution A is represented in the toolbox as a vector u, so the term ux.^2+uy.^2 is equal to | A 2

Figure 6. The dialog box for the specification of PDE coefficients

. In the air gap, is 1 and J is 0.

Automeshing the Domain

The next part of the solution process is to discretize the domain using the FEM. We select Initialize Mesh under the Mesh menu and the PDE Toolbox will calculate an initial mesh for the motor. The mesh in the diagram below is an example of an adaptively generated mesh. This is a capability of the PDE Toolbox which we will explore in the solution phase. Therefore, for the moment, our mesh will appear slightly differentit will have more consistency in the area of the triangular elements. At this point, the user is also free to refine the mesh by using the toolbar icon or Refine Mesh under the Mesh menu.

Figure 7. The initial mesh of the motor calculated using the Finite Element Method

Definition of Initial Conditions

In this problem, the PDE coefficients depend nonlinearly on the solution A (toolbox variable u). Therefore, we should select Parameters under the Solve menu and check the nonlinear solve in the dialog box. Note, this where we can also select the additional capability of an adaptively generated mesh as shown in the preceding figure. We solve the problem by selecting Solve under the Solve menu or pushing the toolbar icon =. The PDE Toolbox will automatically solve and plot the solution. Warning: if the nonlinear solver is not selected, we will receive an error on the form of the PDE


coefficients for the stator and the rotor.

Postprocessing of the Solution

The final step in the process is visualization of the solution. The PDE Toolbox has a vast array of preprogrammed plotting and visualization capabilities available through the Parameters dialog box under the Plot menu. It is easy to explore the various solutions and visualization capabilities, or return to the geometry definition stage and begin analyzing different design parameters and their effects on the flux density of the motor.

Figure 8. Visualization of the final PDE solution to the motor example.

In addition to the application mode for magnetostatics, there are seven other application modes that are provided with the toolbox. They feature specially designed dialog boxes for the specification of equations, boundary conditions, and visualization types for common applications. The eight application modes included with the PDE Toolbox are: Structural mechanics, Plane Stress Structural mechanics, Plane Strain Electrostatics Magnetostatics AC Power Electromagnetics Conductive media DC Heat transfer Diffusion This is just one of the many types of PDE problems that can be modeled and solved using the Partial Differential Equation Toolbox. The toolbox takes full advantage of MATLABs strong numeric and visualization capabilities to provide a powerful and intuitive environment for solving a wide range of PDE problems.



24 Prime Park Way Natick, MA 01760-1500 USA Tel: (508) 647-7000 Fax: (508) 647-7101 E-mail: info@mathworks.com http://www.mathworks.com

8777v00 3/96