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.

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, 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.

Partial Differential Equation Toolbox solves scalar equations of the form

\[m \frac{\partial^2 u}{\partial t^2} + d \frac{\partial u}{\partial t} - \nabla \cdot (c \nabla u ) + au = f\]

and systems of equations of the form 

\[\boldsymbol{m} \frac{\partial^2 \boldsymbol{u}}{\partial t^2} + \boldsymbol{d} \frac{\partial \boldsymbol{u}}{\partial t} - \nabla \cdot (\boldsymbol{c} \otimes \nabla \boldsymbol{u} ) + \boldsymbol{au} = \boldsymbol{f}\]

where the coefficients \(m, d, c, a\) and \(f\) can be functions of spatial location \( \left(x, y, z\right) \), the solution \(u\) or its gradient.

For eigenvalue equations of the form

\[ -\nabla \cdot \left( c \nabla u \right) + au = \lambda du \quad \text{or} \quad -\nabla \cdot \left( c \nabla u \right) + au = \lambda^2 m u\]        

and eigenvalue systems of the form

\[ -\nabla \cdot \left( \boldsymbol{c} \otimes \nabla \boldsymbol{u} \right) + \boldsymbol{au} = \lambda \boldsymbol{du} \quad \text{or} \quad -\nabla \cdot \left( \boldsymbol{c} \otimes \nabla \boldsymbol{u} \right) + \boldsymbol{au} = \lambda^2 \boldsymbol{mu}\]

the coefficients \(m, d, c, a\) and \(f\) may only be functions of spatial location \(\left(x, y, z\right)\) and cannot depend on the solution \(u\) or its gradient.

For more information, see Equations You Can Solve with the toolbox.

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.

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

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

Boundary Conditions

With Partial Differential Equation Toolbox, you can set Dirichlet and generalized Neumann boundary conditions on the boundary of your geometry, \(\partial\Omega\) , by specifying coefficients \(h\), \(r\), \(q\), and \(g\) in the corresponding code.

  • Dirichlet:
    \(hu = r\)
  • Generalize Neumann:
    \(\vec{n} \cdot \left(c \nabla u\right) + qu = g\)

For each boundary condition, \(\vec{n}\) 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 \(\partial\Omega\). 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 with the option of using quadratic or linear elements.

For 2D problems, the toolbox supports linear and quadratic triangle elements. For more information, see the documentation on Mesh Data.

For 2D elliptic and nonlinear elliptic problems, the toolbox lets you use an 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.

Spatial solution shown at a time point for a heat transfer problem. The temporal solution is shown at a point in space.
2D mesh for a DC motor cross section. The 2D mesh uses linear elements.

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 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.

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.

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

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.

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