# Introduction to PDEs

- toc:false
- branch: master
- badges: true
- comments: false
- categories: [mathematics, numerical recipes]
- hide: true

-----
Questions:
- Which physical systems can be described using a PDE?
- What is the Laplacian operator?
-  When to I need boundary conditions and initial conditions?

Objectives:
- Recognise common classes of PDE: the diffusion equation, Poisson's equation and the wave equation
- Express the Laplacian as a differential operator
- Identify boundary value problems and initial value problems

-----

### Partial differential equations have multiple inputs

In the previous section of the course we studied <bold>ordinary differential equations</bold>. ODEs have a single input (also known as independent variable) - for example, time. 

Partial differential equations (PDEs) have multiple inputs (independent variables). For example, think about a sheet of metal that has been heated unevenly across the surface. Over time, heat will diffuse through the 2-dimensional sheet. The temperature depends on both time *and* position - there are two inputs.

> youtube: https://youtu.be/twBcpxrWm5E

Because PDEs have multiple inputs they are generally much more difficult to solve analytically than ODEs. However, there are a range of numerical methods that can be used to find approximate solutions.

### PDEs have application across a wide variety of topics

The same type of PDE often appears in different contexts. For example, the <mark>diffusion equation</mark> takes the form:

\begin{equation}
\nabla^2T = \alpha \frac{\partial T}{\partial t}
\end{equation}

When used to describe heat diffusion, this PDE is known as the heat equation. This same PDE however can be used to model other seemingly unrelated processes such as brownian motion, or used in financial modelling via the Black-Sholes equation. 

Another type of PDE is known as <mark>Poisson's equation</mark>:

\begin{equation}
\nabla^2\phi = f(x,y,z)
\end{equation}

Poisson's equation can be used to describe electrostatic forces, where $\phi$ is the electric potential. It can also be applied to mechanics (where $\phi$ is the gravitational potential) or thermodynamics (where $\phi$ is the temperature). When $f(x,y,z)=0$ this equation is known as Laplace's equation. 

The third common type of PDE is the <mark>wave equation</mark>:

\begin{equation}
\nabla^2r = \alpha \frac{\partial^2 r}{\partial t^2}
\end{equation}

This describes mechanical processes such as the vibration of a string or the motion of a pendulum. It can also be used in electrodynamics to describe the exchange of energy between the electric and magnetic fields. 

In this course we will look at techniques for solving the diffusion equation and Poisson's equation, but many of the topics we will discuss - such as boundary conditions, and finite difference methods - can be transferred to PDEs more generally. 

### The Laplacian operator corresponds to an average rate of change

*But what is the operator $\nabla^2$?*. This is the <mark>Laplacian operator</mark>. When applied to $\phi$ and written in full for a three dimensional cartesian coordinate system with dependent variables $x$, $y$ and $z$ it takes the following form:

\begin{equation}
\nabla^2\phi = \frac{\partial^2\phi}{\partial x^2} + \frac{\partial^2\phi}{\partial y^2} + \frac{\partial^2\phi}{\partial z^2}.
\end{equation}

We can think of the laplacian as encoding an average rate of change. To develop an intuition for how the laplacian can be interpreted physically, we need to understand two related operators - div and curl. We will not explore these operators further in this lesson, but a related video is below:

> youtube: https://youtu.be/EW08rD-GFh0

### PDEs can have boundary conditions *and* initial conditions
In the previous section of the course we learnt that ODEs have either initial values or boundary values. 

#### Boundary value problems

PDEs can also be separated in a similar manner. <mark>Boundary value problems</mark> describe the behaviour of a variable in a space and we are given some constraints on the variable around the boundary of that space. For example, consider the 2-dimensional problem of a thin rectangular sheet with one side at voltage $V$ and all others at voltage zero.


 

The specification that one side is at voltage $V$ and all others are at voltage zero are the <mark>boundary conditions</mark>. We could then calculate the electrostatic potential $\phi$ at all points within the sheet using the two-dimensional Laplace's equation:

\begin{equation}
\nabla^2\phi = \frac{\partial^2\phi}{\partial x^2} + \frac{\partial^2\phi}{\partial y^2} = 0
\end{equation}

#### Initial value problems

<mark>Initial value problems</mark> are where the field - or other variable of interest - is varying in both space and time. We now require boundary conditions *and* initial values. This is a more difficult type of PDE to solve.

For example, consider heat diffusion in a two-dimensional sheet. Here we could specify that there is no heat flow in or out of the sheet - this is the boundary condition. 


 

We could also specify that at time $t=0$ the centre of the sheet is at temperature $T_1$, whilst surrounding areas are at temperature  $T_0$. This is the initial condition. It differs from a boundary condition in that we are told what the temperature is at the start of our time grid (at $t=0$) but not at the end of our time grid (when the simulation finishes).


 

We could then calculate the temperature at time $t$ at all points $[x,y]$ within the sheet using the two-dimensional Diffusion equation:

\begin{equation}
\nabla^2T = \frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2}=\alpha \frac{\partial T}{\partial t}
\end{equation}

---

Keypoints:

- PDEs have multiple inputs (independent variables)
- PDEs have application across a wide variety of topics
- The Laplacian operator corresponds to an average rate of change
- PDEs can have boundary values and initial values


---

Do [the quick-test](https://nu-cem.github.io/CompPhys/2021/08/02/PDE-Intro-Qs.html).

Back to [Modelling with Partial Differential Equations](https://nu-cem.github.io/CompPhys/2021/08/02/PDEs.html).

---

c7020dc6bfba2ac52a920a39204c1d51aeaf056e
ipynb
Jupyter Notebook
_notebooks/2021-08-02-PDE-Intro.ipynb
NU-CEM/CompPhys
7a7e8ab672797d6db0dbbd673fdc66c6e7bad971
CC-BY-4.0
_notebooks/2021-08-02-PDE-Intro.ipynb
NU-CEM/CompPhys
7a7e8ab672797d6db0dbbd673fdc66c6e7bad971
CC-BY-4.0
2021-10-06T08:11:43.000Z
2021-11-24T13:46:08.000Z
_notebooks/2021-08-02-PDE-Intro.ipynb
NU-CEM/CompPhys
7a7e8ab672797d6db0dbbd673fdc66c6e7bad971
CC-BY-4.0
2021-11-03T10:11:28.000Z
2021-11-03T10:11:28.000Z
Qwen/Qwen-72B
1. YES
2. YES