You are on page 1of 13

# User Manual for Partial Differential Equation Graphical User Interface

The Partial Differential Equation Graphical User Interface (PDE-GUI) can be obtained by accessing your own ECE510 account on Blackboard. Click on the Content tab on the left hand side of the panel, and select the Graphical User Interfaces section. Download the file entitled PDE-GUI.zip, extract all files from the archive into a separate folder, and run the executable entitled PDE-GUI.exe. Note: In case you get an error when attempting to run the executable, run MATLAB and open -> run the file entitled PDE_solver_GUI_1.m. The PDE-GUI is designed to strengthen the users understanding of partial differential equations. The following sections provide users with detailed descriptions of key features of the PDE GUI which involve the solution to 1 dimensional problems.

Types of PDEs There are a number of PDE types found in practice. They are Parabolic (Continuity) Equation (Cartesian)

http://mathworld.wolfram.com/ParabolicPartialDifferentialEquation.html The Parabolic Equation, in Cartesian coordinates, plays a prominent role in many scientific fields including heat diffusion, semiconductor physics and acoustic propagation. The characteristic Parabolic Equation has a first order derivative with respect to time and a first and/or second order derivative with respect to space. One example of this type of PDE is the one-dimensional heat equation (see eq. 1 where T is temperature), which can describe one dimensional heat propagation across the length of a component. The origins of this equation will be described in Lectures 6 and 7.
T = t

K x2

2 T

(1)

The Parabolic Equation, in cylindrical coordinates has been implemented. Problems in which radial symmetry applies can be solved.

-1-

## Hyperbolic (Wave) Equation

http://mathworld.wolfram.com/HyperbolicPartialDifferentialEquation.html The Hyperbolic (Wave) Equation can describe a wide family of problems in mechanics and electromagnetics. The wave equation can be identified by its second order time derivative and second order space derivative with respect to the unknown. For example, the wave equation can be used to describe the propagation of an electrical signal along a transmission line. In free space, the wave equation describing the propagation of electromagnetic waves takes on the following form:

is the electric field, H is the magnetic intensity field and 0 , 0 are the permeability and where E permittivity of free space respectively. Elliptical Equation

2 0 0

2 0 0

t2

t2 2

= 0 H

= 0 E

(2.1) (2.2)

http://mathworld.wolfram.com/EllipticPartialDifferentialEquation.html The Elliptical (Laplace or Poissons) Equation is used in a number of electrostatic and flow problems to solve for a scalar potential function. This PDE has not been implemented in the PDE toolbox so it will not be discussed further.

The user selects the type of partial differential equation from a list. The selection of the Parabolic (Continuity) Equation (Cartesian) is demonstrated below.

The PDEs presented in this GUI are a function of time (t) and one spatial coordinate (x), with only one unknown variable (u). However, the same methodology and solving procedures apply for PDEs with more than two variables (i.e.: u(x, y, z, t)). Once users select the type of PDE they want to solve, the equation will be shown in black font on the PDE GUI (refer to figure 1.1).
-2-

## Figure 1.1 Equation form of the two types of PDEs

Boundary Conditions for PDEs Each PDE has to have an appropriate set of boundary conditions in order to yield a completely-defined problem. Users can select from two types of boundary conditions: Dirichlet or Neumann. The Dirichlet boundary condition sets the unknown variable to a fixed value at the boundary. For example, if u(x, t) is the unknown variable, setting a Dirichlet boundary condition at x=0 equal to 5 imposes the constraint u(0, t) = 5. For a 1 dimensional problem you are required to specify boundary conditions at both ends as shown in Fig. 1.2a. The values of the Dirichlet boundary conditions have to be keyed into the appropriate textboxes, which are displayed in figure 1.2b.

## Figure 1.2a Boundary condition type

Figure 1.2b Dirichlet boundary condition values The Neumann boundary condition sets the derivative of the unknown variable with respect to a parameter (x) to a fixed value. For example, if the unknown variable is u(x, t), setting a Neumann boundary condition of 3 at x=L will impose the following constraint on the system: = 3. Basically, the Neumann boundary condition fixes the flux across the = boundary of the unknown variable.
-3-

The values of the Neumann boundary conditions at either end have to be keyed into the textboxes displayed in figure 1.2c. While setting both ends to Neumann boundary conditions is mathematically sound, it can create numerical instabilities, with many software packages (problem is underspecified), so normally we do not specify Neumann conditions on both ends. Instead, we specify a Dirichlet condition on one end and a Neumann condition on the other end.

## Figure 1.2c Neumann boundary condition values

Data Input Area 1. Simulation Time Users enter a simulation time (sec) in this box in order to define the time span of solving the selected PDE. For example, if the user selects a simulation time of 10 seconds, then the PDE GUI will provide the solution for u(x, t) from t =0 to t=10 (see figure 1.3).

Figure 1.3 Simulation time input area 2. Domain Length and Number of Volumes Users need to specify the domain length that the unknown variable is defined over. For example, if L=5m, then the unknown variable u(x, t) will be solved over the interval x=0 to x=5. The number of volumes (nodes) entered in the right-side box represents how many nodes or elements will be created within the specified domain length. For example, if the domain length entered is 5m with 3 nodes, three elements will be distributed across a 5m length (refer to figure 1.4).

