Partial Differential Equation Toolbox

Key Features

  • Solvers for coupled systems of PDEs: static, time domain, frequency domain, and eigenvalue
  • PDE specification for elliptic, parabolic, and hyperbolic problems
  • Boundary condition specification: Dirichlet, generalized Neumann, and mixed
  • Functions for 2D geometry creation and 3D geometry import from STL files
  • Automatic meshing using tetrahedra and triangles
  • Simultaneous visualization of multiple solution properties, mesh overlays, and animation

PDE App and Workflows

A typical workflow in Partial Differential Equation Toolbox consists of defining your geometry, the scalar or system of governing equations, the boundary conditions, and the initial conditions; generating a mesh; and then solving and visualizing your results. The toolbox provides functions for each step in the workflow.

Deflection Analysis of a Bracket

Deflection Analysis of a Bracket (Example)
Using functions in Partial Differential Equation Toolbox to read 3D geometry of a bracket, and to automatically mesh, solve, and visualize the solution.

You can solve problems in structural mechanics, electrostatics, magnetostatics, AC power electromagnetics, conductive media DC, heat transfer and diffusion, and other custom applications.

For 2D geometry problems, you can work in the PDE app. The app includes geometry creation and preset modes for applications. You can choose to export data to the MATLAB® workspace from any step in the app and continue your work outside the app.

Using the PDE app to define the complex geometry of a wrench

Using the PDE app to define the complex geometry of a wrench, generate a mesh, and analyze it for a given load configuration.

Supported PDEs

You can use Partial Differential Equation Toolbox to define and solve different types of scalar or systems of PDEs, including elliptic, parabolic, hyperbolic, and eigenvalue problems. The PDE system can be linear or nonlinear and can be defined over a real-valued or complex-valued solution space.

Elliptic PDE

You can enter elliptic PDEs of the form,

where PD Gradient Symbolis the gradient operator over PD Equation Omega Image 5571, the bounded 2D or 3D domain of interest, and u is the scalar or vector of solution variables. You can specify the PDE coefficients c, a, and f as functions of u, ux, uy, and uz (solution derivatives) and (x,y) or (x,y,z) points in PD Equation Omega Image 5571.

Parabolic PDE

See the related example illustrating the parabolic and nonlinear PDE of heat transfer in a thin plate.

Hyperbolic PDE

Eigenvalue PDE

You can also specify the coefficient, d, for parabolic and hyperbolic PDEs as a function of u, and (x,y) or (x,y,z) points in PD Equation Omega Image 5571. For time-domain problems, all coefficients can depend on the time variable.

You can handle systems of dimension two with the PDE app. From the command line, you can handle an arbitrary number of dimensions.

Geometry Definition

For 3D problems, Partial Differential Equation Toolbox works with faceted geometry. You can define 3D geometry by importing a stereo lithography (or STL) file into MATLAB. The STL file format is native to 3D CAD software and provides a standard format to import 3D geometries for analysis with the toolbox.

For 2D problems, you can create 2D geometry via the constructive solid geometry (CSG) or the geometry function approach. Using the CSG approach, you can use a set of solid building blocks (square, rectangle, circle, ellipse, and polygon) that can be combined to define complex geometries. The PDE app uses the CSG approach.

Using the CSG approach in the PDE app to define 2D geometry.

Using the CSG approach in the PDE app to define the geometry of a wrench.

You can also use the geometry function approach to describe the curves that bound the 2D geometry regions.

Boundary Conditions

With Partial Differential Equation Toolbox, you can set Dirichlet and generalized Neumann boundary conditions on the boundary of your geometry, PD Equation dOmega Image , by specifying coefficients h, r, q, and g in the corresponding code.

  • Dirichlet:
  • Generalized Neumann:

For each boundary condition, PD Equation N Image is the outward unit normal, u is the scalar or vector valued solution, and c is the coefficient associated with the elliptic term.

g, q, h, and r can be complex valued functions defined on (x,y) or (x,y,z) points over PD Equation dOmega Image. The coefficients can depend on u and nx, ny, or nz (surface normals). For time-dependent problems, the coefficients can also depend on time. For PDE systems, the toolbox supports Dirichlet, generalized Neumann, and mixed boundary conditions.

Meshing and Solutions

Partial Differential Equation Toolbox uses the finite element method (FEM) to solve PDEs. You can automatically mesh geometries by specifying a mesh parameter.

For 3D problems, the toolbox uses tetrahedral elements. You can specify either piecewise linear or quadratic basis during the FEM meshing step.

3D mesh using tetrahedral elements

3D mesh using tetrahedral elements with the option of using quadratic or linear elements.

For 2D problems, the toolbox uses triangle elements with piecewise linear basis to represent the solution.

2D mesh for a DC motor cross-section

2D mesh for a DC motor cross section. The 2D mesh uses linear elements.

For 2D elliptic and nonlinear elliptic problems, the toolbox lets you use an adaptive mesh refinement algorithm.

Adaptive mesh refinement algorithm

Adaptive Mesh Refinement Algorithm
Example showing an adaptive solver (refining the inner corner) to control a discretization error.

For parabolic and hyperbolic PDE problems, you can specify the initial values and obtain solutions at specific times. You can also specify a damping term for the hyperbolic solver.

Solving a heat transfer problem with temperature-dependant properties

Solving a Heat Transfer Problem with Temperature-Dependent Properties (Example)
Spatial solution shown at a time point for a heat transfer problem. The temporal solution is shown at a point in space.

The eigenvalue solver returns the eigenvalues and the eigenmodes. You can specify the interval over which the solver will search for eigenvalues. The following example shows extract and plot eigenmodes and eigenvalues for a plate displacement problem, with a user-specified range to search for solutions.

Example showing extract and pot eigenmodes and eigenvalues

Example showing extract and plot eigenmodes and eigenvalues for a plate displacement problem. You can specify the range, e.g., 20 Hz to 200 Hz, over which to search for solutions.

Solution Visualization and Postprocessing

You can use Partial Differential Equation Toolbox to visualize your solution by creating surface plots, including contour plots and custom plots such as volume-slice plots.

Surface Plots

You can plot the solution on the surface of a 3D solid.

Surface plot solution

Example showing solution plotted on the surface of a 3D solid.

This example illustrates how you can use Partial Differential Equation Toolbox to solve a 2D Helmholtz equation solution on a circular domain with a hole.

Time-Domain Plots

The toolbox supports a variety of plots for solutions for 3D geometry. The following example shows the time evolution of values on a slice through a region.

Custom Plots

You can use custom code to create plots with the toolbox. This example shows a custom plot of volume slices from a solution.

The Plot mode in the PDE app for 2D lets you select from different plot types, including surface, mesh, and contour. For parabolic and hyperbolic equations, you can animate the solution as it changes with time. Applications include problems involving magnetostatics, as in this example.

Magnetostatics

Magnetostatics
Equipotential lines and magnetic flux in a two-pole motor.

Partial Differential Equation Toolbox lets you evaluate a PDE solution at any point within the geometry. You can also perform custom postprocessing.

3D Finite Element Analysis with MATLAB

View webinar