Main Content

Put Equations in Divergence Form

Coefficient Matching for Divergence Form

As explained in Equations You Can Solve Using PDE Toolbox, Partial Differential Equation Toolbox™ solvers address equations of the form

(cu)+au=f

or variants that have derivatives with respect to time, or that have eigenvalues, or are systems of equations. These equations are in divergence form, where the differential operator begins ·. The coefficients a, c, and f are functions of position (x, y, z) and possibly of the solution u.

However, you can have equations in a form with all the derivatives explicitly expanded, such as

(1+x2)2ux23xy2uxy+(1+y2)22uy2=0

In order to transform this expanded equation into the required form, you can try to match the coefficients of the equation in divergence form to the expanded form. In divergence form, if

c=(c1c3c2c4)

then

·(cu)=c1uxx+(c2+c3)uxy+c4uyy+(c1x+c2y)ux+(c3x+c4y)uy

Matching coefficients in the uxx and uyy terms in (cu) to the equation, you get

c1=(1+x2)c4=(1+y2)/2

Then looking at the coefficients of ux and uy, which should be zero, you get

(c1x+c2y)=2x+c2ysoc2=2xy.(c3x+c4y)=c3xysoc3=xy

This completes the conversion of the equation to the divergence form

(cu)=0

Boundary Conditions Can Affect the c Coefficient

The c coefficient appears in the generalized Neumann condition

n·(cu)+qu=g

So when you derive a divergence form of the c coefficient, keep in mind that this coefficient appears elsewhere.

For example, consider the 2-D Poisson equation uxx – uyy = f. Obviously, you can take c = 1. But there are other c matrices that lead to the same equation: any that have c(2) + c(3) = 0.

·(cu)=·((c1c3c2c4)(uxuy))=x(c1ux+c3uy)+y(c2ux+c4uy)=c1uxx+c4uyy+(c2+c3)uxy

So there is freedom in choosing a c matrix. If you have a Neumann boundary condition such as

n·(cu)=2

the boundary condition depends on which version of c you use. In this case, make sure that you take a version of c that is compatible with both the equation and the boundary condition.

Coefficient Conversion with Symbolic Math Toolbox

You can transform a partial differential equation into the required form by using Symbolic Math Toolbox™. The toolbox offers these two functions to help with the conversion:

  • pdeCoefficients (Symbolic Math Toolbox) converts a PDE into the required form and extracts the coefficients into a structure of double-precision numbers and function handles, which can be used by specifyCoefficients. The pdeCoefficients function also can return a structure of symbolic expressions, in which case you need to convert these expressions to double format before passing them to specifyCoefficients.

  • pdeCoefficientsToDouble (Symbolic Math Toolbox) converts symbolic PDE coefficients to double format.

Solve Partial Differential Equation of Nonlinear Heat Transfer (Symbolic Math Toolbox) shows how the Symbolic Math Toolbox functions can help you convert a PDE to the required form. Nonlinear Heat Transfer in Thin Plate shows the same example without the use of Symbolic Math Toolbox.

Some Equations Cannot Be Converted

Sometimes it is not possible to find a conversion to a divergence form such as

(cu)+au=f

For example, consider the equation

2ux2+cos(x+y)42uxy+122uy2=0

By simple coefficient matching, you see that the coefficients c1 and c4 are –1 and –1/2 respectively. However, there are no c2 and c3 that satisfy the remaining equations,

c2+c3=cos(x+y)4c1x+c2y=c2y=0c3x+c4y=c3x=0

Related Topics