## Figure 1.4 Domain length and number of volumes input area

-4-

3. Initial Condition for Continuity and Wave Equations Solving a PDE requires setting a set of initial conditions for the unknown variable(s). For the PDE-GUI case, since we are dealing with only one unknown denoted as u(x, t), users are required to input the values of u as a function of x for t =0. Users are required to enter at least two sets of data points and the first data point needs to be for x=0. The PDE GUI will perform a linear interpolation for the data points that were input in the table displayed in figure 1.5a. The plot of u(x, 0) will be generated when users press the Plot u(x, 0) button (see figure 1.5b).

## Figure 1.5b Plot of u(x, 0)

4. Parameters for Parabolic (Continuity) Equation and Nonlinear ODE The textboxes displayed in figure 1.6a and 1.6b will only be activated if users select the Parabolic Equation as the PDE source. The corresponding equation where these two variables are involved is displayed in figure 1.7.

-5-

## Figure 1.6b - Coefficient b input area

Figure 1.7 Identifying variables in the Parabolic Equation 5. Inputs for diffusion coefficient c(u) and source term S(u) Users need to input at least two data points for the diffusion coefficient or source term so that the PDE GUI will be able to perform interpolation for the data points entered in the corresponding table (see figure 1.8a and 1.9a). The plot of c(u) and S(u) will be generated based on those data points when users press the Plot c(u) and Plot S(u) buttons respectively (see figure 1.8b and 1.9b). If users desire a constant source or diffusion coefficient term, they are required to create two table entries with the same value on the right hand side of that table.

-6-

## Figure 1.9b A plot of S(u)

The corresponding equation where both S(u) and c(u) are utilized is indicated in figure 2.0.

Figure 2.0 Identifying variables in the Parabolic Equation 6. Hyperbolic (Wave) Equation Parameters In the case of a hyperbolic equation, users must input data for the term preceding the second order time derivative, in the area displayed in Fig. 2.1.

-7-

## Solving the Partial Differential Equation (PDE)

The chosen differential equation is solved when users press the Solve button (see figure 2.2a). The screen on the lower left hand side of the GUI generates the plot of the unknown variable at the boundary: If users select the Parabolic (Continuity) Equation (Cartesian), the plot of u(0,t) will be generated. If users select the Hyperbolic (Wave) Equation, the window will display u(0,t) in blue and u(L,t) in green respectively. If users select the Parabolic (Continuity) Equation (Radial), the screen will display u(L,t).

As an example, if users select the Parabolic (Continuity) Equation (Cartesian) with a Dirichlet boundary condition of u=5 at x=0, then a horizontal line of amplitude 5 will be displayed in the plot window (see figure 2.2b). On the other hand, if users choose the Neumann boundary condition and specify Flux=5 at x=0, the value of u at x=0 can change since the boundary is restricted only in terms of the flux, i.e. dx = constant (see figure 2.3).
du

## Figure 2.2b Plot of u(0,t) for a Dirichlet boundary condition

-8-

Figure 2.3 Plot of u(0,t) for a Neumann boundary condition The video button (see figure 2.4a) allows users to view the graph of u(x, t) and how it changes its shape with respect to time. Note: Users should not close the video window manually. Please allow for the window to close on its own, otherwise, the PDE-GUI might crash.

## Figure 2.4b Animation of u(x, t)

-9-

Sample Demonstration
This sample demonstration is a walk-through of the PDE GUI and should provide users with a practical example of how to use the software. 1. Open the PDE GUI 2. Select a PDE type Example: Parabolic (Continuity) Equation (Cartesian) (see figure 2.5)

Figure 2.5 PDE type list 3. Enter simulation Time (see figure 2.6)

Figure 2.6 Simulation Time input area 4. Enter Domain Length L(m) (see figure 2.7)

Figure 2.7 Domain Length input area 5. Enter Number of Volumes N (see figure 2.8)

Figure 2.8 Number of Volumes input area 6. Select Boundary Conditions Example: Dirichlet for both end (see figure 2.9)

- 10 -

Figure 2.9 Boundary Condition List 7. Enter values of u (see figure 3.0)

Figure 3.0 U input area 8. Enter the initial condition values for the continuity equation, as shown in figure 3.1

Figure 3.1 Initial condition input area for the continuity and wave equation 9. Enter values for convective velocity v and coefficient b ( see figure 3.2)

Figure 3.2 Convective Velocity v and coefficient b input area 10. Enter values in the c(u) and S(u) tables as shown in figure 3.3

- 11 -

Figure 3.3 Input area for c(u) and S(u) 11. Press the Plot u(x,0), Plot c(u) and Plot S(u) buttons to look at the initial state of variable u, and at the shape of the c(u) and S(u) coefficients. Three plots are generated, as shown in figures 3.4a, 3.4b, and 3.4c.

## Figure 3.4b Plot of c(u)

- 12 -

12. Press the Solve button This is the output you should see in the lower left hand side of the PDE GUI.

Figure 3.5 The initial boundary condition at x =0 13. Press the Video button to view the dynamic solution

- 13 -