Common PDE Problems
Common PDE Problems
Common PDE Problems
text://2
On this page…
Elliptic Problems
Parabolic Problems
Hyperbolic Problem
Eigenvalue Problems
Application Modes
References
Elliptic Problems
This topic describes the solution of some elliptic PDE problems. The last problem, a minimal surface problem, is nonlinear and illustrates the use of the nonlinear solver. The
problems are solved using both the Partial Differential Equation Toolbox graphical user interface and command-line functions. The topics include:
-ΔU = 1 in Ω, U = 0 on
so the error of the numeric solution can be evaluated for different meshes.
Using the Graphical User Interface. With the pdetool graphical user interface (GUI) started, perform the following steps using the generic scalar mode:
1. Using some of the Option menu features, add a grid and turn on the "snap-to-grid" feature. Draw a circle by clicking the button with the ellipse icon with the + sign, and
then click-and-drag from the origin, using the right mouse button, to a point at the circle's perimeter. If the circle that you create is not a perfect unit circle, double-click the
circle. This opens a dialog box where you can specify the exact center location and radius of the circle.
2. Enter the boundary mode by clicking the button with the icon. The boundaries of the decomposed geometry are plotted, and the outer boundaries are assigned a default
boundary condition (Dirichlet boundary condition, u = 0 on the boundary). In this case, this is what we want. If the boundary condition is different, double-click the boundary
to open a dialog box through which you can enter and display the boundary condition.
3. To define the partial differential equation, click the PDE button. This opens a dialog box, where you can define the PDE coefficients c, a, and f. In this simple case, they
are all constants: c = 1, f = 1, and a = 0.
4. Click the Δ button or select Initialize Mesh from the Mesh menu. This initializes and displays a triangular mesh.
5. Click the Refine button or select Refine Mesh from the Mesh menu. This causes a refinement of the initial mesh, and the new mesh is displayed.
6. To solve the system, just click the = button. The toolbox assembles the PDE problem and solves the linear system. It also provides a plot of the solution. Using the Plot
Selection dialog box, you can select different types of solution plots.
7. To compare the numerical solution to the exact solution, select the user entry in the Property pop-up menu for Color in the Plot Selection dialog box. Then input the
1 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
MATLAB expression u-(1-x.^2-y.^2)/4 in the user entry edit field. You obtain a plot of the absolute error in the solution.
You can also compare the numerical solution to the exact solution by entering some simple command-line-oriented commands. It is easy to export the mesh data and the solution
to the MATLAB main workspace by using the Export options from the Mesh and Solve menus. To refine the mesh and solve the PDE successively, simply click the refine and =
buttons until the desired accuracy is achieved. (Another possibility is to use the adaptive solver.)
Using Command-Line Functions. First you must create a MATLAB function that parameterizes the 2-D geometry—in this case a unit circle.
The circleg.m file returns the coordinates of points on the unit circle's boundary. The file conforms to the file format described on the reference page for pdegeom. You can
display the file by typing type circleg.
Also, you need a function that describes the boundary condition. This is a Dirichlet boundary condition where u = 0 on the boundary. The circleb1.m file provides the boundary
condition. The file conforms to the file format described on the reference page for pdebound. You can display the file by typing type circleb1.
Now you can start working from the MATLAB command line:
[p,e,t]=initmesh('circleg','Hmax',1);
error=[]; err=1;
while err > 0.001,
[p,e,t]=refinemesh('circleg',p,e,t);
u=assempde('circleb1',p,e,t,1,0,1);
exact=-(p(1,:).^2+p(2,:).^2-1)/4;
err=norm(u-exact',inf);
error=[error err];
end
pdemesh(p,e,t)
pdesurf(p,t,u)
pdesurf(p,t,u-exact')
The first MATLAB command creates the initial mesh using the parameterizing function circleg.
Also, initialize a vector error for the maximum norm errors of the successive solutions and set the initial error err to 1. The loop then runs until the error of the solution is smaller
-3
than 10 .
1. Refine the mesh. The current triangular mesh, defined by the geometry circleg, the point matrix p, the edge matrix e, and the triangle matrix t, is refined, and the mesh
is returned using the same matrix variables.
2. Assemble and solve the linear system. The coefficients of the elliptic PDE are constants ( c = f = 1, a = 0) for this simple case. circleb1 contains a description of the
boundary conditions, and p, e, and t define the triangular mesh.
3. Find the error of the numerical solution produced by Partial Differential Equation Toolbox solver. The vector exact contains the exact solution at the nodes, and what you
actually find is the max-norm error of the solution at the nodes.
4. Plot the mesh, the solution, and the error. The plot function pdesurf as third argument can take any vector of values on the mesh given by p and t, not just the solution.
In this case you are also plotting the error function.
A Scattering Problem
The scattering problem is to compute the waves reflected from an object illuminated by incident waves. For this problem consider an infinite horizontal membrane subjected to
small vertical displacements U. The membrane is fixed at the object boundary.
2 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
We assume that the medium is homogeneous so that the wave speed is constant, c.
Note Do not confuse this c with the parameter c appearing in Partial Differential Equation Toolbox functions.
–iωt
When the illumination is harmonic in time, we can compute the field by solving a single steady problem. With U(x,y,t) = u(x,y)e , the wave equation
2 2
turns into –ω u – c Δu = 0 or the Helmholtz's equation
2
–Δu – k u = 0,
where k, the wave number, is related to the angular frequency ω, the frequency f, and the wavelength λ by
We have yet to specify the boundary conditions. Let the incident wave be a plane wave traveling in the direction = (cos(a), sin(a)):
where
u=v+r
r = –v (x,y)
For acoustic waves, where v is the pressure disturbance, the proper condition would be
The reflected wave r travels outward from the object. The condition at the outer computational boundary should be chosen to allow waves to pass without reflection. Such
conditions are usually called nonreflecting, and we use the classical Sommerfeld radiation condition. As approaches infinity, r approximately satisfies the one-way wave
equation
which allows waves moving in the positive ξ-direction only (ξ is the radial distance from the object). With the time-harmonic solution, this turns into the generalized Neumann
boundary condition
For simplicity, let us make the outward normal of the computational domain approximate the outward ξ-direction.
Using the Graphical User Interface. You can now use pdetool to solve this scattering problem. Using the generic scalar mode, start by drawing the 2-D geometry of the
problem. Let the illuminated object be a square SQ1 with a side of 0.1 units and center in [0.8 0.5] and rotated 45 degrees, and let the computational domain be a circle C1
with a radius of 0.45 units and the same center location. The Constructive Solid Geometry (CSG) model is then given by C1-SQ1.
For the outer boundary (the circle perimeter), the boundary condition is a generalized Neumann condition with q = -ik. The wave number k = 60, which corresponds to a
wavelength of about 0.1 units, so enter -60i as a constant q and 0 as a constant g.
For the square object's boundary, you have a Dirichlet boundary condition:
In this problem, the incident wave is traveling in the -x direction, so the boundary condition is simply
-ikx
r = -e
Enter this boundary condition in the Boundary Condition dialog box as a Dirichlet condition: h=1, r=-exp(-i*60*x). The real part of this is a sinusoid.
3 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
For sufficient accuracy, about 10 finite elements per wavelength are needed. The outer boundary should be located a few object diameters from the object itself. An initial mesh
generation and two successive mesh refinements give approximately the desired resolution.
Although originally a wave equation, the transformation into a Helmholtz's equation makes it—in the Partial Differential Equation Toolbox context, but not strictly
2
mathematically—an elliptic equation. The elliptic PDE coefficients for this problem are c = 1, a = -k = -3600, and f = 0. Open the PDE Specification dialog box and enter these
values.
The problem can now be solved, and the solution is complex. For a complex solution, the real part is plotted and a warning message is issued.
The reflected waves and the "shadow" behind the object are clearly visible when you plot the reflected wave.
To make an animation of the reflected wave, the solution and the mesh data must first be exported to the main workspace. Then make a script file or type the following commands
at the MATLAB prompt:
2 2 2
on the unit disk Ω = {(x, y) | x + y ≤ 1}, with u = x on ∂Ω.
This problem is nonlinear and cannot be solved with the regular elliptic solver. Instead, the nonlinear solver pdenonlin is used.
Let us solve this minimal surface problem using the pdetool GUI and command-line functions.
Using the Graphical User Interface. Make sure that the application mode in the pdetool GUI is set to Generic Scalar. The problem domain is simply a unit circle. Draw it and
move to the boundary mode to define the boundary conditions. Use Select All from the Edit menu to select all boundaries. Then double-click a boundary to open the Boundary
2
Condition dialog box. The Dirichlet condition u = x is entered by typing x.^2 into the r edit box. Next, open the PDE Specification dialog box to define the PDE. This is an elliptic
equation with
4 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
1./sqrt(1+ux.^2+uy.^2)
Before solving the PDE, select Parameters from the Solve menu and check the Use nonlinear solver option. Also, set the tolerance parameter to 0.001.
Click the = button to solve the PDE. Use the Plot Selection dialog box to plot the solution in 3-D (check u and continuous selections in the Height column) to visualize the
saddle shape of the solution.
Using Command-Line Functions. Working from the command line, the following sequence of commands solves the minimal surface problem and plots the solution. The files
circleg and circleb2 contain the geometry specification and boundary condition functions, respectively.
g='circleg';
b='circleb2';
c='1./sqrt(1+ux.^2+uy.^2)';
rtol=1e-3;
[p,e,t]=initmesh(g);
[p,e,t]=refinemesh(g,p,e,t);
u=pdenonlin(b,p,e,t,c,0,0,'Tol',rtol);
pdesurf(p,t,u)
Domain Decomposition
Partial Differential Equation Toolbox software is designed to deal with one-level domain decomposition. If Ω has a complicated geometry, it is often useful to decompose it into the
union of more subdomains of simpler structure. Such structures are often introduced by pdetool.
Assume now that Ω is the disjoint union of some subdomains Ω 1, Ω2, . . . , Ωn. Then you could renumber the nodes of a mesh on Ω such that the indices of the nodes of each
subdomain are grouped together, while all the indices of nodes common to two or more subdomains come last. Since K has nonzero entries only at the lines and columns that are
indices of neighboring nodes, the stiffness matrix is partitioned as follows:
5 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The Partial Differential Equation Toolbox function assempde can assemble the matrices Kj, Bj, fj, and C separately. You have full control over the storage and further processing
of these matrices.
Ku = F
Now consider the geometry of the L-shaped membrane. You can plot the geometry of the membrane by typing
pdegplot('lshapeg')
Notice the borders between the subdomains. There are three subdomains. Thus the matrix formulas with n = 3 can be used. Now generate a mesh for the geometry:
[p,e,t]=initmesh('lshapeg');
[p,e,t]=refinemesh('lshapeg',p,e,t);
[p,e,t]=refinemesh('lshapeg',p,e,t);
In the following MATLAB solution, a more efficient algorithm using Cholesky factorization is used:
time=[];
np=size(p,2);
% Find common points
c=pdesdp(p,e,t);
nc=length(c);
C=zeros(nc,nc);
FC=zeros(nc,1);
[i1,c1]=pdesdp(p,e,t,1);ic1=pdesubix(c,c1);
[K,F]=assempde('lshapeb',p,e,t,1,0,1,time,1);
K1=K(i1,i1);d=symamd(K1);i1=i1(d);
K1=chol(K1(d,d));B1=K(c1,i1);a1=B1/K1;
C(ic1,ic1)=C(ic1,ic1)+K(c1,c1)-a1*a1';
f1=F(i1);e1=K1'\f1;FC(ic1)=FC(ic1)+F(c1)-a1*e1;
[i2,c2]=pdesdp(p,e,t,2);ic2=pdesubix(c,c2);
[K,F]=assempde('lshapeb',p,e,t,1,0,1,time,2);
K2=K(i2,i2);d=symamd(K2);i2=i2(d);
K2=chol(K2(d,d));B2=K(c2,i2);a2=B2/K2;
C(ic2,ic2)=C(ic2,ic2)+K(c2,c2)-a2*a2';
f2=F(i2);e2=K2'\f2;FC(ic2)=FC(ic2)+F(c2)-a2*e2;
[i3,c3]=pdesdp(p,e,t,3);ic3=pdesubix(c,c3);
[K,F]=assempde('lshapeb',p,e,t,1,0,1,time,3);
K3=K(i3,i3);d=symamd(K3);i3=i3(d);
K3=chol(K3(d,d));B3=K(c3,i3);a3=B3/K3;
C(ic3,ic3)=C(ic3,ic3)+K(c3,c3)-a3*a3';
f3=F(i3);e3=K3'\f3;FC(ic3)=FC(ic3)+F(c3)-a3*e3;
% Solve
u=zeros(np,1);
u(c)=C\ FC;
u(i1)=K1\(e1-a1'*u(c1));
u(i2)=K2\(e2-a2'*u(c2));
u(i3)=K3\(e3-a3'*u(c3));
6 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
Back to Top
Parabolic Problems
This section describes the solution of some parabolic PDE problems. The problems are solved using both the Partial Differential Equation Toolbox graphical user interface and the
command-line functions. The topics include:
The heat equation describes the diffusion of heat in a body of some kind. See Application Modes for more information about heat transfer and diffusion problems.
This first example studies a heated metal block with a rectangular crack or cavity. The left side of the block is heated to 100 degrees centigrade. At the right side of the metal
block, heat is flowing from the block to the surrounding air at a constant rate. All the other block boundaries are isolated. This leads to the following set of boundary conditions
(when proper scaling of t is chosen):
Also, for the heat equation we need an initial value: the temperature in the metal block at the starting time t0. In this case, the temperature of the block is 0 degrees at the time we
start applying heat.
Finally, to complete the problem formulation, we specify that the starting time is 0 and that we want to study the heat distribution during the first five seconds.
Using the Graphical User Interface. Once you have started the pdetool GUI and selected the Generic Scalar mode, drawing the CSG model can be done very quickly: Draw
a rectangle (R1) with the corners in x = [-0.5 0.5 0.5 -0.5] and y = [-0.8 -0.8 0.8 0.8]. Draw another rectangle (R2) to represent the rectangular cavity. Its
corners should have the coordinates x = [-0.05 0.05 0.05 -0.05] and y = [-0.4 -0.4 0.4 0.4]. To assist in drawing the narrow rectangle representing the
cavity, open the Grid Spacing dialog box from the Options and enter x-axis extra ticks at -0.05 and 0.05. Then turn on the grid and the "snap-to-grid" feature. A rectangular
cavity with the correct dimensions is then easy to draw.
7 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The CSG model of the metal block is now simply expressed as the set formula R1-R2.
Leave the draw mode and enter the boundary mode by clicking the button, and continue by selecting boundaries and specifying the boundary conditions. Using the Select All
option from the Edit menu and then defining the Neumann condition
for all boundaries first is a good idea since that leaves only the leftmost and rightmost boundaries to define individually.
The next step is to open the PDE Specification dialog box and enter the PDE coefficients.
The generic parabolic PDE that Partial Differential Equation Toolbox functions solve is
with initial values u0 = u(t0) and the times at which to compute a solution specified in the array tlist.
Initialize the mesh by clicking the Δ button. If you want, you can refine the mesh by clicking the Refine button.
The initial values u0 = 0, and the list of times is entered as the MATLAB array [0:0.5:5]. They are entered into the Solve Parameters dialog box, which is accessed by selecting
Parameters from the Solve menu.
The problem can now be solved. Pressing the = button solves the heat equation at 11 different times from 0 to 5 seconds. By default, an interpolated plot of the solution, i.e., the
heat distribution, at the end of the time span is displayed.
A more interesting way to visualize the dynamics of the heat distribution process is to animate the solution. To start an animation, check the Animation check box in the Plot
selection dialog box. Also, select the colormap hot. Click the Plot button to start a recording of the solution plots in a separate figure window. The recorded animation is then
"played" five times.
The temperature in the block rises very quickly. To improve the animation and focus on the first second, try to change the list of times to the MATLAB expression
logspace(-2,0.5,20).
Also, try to change the heat capacity coefficient d and the heat flow at the rightmost boundary to see how they affect the heat distribution.
Using Command-Line Functions. First, you must create geometry and boundary condition files. The files used here were created using pdetool. The geometry of the metal
8 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
block is described in crackg.m, and the boundary conditions can be found in crackb.m.
» [p,e,t]=initmesh('crackg');
The heat equation can now be solved using the Partial Differential Equation Toolbox function parabolic. The generic parabolic PDE that parabolic solves is
with initial value u0 = u(t0) and the times at which to compute a solution specified in the array tlist. For this case, you have d = 1, c = 1, a = 0, and f = 0. The initial value u0 = 0,
and the list of times, tlist, is set to the MATLAB array 0:0.5:5.
u=parabolic(0,0:0.5:5,'crackb',p,e,t,1,0,0,1);
The solution u created this way a matrix with 11 columns, where each column corresponds to the solution at the 11 points in time 0,0.5, . . . ,4.5,5.0.
Let us plot the solution at t = 5.0 seconds using interpolated shading and a hidden mesh. Use the hot colormap:
pdeplot(p,e,t,'xydata',u(:,11),'mesh','off',...
'colormap','hot')
Consider a cylindrical radioactive rod. At the left end, heat is continuously added. The right end is kept at a constant temperature. At the outer boundary, heat is exchanged with
the surroundings by transfer. At the same time, heat is uniformly produced in the whole rod due to radioactive processes. Assume that the initial temperature is zero. This leads to
the following problem:
where ρ is the density, C is the rod's thermal capacity, k is the thermal conductivity, and f is the radioactive heat source.
3 3
The density for this metal rod is 7800 kg/m , the thermal capacity is 500 Ws/kgºC, and the thermal conductivity is 40 W/mºC. The heat source is 20000 W/m . The temperature at
2 2
the right end is 100 ºC. The surrounding temperature at the outer boundary is 100 ºC, and the heat transfer coefficient is 50 W/m ºC. The heat flux at the left end is 5000 W/m .
But this is a cylindrical problem, so you need to transform the equation, using the cylindrical coordinates r, z, and θ. Due to symmetry, the solution is independent of θ, so the
transformed equation is
= 5000 at the left end of the rod (Neumann condition). Since the generalized Neumann condition in Partial Differential Equation Toolbox software is +
qu = g, and c depends on r in this problem (c = kr), this boundary condition is expressed as = 5000r
u = 100 at the right end of the rod (Dirichlet condition).
= 50(100-u) at the outer boundary (generalized Neumann condition). In Partial Differential Equation Toolbox software, this must be expressed as + 50r
· u = 50r · 100.
The cylinder axis r = 0 is not a boundary in the original problem, but in our 2-D treatment it has become one. We must give the artificial boundary condition
here.
Using the Graphical User Interface. Solve this problem using the pdetool GUI. Model the rod as a rectangle with its base along the x-axis, and let the x-axis be the z direction
and the y-axis be the r direction. A rectangle with corners in (-1.5,0), (1.5,0), (1.5,0.2), and (-1.5,0.2) would then model a rod with length 3 and radius 0.2.
Enter the boundary conditions by double-clicking the boundaries to open the Boundary Condition dialog box. For the left end, use Neumann conditions with 0 for q and 5000*y for
g. For the right end, use Dirichlet conditions with 1 for h and 100 for r. For the outer boundary, use Neumann conditions with 50*y for q and 50*y*100 for g. For the axis, use
Neumann conditions with 0 for q and g.
Enter the coefficients into the PDE Specification dialog box: c is 40*y, a is zero, d is 7800*500*y, and f is 20000*y.
Animate the solution over a span of 20000 seconds (computing the solution every 1000 seconds). We can see how heat flows in over the right and outer boundaries as long as u
< 100, and out when u > 100. You can also open the PDE Specification dialog box, and change the PDE type to Elliptic. This shows the solution when u does not depend on time,
i.e., the steady state solution. The profound effect of cooling on the outer boundary can be demonstrated by setting the heat transfer coefficient to zero.
Back to Top
Hyperbolic Problem
This section describes the solution of a hyperbolic PDE problem. The problem is solved using the Partial Differential Equation Toolbox graphical user interface (GUI) and
command-line functions.
for transverse vibrations of a membrane on a square with corners in (-1,-1), (-1,1), (1,-1), and (1,1). The membrane is fixed ( u = 0) at the left and right sides, and is free
at the upper and lower sides. Additionally, we need initial values for
u(t0) and
9 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The initial values need to match the boundary conditions for the solution to be well-behaved. If we start at t=0,
and
are initial values that satisfy the boundary conditions. The reason for the arctan and exponential functions is to introduce more modes into the solution.
Using the Graphical User Interface. Use the pdetool GUI in the generic scalar mode. Draw the square using the Rectangle/square option from the Draw menu or the button
with the rectangle icon. Proceed to define the boundary conditions by clicking the button and then double-click the boundaries to define the boundary conditions.
Initialize the mesh by clicking the Δ button or by selecting Initialize mesh from the Mesh menu.
Also, define the hyperbolic PDE by opening the PDE Specification dialog box, selecting the hyperbolic PDE, and entering the appropriate coefficient values. The general
hyperbolic PDE is described by
Before solving the PDE, select Parameters from the Solve menu to open the Solve Parameters dialog box. As a list of times, enter linspace(0,5,31) and as initial values for
u:
atan(cos(pi/2*x))
3*sin(pi*x).*exp(sin(pi/2*y))
Finally, click the = button to compute the solution. The best plot for viewing the waves moving in the x and y directions is an animation of the whole sequence of solutions.
Animation is a very real time and memory consuming feature, so you may have to cut down on the number of times at which to compute a solution. A good suggestion is to check
the Plot in x-y grid option. Using an x-y grid can speed up the animation process significantly.
Using Command-Line Functions. From the command line, solve the equation with the preceding boundary conditions and the initial values, starting at time 0 and then every
0.05 seconds for five seconds.
The geometry is described in the file squareg.m and the boundary conditions in the file squareb3.m. The following sequence of commands then generates a solution and
animates it. First, create a mesh and define the initial values and the times for which you want to solve the equation:
[p,e,t]=initmesh('squareg');
x=p(1,:)'; y=p(2,:)';
u0=atan(cos(pi/2*x));
ut0=3*sin(pi*x).*exp(sin(pi/2*y));
n=31;
tlist=linspace(0,5,n); % list of times
You are now ready to solve the wave equation. The general form for the hyperbolic PDE in Partial Differential Equation Toolbox software is
uu=hyperbolic(u0,ut0,tlist,'squareb3',p,e,t,1,0,0,1);
To visualize the solution, you can animate it. Interpolate to a rectangular grid to speed up the plotting:
10 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
delta=-1:0.1:1;
[uxy,tn,a2,a3]=tri2grid(p,t,uu(:,1),delta,delta);
gp=[tn;a2;a3];
umax=max(max(uu));
umin=min(min(uu));
newplot
M=moviein(n);
for i=1:n,
pdeplot(p,e,t,'xydata',uu(:,i),'zdata',uu(:,i),...
'mesh','off','xygrid','on','gridparam',gp,...
'colorbar','off','zstyle','continuous');
axis([-1 1 -1 1 umin umax]); caxis([umin umax]);
M(:,i)=getframe;
end
movie(M,10);
You can find a complete demo of this problem, including animation, in pdedemo6. If you have lots of memory, you can try increasing n, the number of frames in the movie.
Back to Top
Eigenvalue Problems
This section describes the solution of some eigenvalue PDE problems. The problems are solved using thePartial Differential Equation Toolbox graphical user interface (GUI) and
command-line functions. The problems include:
The problem is to compute all eigenmodes with eigenvalues < 100 for the eigenmode PDE problem
-Δu = λu
Using the Graphical User Interface. With the pdetool GUI active, check that the current mode is set to Generic Scalar. Then draw the L-shape as a polygon with corners in
(0,0), (-1,0), (-1,-1), (1,-1), (1,1), and (0,1).
There is no need to define any boundary conditions for this problem since the default condition— u = 0 on the boundary—is the correct one. Therefore, you can continue to the
next step: to initialize the mesh. Refine the initial mesh twice. Defining the eigenvalue PDE problem is also easy. Open the PDE Specification dialog box and select Eigenmodes.
The default values for the PDE coefficients, c = 1, a = 0, d = 1, all match the problem description, so you can exit the PDE Specification dialog box by clicking the OK button.
Open the Solve Parameters dialog box by selecting Parameters from the Solve menu. The dialog box contains an edit box for entering the eigenvalue search range. The default
entry is [0 100], which is just what you want.
Finally, solve the L-shaped membrane problem by clicking the = button. The solution displayed is the first eigenfunction. The value of the first (smallest) eigenvalue is also
displayed. You find the number of eigenvalues on the information line at the bottom of the GUI. You can open the Plot Selection dialog box and choose which eigenfunction to plot
by selecting from a pop-up menu of the corresponding eigenvalues.
Using Command-Line Functions. The geometry of the L-shaped membrane is described in the file lshapeg.m and the boundary conditions in the file lshapeb.m.
First, initialize the mesh and refine it twice using the command line functions at the MATLAB prompt:
[p,e,t]=initmesh('lshapeg');
[p,e,t]=refinemesh('lshapeg',p,e,t);
[p,e,t]=refinemesh('lshapeg',p,e,t);
This means that in this case you have c = 1, a = 0, and d = 1. The syntax of pdeeig, the Partial Differential Equation Toolbox eigenvalue solver, is
11 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
[v,l]=pdeeig(b,p,e,t,c,a,d,r)
The input argument r is a two-element vector indicating the interval on the real axis where pdeeig searches for eigenvalues. Here you are looking for eigenvalues < 100, so the
interval you use is [0 100].
Now you can call pdeeig and see how many eigenvalues you find:
[v,l]=pdeeig('lshapeb',p,e,t,1,0,1,[0 100]);
There are 19 eigenvalues smaller than 100. Plot the first eigenmode and compare it to the MATLAB membrane function:
pdesurf(p,t,v(:,1))
figure
membrane(1,20,9,9)
membrane can produce the first 12 eigenfunctions for the L-shaped membrane. Compare also the 12th eigenmodes:
figure
pdesurf(p,t,v(:,12))
figure
membrane(12,20,9,9)
Looking at the following eigenmodes, you can see how the number of oscillations increases. The eigenfunctions are symmetric or antisymmetric around the diagonal from (0,0) to
(1,-1), which divides the L-shaped membrane into two mirror images. In a practical computation, you could take advantage of such symmetries in the PDE problem, and solve
over a region half the size. The eigenvalues of the full L-shaped membrane are the union of those of the half with Dirichlet boundary condition along the diagonal (eigenvalues 2,
4, 7, 11, 13, 16, and 17) and those with Neumann boundary condition (eigenvalues 1, 3, 5, 6, 10, 12, 14, and 15).
The eigenvalues λ8 and λ9 make up a double eigenvalue for the PDE at around 49.64. Also, the eigenvalues λ 18 and λ 19 make up another double eigenvalue at around 99.87. You
may have gotten two different but close values. The default triangulation made by initmesh is not symmetric around the diagonal, but a symmetric grid gives a matrix with a true
double eigenvalue. Each of the eigenfunctions u8 and u9 consists of three copies of eigenfunctions over the unit square, corresponding to its double second eigenvalue. You may
not have obtained the zero values along a diagonal of the square—any line through the center of the square may have been computed. This shows a general fact about multiple
eigenvalues for symmetric matrices; namely that any vector in the invariant subspace is equally valid as an eigenvector. The two eigenfunctions u8 and u9 are orthogonal to each
other if the dividing lines make right angles. Check your solutions for that.
Actually, the eigenvalues of the square can be computed exactly. They are
2 2 2
(m +n )π
2
e.g., the double eigenvalue λ18 and λ19 is 10π , which is pretty close to 100.
If you compute the FEM approximation with only one refinement, you would only find 16 eigenvalues, and you obtain the wrong solution to the original problem. You can of course
check for this situation by computing the eigenvalues over a slightly larger range than the original problem.
You get some information from the printout in the MATLAB command window that is printed during the computation. For this problem, the algorithm computed a new set of
eigenvalue approximations and tested for convergence every third step. In the output, you get the step number, the time in seconds since the start of the eigenvalue computation,
and the number of converged eigenvalues with eigenvalues both inside and outside the interval counted.
You can see that two Arnoldi runs were made. In the first, 22 eigenvalues converged after a basis of size 70 was computed; in the second, where the vectors were orthogonalized
against all the 22 converged vectors, the smallest eigenvalue stabilized at a value outside of the interval [0, 100], so the algorithm signaled convergence. Of the 22 converged
eigenvalues, 19 were inside the search interval.
pdepoly([-1, 1, 1, 0, 0, -1],...
[-1, -1, 1, 1, 0, 0],'P1');
pdecirc(-a,a,a,'C1');
pderect([-a 0 a 0],'SQ1');
The extra circle and rectangle that are added using pdecirc and pderect to create the rounded corner are affected by the added input argument a through a couple of extra
12 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
lines of MATLAB code. This is possible since Partial Differential Equation Toolbox software is a part of the open MATLAB environment.
With lshapec you can create L-shaped rounded geometries with different degrees of roundness. If you use lshapec without an input argument, a default radius of 0.5 is used.
Otherwise, use lshapec(a), where a is the radius of the circle.
Experimenting using different values for the radius a shows you that the eigenvalues and the frequencies of the corresponding eigenmodes decrease as the radius increases, and
the shape of the L-shaped membrane becomes more rounded. In the following figure, the first eigenmode of an L-shaped membrane with a rounded corner is plotted.
-Δu = λu
We are interested in the eigenvalues smaller than 10 and the corresponding eigenmodes, so the search range is [-Inf 10]. The sign in the generalized Neumann condition is
such that there are negative eigenvalues.
Using the Graphical User Interface. Using the pdetool GUI in the generic scalar mode, draw the square using the Rectangle/square option from the Draw menu or the
button with the rectangle icon. Then define the boundary conditions by clicking the button and then double-click the boundaries to define the boundary conditions. On the right
side boundary, you have the generalized Neumann conditions, and you enter them as constants: g = 0 and q = -3/4.
Initialize the mesh and refine it once by clicking the Δ and refine buttons or by selecting the corresponding options from the Mesh menu.
Also, define the eigenvalue PDE problem by opening the PDE Specification dialog box and selecting the Eigenmodes option. The general eigenvalue PDE is described by
so for this problem you use the default values c = 1, a = 0, and d = 1. Also, in the Solve Parameters dialog box, enter the eigenvalue range as the MATLAB vector [-Inf 10].
Finally, click the = button to compute the solution. By default, the first eigenfunction is plotted. You can plot the other eigenfunctions by selecting the corresponding eigenvalue
from a pop-up menu in the Plot Selection dialog box. The pop-up menu contains all the eigenvalues found in the specified range. You can also export the eigenfunctions and
eigenvalues to the MATLAB main workspace by using the Export Solution option from the Solve menu.
Using Command-Line Functions. The geometry description file and boundary condition file for this problem are called squareg.m and squareb2.m, respectively. Use the
following sequence of commands to find the eigenvalues in the specified range and the corresponding eigenfunctions:
[p,e,t]=initmesh('squareg');
[p,e,t]=refinemesh('squareg',p,e,t);
The eigenvalue PDE coefficients c, a, and d for this problem are c = 1, a = 0, and d = 1. You can enter the eigenvalue range r as the MATLAB vector [-Inf 10]. pdeeig
returns two output arguments, the eigenvalues as an array l and a matrix v of corresponding eigenfunctions:
[v,l]=pdeeig('squareb2',p,e,t,1,0,1,[-Inf 10]);
13 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
pdesurf(p,t,v(:,4))
The functions f and g are eigenfunctions in the x and y directions, respectively. In the x direction, the first eigenmode is a slowly increasing exponential function. The higher modes
include sinusoids. In the y direction, the first eigenmode is a straight line (constant), the second is half a cosine, the third is a full cosine, the fourth is one and a half full cosines,
etc. These eigenmodes in the y direction are associated with the eigenvalues:
There are five eigenvalues smaller than 10 for this problem, and the first one is even negative (-0.4145). It is possible to trace the preceding eigenvalues in the eigenvalues of the
solution. Looking at a plot of the first eigenmode, you can see that it is made up of the first eigenmodes in the x and y directions. The second eigenmode is made up of the first
eigenmode in the x direction and the second eigenmode in the y direction.
Look at the difference between the first and the second eigenvalue:
l(2)-l(1)
ans =
2.4740
pi*pi/4
ans =
2.4674
Likewise, the fifth eigenmode is made up of the first eigenmode in the x direction and the third eigenmode in the y direction. As expected, l(5)-l(1) is approximately equal to
2
π . You can explore higher modes by increasing the search range to include eigenvalues greater than 10.
Back to Top
Application Modes
In this section we describe the application modes of the pdetool graphical user interface (GUI). Examples are given for a variety of applications to different engineering
problems.
Note From the GUI, the system PDEs are restricted to problems with vector valued u of dimension two. Using command-line functions, there is no formal restriction on
the dimension of u.
The application mode can be selected directly from the pop-up menu in the upper right part of the GUI or by selecting an application from the Application submenu in the
Options menu. Changing the application resets all PDE coefficients and boundary conditions to the default values for that specific application mode.
When using an application mode, the generic PDE coefficients are replaced by application-specific parameters such as Young's modulus for problems in structural mechanics.
The application-specific parameters are entered by selecting Parameters from the PDE menu or by clicking the PDE button. You can also access the PDE parameters by
double-clicking a subdomain, if you are in the PDE mode. That way it is possible to define PDE parameters for problems with regions of different material properties. The
Boundary condition dialog box is also altered so that the Description column reflects the physical meaning of the different boundary condition coefficients. Finally, the Plot
Selection dialog box allows you to visualize the relevant physical variables for the selected application.
Note In the User entry options in the Plot Selection dialog box, the solution and its derivatives are always referred to as u, ux, and uy (v, vx, and vy for the system
cases) even if the application mode is nongeneric and the solution of the application-specific PDE normally is named, e.g., V or T.
In the remaining part of this section, we explain each of the application modes in more detail and give examples of how to solve application specific problems using Partial
Differential Equation Toolbox functions.
The stress-strain relation can then be written, assuming isotropic and isothermal conditions
where σx and σy are the stresses in the x and y directions, and τxy is the shear stress. The material properties are expressed as a combination of E, the elastic modulus or
Young's modulus, and ν, Poisson's ratio.
The deformation of the material is described by the displacements in the x and y directions, u and v, from which the strains are defined as
14 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
Combining the preceding relations, we arrive at the displacement equations, which can be written
where is a rank four tensor, which can be written as four 2-by-2 matrices c11, c12, c21, and c22:
This is an elliptic PDE of system type (u is two-dimensional), but you need only to set the application mode to Structural Mechanics, Plane Stress and then enter the
material-dependent parameters E and ν and the volume forces k into the PDE Specification dialog box.
In this mode, you can also solve the eigenvalue problem, which is described by
ρ, the density, can also be entered using the PDE Specification dialog box.
In the Plot Selection dialog box, the x- and y-displacements, u and v, and the absolute value of the displacement vector (u,v) can be visualized using color, contour lines, or
z-height, and the displacement vector field (u,v) can be plotted using arrows or a deformed mesh. In addition, for visualization using color, contour lines, or height, you can choose
from 15 scalar tensor expressions:
For a more detailed discussion on the theory of stress-strain relations and applications of FEM to problems in structural mechanics, see Cook, Robert D., David S. Malkus, and
Michael E. Plesha, Concepts and Applications of Finite Element Analysis, 3rd edition, John Wiley & Sons, New York, 1989.
15 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
Example. Consider a steel plate that is clamped along a right-angle inset at the lower-left corner, and pulled along a rounded cut at the upper-right corner. All other sides are free.
The steel plate has the following properties: Dimension: 1-by-1 meters; thickness 1 mm; inset is 1/3-by-1/3 meters. The rounded cut runs from (2/3, 1) to (1, 2/3). Young's
3 2
modulus: 196 · 10 (MN/m ), Poisson's ratio: 0.31.
The curved boundary is subjected to an outward normal load of 500 N/m. We need to specify a surface traction; we therefore divide by the thickness 1 mm, thus the surface
2
tractions should be set to 0.5 MN/m . We will use the force unit MN in this example.
We want to compute a number of interesting quantities, such as the x- and y-direction strains and stresses, the shear stress, and the von Mises effective stress.
Using the Graphical User Interface. Using the pdetool GUI, set the application mode to Structural Mechanics, Plane Stress.
The CSG model can be made very quickly by drawing a polygon with corners in x=[0 2/3 1 1 1/3 1/3 0] and y=[1 1 2/3 0 0 1/3 1/3] and a circle with center in
x=2/3, y=2/3 and radius 1/3.
The polygon is normally labeled P1 and the circle C1, and the CSG model of the steel plate is simply P1+C1.
Next, select Boundary Mode to specify the boundary conditions. First, remove all subdomain borders by selecting Remove All Subdomain Borders from the Boundary menu.
The two boundaries at the inset in the lower left are clamped, i.e., Dirichlet conditions with zero displacements. The rounded cut is subject to a Neumann condition with q=0 and
g1=0.5*nx, g2=0.5*ny. The remaining boundaries are free (no normal stress), that is, a Neumann condition with q=0 and g=0.
The next step is to open the PDE Specification dialog box and enter the PDE parameters.
The E and ν (nu) parameters are Young's modulus and Poisson's ratio, respectively. There are no volume forces, so Kx and Ky are zero. ρ (rho) is not used in this mode. The
material is homogeneous, so the same E and [[ν apply to the whole 2-D domain.
Initialize the mesh by clicking the Δ button. If you want, you can refine the mesh by clicking the Refine button.
A number of different strain and stress properties can be visualized, such as the displacements u and v, the x- and y-direction strains and stresses, the shear stress, the von
Mises effective stress, and the principal stresses and strains. All these properties can be selected from pop-up menus in the Plot Selection dialog box. A combination of scalar and
vector properties can be plotted simultaneously by selecting different properties to be represented by color, height, vector field arrows, and displacements in a 3-D plot.
Select to plot the von Mises effective stress using color and the displacement vector field (u,v) using a deformed mesh. Select the Color and Deformed mesh plot types. To plot
the von Mises effective stress, select von Mises from the pop-up menu in the Color row.
In areas where the gradient of the solution (the stress) is large, you need to refine the mesh to increase the accuracy of the solution. Select Parameters from the Solve menu and
select the Adaptive mode check box. You can use the default options for adaptation, which are the Worst triangles triangle selection method with the Worst triangle fraction
set to 0.5. Now solve the plane stress problem again. Select the Show Mesh option in the Plot Selection dialog box to see how the mesh is refined in areas where the stress is
large.
Visualization of the von Mises Effective Stress and the Displacements Using Deformed Mesh
16 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The places where the plane strain equations differ from the plane stress equations are:
Plane strain problems are less common than plane stress problems. An example is a slice of an underground tunnel that lies along the z-axis. It deforms in essentially plane strain
conditions.
Electrostatics
Applications involving electrostatics include high voltage apparatus, electronic devices, and capacitors. The "statics" implies that the time rate of change is slow, and that
wavelengths are very large compared to the size of the domain of interest. In electrostatics, the electrostatic scalar potential V is related to the electric field E by E = -∇V and,
using one of Maxwell's equations, ∇ · D = ρ and the relationship D = εE, we arrive at the Poisson equation
-12
Note ε should really be written as εε0, where ε0 is the coefficient of dielectricity or permittivity of vacuum (8.854 · 10 farad/meter) and ε is the relative coefficient of
dielectricity that varies among different dielectrics (1.00059 in air, 2.24 in transformer oil, etc.).
Using the Partial Differential Equation Toolbox electrostatics application mode, you can solve electrostatic problems modeled by the preceding equation.
The boundary conditions for electrostatic problems can be of Dirichlet or Neumann type. For Dirichlet conditions, the electrostatic potential V is specified on the boundary. For
For visualization of the solution to an electrostatic problem, the plot selections include the electrostatic potential V, the electric field E, and the electric displacement field D.
For a more in-depth discussion of problems in electrostatics, see Popovic, Branko D., Introductory Engineering Electromagnetics, Addison-Wesley, Reading, MA, 1971.
Example. Let us consider the problem of determining the electrostatic potential in an air-filled quadratic "frame," bounded by a square with side length of 0.2 in the center and by
outer limits with side length of 0.5. At the inner boundary, the electrostatic potential is 1000V. At the outer boundary, the electrostatic potential is 0V. There is no charge in the
domain. This leads to the problem of solving the Laplace equation
ΔV = 0
17 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
with the Dirichlet boundary conditions V = 1000 at the inner boundary, and V = 0 at the outer boundary.
Using the Graphical User Interface. After setting the application mode to Electrostatics, the 2-D area is most easily drawn by first drawing a square with sides of length 0.2
(use the Snap option and adjust the grid spacing if necessary). Then draw another square with sides of length 0.5 using the same center position. The 2-D domain is then simply
SQ2-SQ1, if the first square is named SQ1 and the second square is named SQ2. Enter the expression into the Set formula edit box, and proceed to define the boundary
conditions. Use Shift+click to select all the inner boundaries. Then double-click an inner boundary and enter 1000 as the Dirichlet boundary condition for the inner boundaries.
Next, open the PDE Specification dialog box, and enter 0 into the space charge density (rho) edit field. The coefficient of dielectricity can be left at 1, since it does not affect the
result as long as it is constant.
Initialize the mesh, and click the = button to solve the equation. Using the adaptive mode, you can improve the accuracy of the solution by refining the mesh close to the reentrant
corners where the gradients are steep. For example, use the triangle selection method picking the worst triangles and set the maximum number of triangles to 500. Add one
uniform mesh refinement by clicking the Refine button once. Finally turn adaptive mode off, and click the = button once more.
To look at the equipotential lines, select a contour plot from the Plot Selection dialog box. To display equipotential lines at every 100th volt, enter 0:100:1000 into the Contour
plot levels edit box.
Magnetostatics
Magnets, electric motors, and transformers are areas where problems involving magnetostatics can be found. The "statics" implies that the time rate of change is slow, so we start
with Maxwell's equations for steady cases,
where is the magnetic flux density, is the magnetic field intensity, is the current density, and µ is the material's magnetic permeability.
and
The plane case assumes that the current flows are parallel to the z-axis, so only the z component of is present,
and the preceding equation can be simplified to the scalar elliptic PDE
where J = J(x,y).
For the 2-D case, we can compute the magnetic flux density as
18 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The interface condition across subdomain borders between regions of different material properties is that H x n be continuous. This implies the continuity of
and does not require special treatment since we are using the variational formulation of the PDE problem.
In ferromagnetic materials, µ is usually dependent on the field strength |B| = |∇A|, so the nonlinear solver is needed.
The Dirichlet boundary condition specifies the value of the magnetostatic potential A on the boundary. The Neumann condition specifies the value of the normal component of
on the boundary. This is equivalent to specifying the tangential value of the magnetic field H on the boundary.
Visualization of the magnetostatic potential A, the magnetic field H, and the magnetic flux density B is available. B and H can be plotted as vector fields.
For a more detailed discussion on Maxwell's equations and magnetostatics, see Popovic, Branko D., Introductory Engineering Electromagnetics, Addison-Wesley, Reading, MA,
1971.
Example. As an example of a problem in magnetostatics, consider determining the static magnetic field due to the stator windings in a two-pole electric motor. The motor is
considered to be long, and when end effects are neglected, a 2-D computational model suffices.
The magnetic permeability µ is 1 in the air and in the coil. In the stator and the rotor, µ is defined by
µmax = 5000, µmin = 200, and c = 0.05 are values that could represent transformer steel.
The geometry of the problem makes the magnetic vector potential A symmetric with respect to y and antisymmetric with respect to x, so you can limit the domain to x ≥ 0,y≥0 with
the Neumann boundary condition
on the x-axis and the Dirichlet boundary condition A = 0 on the y-axis. The field outside the motor is neglected leading to the Dirichlet boundary condition A = 0 on the exterior
boundary.
Using the Graphical User Interface. The geometry is complex, involving five circular arcs and two rectangles. Using the pdetool GUI, set the x-axis limits to [-1.5 1.5] and the
y-axis limits to [-1 1]. Set the application mode to Magnetostatics, and use a grid spacing of 0.1. The model is a union of circles and rectangles; the reduction to the first
quadrant is achieved by intersection with a square. Using the "snap-to-grid" feature, you can draw the geometry using the mouse, or you can draw it by entering the following
commands:
pdecirc(0,0,1,'C1')
pdecirc(0,0,0.8,'C2')
pdecirc(0,0,0.6,'C3')
pdecirc(0,0,0.5,'C4')
pdecirc(0,0,0.4,'C5')
pderect([-0.2 0.2 0.2 0.9],'R1')
pderect([-0.1 0.1 0.2 0.9],'R2')
pderect([0 1 0 1],'SQ1')
You should get a CSG model similar to the one in the following plot.
19 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
Enter the following set formula to reduce the model to the first quadrant:
(C1+C2+C3+C4+C5+R1+R2)*SQ1
In boundary mode you need to remove a number of subdomain borders. Using Shift+click, select borders and remove them using the Remove Subdomain Border option from
the Boundary menu until the geometry consists of four subdomains: the stator, the rotor, the coil, and the air gap. In the following plot, the stator is subdomain 1, the rotor is
subdomain 2, the coil is subdomain 3, and the air gap is subdomain 4. The numbering of your subdomains may be different.
Before moving to the PDE mode, select the boundaries along the x-axis and set the boundary condition to a Neumann condition with g = 0 and q = 0. In the PDE mode, turn on
the labels by selecting the Show Subdomain Labels option from the PDE menu. Double-click each subdomain to define the PDE parameters:
In the coil both µ and J are 1, so the default values do not need to be changed.
In the stator and the rotor µ is nonlinear and defined by the preceding equation. Enter µ as
5000./(1+0.05*(ux.^2+uy.^2))+200
2
ux.^2+uy.^2 is equal to |∇A | . J is 0 (no current).
20 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
Initialize the mesh, and continue by opening the Solve Parameters dialog box by selecting Parameters from the Solve menu. Since this is a nonlinear problem, the nonlinear
solver must be invoked by checking the Use nonlinear solver. If you want, you can adjust the tolerance parameter. The adaptive solver can be used together with the nonlinear
solver. Solve the PDE and plot the magnetic flux density B using arrows and the equipotential lines of the magnetostatic potential A using a contour plot. The plot clearly shows, as
expected, that the magnetic flux is parallel to the equipotential lines of the magnetostatic potential.
AC Power Electromagnetics
AC power electromagnetics problems are found when studying motors, transformers and conductors carrying alternating currents.
Let us start by considering a homogeneous dielectric, with coefficient of dielectricity ε and magnetic permeability µ, with no charges at any point. The fields must satisfy a special
set of the general Maxwell's equations:
For a more detailed discussion on Maxwell's equations, see Popovic, Branko D., Introductory Engineering Electromagnetics, Addison-Wesley, Reading, MA, 1971.
In the absence of current, we can eliminate from the first set and from the second set and see that both fields satisfy wave equations with wave speed
We move on to studying a charge-free homogeneous dielectric, with coefficient of dielectrics ε, magnetic permeability µ, and conductivity σ. The current density then is
The case of time harmonic fields is treated by using the complex form, replacing by
The plane case of this Partial Differential Equation Toolbox mode has , and the magnetic field
This is the equation used by Partial Differential Equation Toolbox software in the AC power electromagnetics application mode. It is a complex Helmholtz's equation, describing the
propagation of plane electromagnetic waves in imperfect dielectrics and good conductors ( σ » ωε). A complex permittivity εc can be defined as εc = ε-jσ/ω. The conditions at
21 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
material interfaces with abrupt changes of ε and µ are the natural ones for the variational formulation and need no special attention.
The PDE parameters that have to be entered into the PDE Specification dialog box are the angular frequency ω, the magnetic permeability µ, the conductivity σ, and the
coefficient of dielectricity ε.
The boundary conditions associated with this mode are a Dirichlet boundary condition, specifying the value of the electric field Ec on the boundary, and a Neumann condition,
specifying the normal derivative of Ec. This is equivalent to specifying the tangential component of the magnetic field H:
Interesting properties that can be computed from the solution—the electric field E—are the current density J = σE and the magnetic flux density
The electric field E, the current density J, the magnetic field H and the magnetic flux density B are available for plots. Additionally, the resistive heating rate
is also available. The magnetic field and the magnetic flux density can be plotted as vector fields using arrows.
6
Example. The example demonstrates the skin effect when AC current is carried by a wire with circular cross section. The conductivity of copper is 57 · 10 , and the permeability
-7 2
is 1, i.e., µ = 4π10 . At the line frequency (50 Hz) the ω ε-term is negligible.
Due to the induction, the current density in the interior of the conductor is smaller than at the outer surface where it is set to J S = 1, a Dirichlet condition for the electric field, Ec =
1/σ. For this case an analytical solution is available,
where
R is the radius of the wire, r is the distance from the center line, and J0(x) is the first Bessel function of zeroth order.
Using the Graphical User Interface. Start the pdetool GUI and set the application mode toAC Power Electromagnetics. Draw a circle with radius 0.1 to represent a cross
section of the conductor, and proceed to the boundary mode to define the boundary condition. Use the Select All option to select all boundaries and enter 1/57E6 into the r edit
field in the Boundary Condition dialog box to define the Dirichlet boundary condition (E = J/σ).
Open the PDE Specification dialog box and enter the PDE parameters. The angular frequency ω = 2 · π · 50.
Initialize the mesh and solve the equation. Due to the skin effect, the current density at the surface of the conductor is much higher than in the conductor's interior. This is clearly
visualized by plotting the current density J as a 3-D plot. To improve the accuracy of the solution close to the surface, you need to refine the mesh. Open the Solve Parameters
dialog box and select the Adaptive mode check box. Also, set the maximum numbers of triangles to Inf, the maximum numbers of refinements to 1, and use the triangle
selection method that picks the worst triangles. Recompute the solution several times. Each time the adaptive solver refines the area with the largest errors. The number of
triangles is printed on the command line. The following mesh is the result of successive adaptations and contains 1548 triangles.
22 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The solution of the AC power electromagnetics equation is complex. The plots show the real part of the solution (a warning message is issued), but the solution vector, which can
be exported to the main workspace, is the full complex solution. Also, you can plot various properties of the complex solution by using the user entry. imag(u) and abs(u) are
two examples of valid user entries.
The skin effect is an AC phenomenon. Decreasing the frequency of the alternating current results in a decrease of the skin effect. Approaching DC conditions, the current density
is close to uniform (experiment using different angular frequencies).
Conductive Media DC
For electrolysis and computation of resistances of grounding plates, we have a conductive medium with conductivity σ and a steady current. The current density J is related to the
electric field E through J = σE. Combining the continuity equation ∇ · J = Q, where Q is a current source, with the definition of the electric potential V yields the elliptic Poisson's
equation
-∇ · (σ∇V) = Q
The only two PDE parameters are the conductivity σ and the current source Q.
The Dirichlet boundary condition assigns values of the electric potential V to the boundaries, usually metallic conductors. The Neumann boundary condition requires the value of
23 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
the normal component of the current density (n · (σ ∇(V))) to be known. It is also possible to specify a generalized Neumann condition defined by n · (σ ∇V) + qV = g, where q can
The electric potential V, the electric field , and the current density are all available for plotting. Interesting quantities to visualize are the current lines (the vector field of )
and the equipotential lines of V. The equipotential lines are orthogonal to the current lines when σ is isotropic.
Example. Two circular metallic conductors are placed on a plane, thin conductor like a blotting paper wetted by brine. The equipotentials can be traced by a voltmeter with a
simple probe, and the current lines can be traced by strongly colored ions, such as permanganate ions.
The physical model for this problem consists of the Laplace equation
-∇ · (σ∇V) = 0
pdetool
5. Click and draw the blotting paper as a rectangle with corners in (-1.2,-0.6), (1.2,-0.6), (1.2,0.6), and (-1.2,0.6).
6. Click and add two circles with radius 0.3 that represent the circular conductors. Place them symmetrically with centers in (-0.6,0) and (0.6,0).
7. To express the 2-D domain of the problem, enter
R1-(C1+C2)
11. Hold down Shift and click to select the left circular conductor boundaries. Double-click the last boundary to open the Boundary Condition dialog box.
24 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
13. Hold down Shift and click to select the right circular conductor boundaries. Double-click the last boundary to open the Boundary Condition dialog box.
14. Set the parameters as follows and then click OK:
Condition type = Dirichlet
h=1
r = -1
15. Open the PDE Specification dialog box by clicking PDE > PDE Specification.
16. Set the current source, q, parameter to 0.
25 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
21. Visualize the current density by clicking Plot > Parameters, selecting Contour and Arrows check box, and clicking Plot.
The current flows, as expected, from the conductor with a positive potential to the conductor with a negative potential.
Heat Transfer
The heat equation is a parabolic PDE:
It describes the heat transfer process for plane and axisymmetric cases, and uses the following parameters:
Density ρ
Heat capacity C
26 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
The term h · (Text - T) is a model of transversal heat transfer from the surroundings, and it may be useful for modeling heat transfer in thin cooling plates etc.
For the steady state case, the elliptic version of the heat equation,
is also available.
The boundary conditions can be of Dirichlet type, where the temperature on the boundary is specified, or of Neumann type where the heat flux, , is specified. A
generalized Neumann boundary condition can also be used. The generalized Neumann boundary condition equation is , where q is the heat transfer
coefficient.
Visualization of the temperature, the temperature gradient, and the heat flux k∇T is available. Plot options include isotherms and heat flux vector field plots.
Example. In the following example, a heat transfer problem with differing material parameters is solved.
The problem's 2-D domain consists of a square with an embedded diamond (a square with 45 degrees rotation). The square region consists of a material with coefficient of heat
conduction of 10 and a density of 2. The diamond-shaped region contains a uniform heat source of 4, and it has a coefficient of heat conduction of 2 and a density of 1. Both
regions have a heat capacity of 0.1.
Using the Graphical User Interface. Start the pdetool GUI and set the application mode to Heat Transfer. In draw mode, set the x- and y-axis limits to [-0.5 3.5] and
select the Axis Equal option from the Options menu. The square region has corners in (0,0), (3,0), (3,3), and (0,3). The diamond-shaped region has corners in (1.5,0.5),
(2.5,1.5), (1.5,2.5), and (0.5,1.5).
The temperature is kept at 0 on all the outer boundaries, so you do not have to change the default boundary conditions. Move on to define the PDE parameters (make sure to set
the application mode to Heat Transfer in the PDE mode by double-clicking each of the two regions and enter the PDE parameters. You want to solve the parabolic heat equation,
so make sure that the Parabolic option is selected. In the square region, enter a density of 2, a heat capacity of 0.1, and a coefficient of heat conduction of 10. There is no heat
source, so set it to 0. In the diamond-shaped region, enter a density of 1, a heat capacity of 0.1, and a coefficient of heat conduction of 2. Enter 4 in the edit field for the heat
source. The transversal heat transfer term h · (Text - T) is not used, so set h, the convective heat transfer coefficient, to 0.
Since you are solving a dynamic PDE, you have to define an initial value, and the times at which you want to solve the PDE. Open the Solve Parameters dialog box by selecting
Parameters from the Solve menu. The dynamics for this problem is very fast—the temperature reaches steady state in about 0.1 time units. To capture the interesting part of the
dynamics, enter logspace(-2,-1,10) as the vector of times at which to solve the heat equation. logspace(-2,-1,10) gives 10 logarithmically spaced numbers between
0.01 and 0.1. Set the initial value of the temperature to 0. If the boundary conditions and the initial value differ, the problem formulation contains discontinuities.
Solve the PDE. By default, the temperature distribution at the last time is plotted. The best way to visualize the dynamic behavior of the temperature is to animate the solution.
When animating, turn on the Height (3-D plot) option to animate a 3-D plot. Also, select the Plot in x-y grid option. Using a rectangular grid instead of a triangular grid speeds up
the animation process significantly.
Other interesting visualizations are made by plotting isothermal lines using a contour plot, and by plotting the heat flux vector field using arrows.
Diffusion
Since heat transfer is a diffusion process, the generic diffusion equation has the same structure as the heat equation:
27 of 28 18/03/2018 09:46
Common PDE Problems :: Getting Started (Partial Differential Equation... text://2
where c is the concentration, D is the diffusion coefficient and Q is a volume source. If diffusion process is anisotropic, in which case D is a 2-by-2 matrix, you must solve the
diffusion equation using the generic system application mode of the pdetool GUI. For more information, see PDE Menu.
The boundary conditions can be of Dirichlet type, where the concentration on the boundary is specified, or of Neumann type, where the flux, , is specified. It is also
possible to specify a generalized Neumann condition. It is defined by , where q is a transfer coefficient.
Visualization of the concentration, its gradient, and the flux is available from the Plot Selection dialog box.
Back to Top
References
[1] Cook, Robert D., David S. Malkus, and Michael E. Plesha, Concepts and Applications of Finite Element Analysis, 3rd edition, John Wiley & Sons, New York, 1989.
[2] Popovic, Branko D., Introductory Engineering Electromagnetics, Addison-Wesley, Reading, MA, 1971.
Back to Top
Was this topic helpful? Yes No
28 of 28 18/03/2018 09:46