home

PDF (letter size

Collection of PDE animations


January 29, 2024   Compiled on January 29, 2024 at 3:34am

Contents

1 Heat PDE
2 Wave PDE
3 Laplace and Poisson PDE
4 Burger’s PDE
4.1 Example 1
5 Misc. PDE’s
5.1 FitzHugh-Nagumo in 2D
5.1.1 Example 1
5.1.2 Example 2
6 Appendix
6.1 Summary table
6.2 Using Mathematica to obtain the eigenvalues and eigenfunctions for heat PDE in 1D
6.2.1 u(0)=0,u(L)=0
6.2.2 u(0)=0,u(L)=0
6.2.3 u(0)=0,u(L)=0
6.2.4 u(0)=0,u(L)=0
6.2.5 u(0)=0,u(L)+u(L)=0
6.2.6 u(0)+u(0)=0,u(L)=0
6.2.7 u(L)=0,u(L)=0

These are collection of PDE problems solved analytically and animated. Most of the animations where done in Mathematica, some in Maple and Matlab.

Chapter 1
Heat PDE

Animations moved to This page

Chapter 2
Wave PDE

Animations moved to This page

Chapter 3
Laplace and Poisson PDE

Animations moved to This page

Chapter 4
Burger’s PDE

Solve (1)ut+u ux=Duxx

BCu(0,t)=0t>0u(L,t)=0t>0

Initial conditionsu(x,0)=f(x)0<x<L

Where D is the diffusion constant.

Solution

Using Cole-Hopf, let (2)u(x,t)=2Dϕxϕ where ϕϕ(x,t). Rewriting equation (1) as

ut=Duxxu ux(3)=(Duxu22)x

Substituting (2) into (3) gives

(2Dϕxϕ)t=[D(2Dϕxϕ)x12(2Dϕxϕ)2]x2D(ϕxϕ)t=(2D2(ϕxϕ)x2D2(ϕxϕ)2)x(4)2D(ϕxϕ)t=2D2((ϕxϕ)x+(ϕxϕ)2)x

But (ϕxϕ)t=1ϕ2ϕtϕx+1ϕϕxt

And

(ϕtϕ)x=1ϕ2ϕxϕt+1ϕϕtx

Therefore (ϕxϕ)t=(ϕtϕ)x. Using this in LHS of (4) gives

(5)2D(ϕtϕ)x=2D2((ϕxϕ)x+(ϕxϕ)2)x

And (ϕxϕ)x+(ϕxϕ)2=1ϕ2ϕx2+ϕxxϕ+ϕx2ϕ2=ϕxxϕ

Using the above in the RHS of (5) gives

(6)2D(ϕtϕ)x=2D2(ϕxxϕ)x

Integrating both side w.r.t. x gives

2Dϕtϕ=2D2ϕxxϕ+G(t)

Where G(t) is the constant of integration since ϕϕ(x,t). The above simplifies to the heat PDE in ϕ(x,t)

(6A)ϕt=Dϕxx+G(t)ϕ

Let (6B)ψ=ϕeG(t)dt

Then ψt=ϕteG(t)dtϕG(t)eG(t)dt=(ϕtϕG(t))eG(t)dt

But from (6A), we see that ϕtϕG(t)=Dϕxx. Therefore the above becomes

ψt=DϕxxeG(t)dt

But from (6B), we see that ϕxxeG(t)dt=ψxx, therefore the above becomes

ψt=Dψxx

Which is the heat PDE. The original BC and initial conditions are now transformed to ψ to solve the above. Since u=2Dϕxϕ, then solving this first for ϕ

ϕxϕ=12Duϕx1ϕ=12Dudϕϕ=12Dudx

Integrating gives

lnϕ=12D0xu ds+C0ϕ(x,t)=Ce12D0xu ds

Since u=2Dϕxϕ, then the constant C cancels out. Then we it can be set to any value as it does not affect the solution. Let C=1 and the above becomes

(7)ϕ(x,t)=e12D0xu ds

(7) is now used to transform the initial conditions. When u(x,0)=f(x) the above becomes

ϕ(x,0)=e12D0xu(s,0) ds=e12D0xf(s) ds

Since from (6B), ψ(x,t)=ϕeG(t)dt=ϕe0tG(s)ds therefore

ψ(x,0)=ϕ(x,0)e0=ϕ(x,0)=e12D0xf(s) ds

To transform the boundary conditions, u=2Dϕxϕ is used. When u(0,t)=0 then 0=2Dϕx(0,t)ϕ(0,t) or

ϕx(0,t)=0

But ψ=ϕe0tG(s)ds, then ψx=ϕxe0tG(s)ds and therefore

ψx(0,t)=ϕx(0,t)e0tG(s)ds=0

Similarly, when u(L,t)=0 then 0=2Dϕx(L,t)ϕ(L,t) or

ϕx(L,t)=0

Which gives

ψx(L,t)=0

Hence the heat PDE to solve is

ψt=Dψxx

BCψx(0,t)=0t>0ψx(L,t)=0t>0

Initial conditionsψ(x,0)=e12D0xf(s) ds0<x<L

The above heat PDE is now solved for ψ(x,t). This solution is transformed back to u(x,t). First using ψ=ϕeG(t)dt to find ϕ(x,t), then using u(x,t)=2Dϕxϕ, to find u(x,t).

So in summary, there are two transformations needed. Going from u(x,t)ϕ(x,t) uses Cole-Hopf. Going from ϕ(x,t)ψ(x,t) uses ψ(x,t)=ϕ(x,t)eG(t)dt. It is ψ(x,t) which is solved as the heat PDE ψt=Dψxx and not ϕ(x,t), which is just an intermediate transformation.

4.1 Example 1

Let L=2π,0<x<2π,D=110,u(x,0)=f(x)=sinx And boundary conditions u(0,t)=u(2π,0)=0. From above, after carrying the forward transformation, the PDE to solve is found to be

ψt=Dψxx

With transformed boundary conditions

ψx(0,t)=0t>0ψx(2π,t)=0t>0

And transformed initial conditions

ψ(x,0)=e12Dsin(x) dx=e12Dcos(x)

This heat PDE is standard and has known solution by separation of variables which is

ψ(x,t)=c0+n=1cneDλntcos(λnx)λn=(nπL)2n=1,2,3,

Or, since L=2π,

ψ(x,t)=c0+n=1cneDn24tcos(n2x)λn=n24n=1,2,3,

Where c0=1L0Lψ(x,0)dx=12π02πecos(x)2Ddx=BesselI(0,12D)

And

cn=2L0Lψ(x,0)cos(λnx)dx=1π02πecos(x)2Dcos(n2x)dx

The after integral has no closed form solution. Hence the solution is

ψ(x,t)=BesselI(0,12D)+1πn=1(02πecos(x)2Dcos(n2x)dx)eDn24tcos(n2x)

But ψ=ϕeG(t)dt, therefore

ϕ(x,t)=ψ(x,t)eG(t)dt

But I do not know what G(t) is. This was used during the forward transformation only and was eliminated. So how to find ϕ(x,t)? Need to find ϕ(x,t) to be able to find u(x,t) from u(x,t)=2Dϕxϕ.

Chapter 5
Misc. PDE’s

5.1 FitzHugh-Nagumo in 2D

5.1.1 Example 1
5.1.2 Example 2

This was solved numerically in Matlab.

5.1.1 Example 1

The equations to solve are the following on the unit square in 2D.v(x,y,t)t=D2v+(av)(v1)vw+Iw(x,y,t)t=ϵ(vγw)

Using a=0.1,γ=2,ϵ=0.005,D=5×105,I=0, hence the PDE’s arev(x,y,t)t=(5×105)2v+(0.1v)(v1)vww(x,y,t)t=0.005(v2w)

Initial conditions, t=0v(x,y,0)=exp(100(x2+y2))w(x,y,0)=0

Boundary conditions are homogeneous Neumann for v. (I solved this numerically, fractional step method. ADI for the diffusion solve).

Loading ..., image

5.1.2 Example 2

The equations to solve are the following on the unit square in 2D.v(x,y,t)t=D2v+(av)(v1)vw+Iw(x,y,t)t=ϵ(vγw)

Using a=0.1,γ=2,ϵ=0.005,D=5×105,I=0, hence the PDE’s arev(x,y,t)t=(5×105)2v+(0.1v)(v1)vww(x,y,t)t=0.005(v2w)

Initial conditions, t=0v(x,y,0)=12xw(x,y,0)=0.05y

Boundary conditions are homogeneous Neumann for v. (I solved this numerically, fractional step method. ADI for the diffusion solve). See my Matlab web page for source code.

Loading ..., image

Chapter 6
Appendix

6.1 Summary table

Heat PDE ut=k2ux2 in 1D (in a rod)

Left side Right side u(x,0) λ=0 λ>0
u(0)=0 u(L)=0 triangle No λn=(nπL)2,n=1,2,3,Xn=Bnsin(λnx)u(x,t)=n=1Bnsin(λnx)ekλnt
u(0)=0 u(L)=0 100 No λn=(nπL)2,n=1,2,3,Xn=Bnsin(λnx)u(x,t)=n=1Bnsin(λnx)ekλnt
u(0)=T0 u(L)=0 x No λn=(nπL)2,n=1,2,3,Xn=Bnsin(λnx)u(x,t)=T0T0Lx+n=1Bnsin(λnx)ekλnt
u(0)x=0 u(L)x=0 x λ0=0X0=A0 λn=(nπL)2,n=1,2,3,Xn=Ancos(λnx)u(x,t)=A0+n=1Ancos(λnx)ekλnt
u(0)x=0 u(L)=T0 0 No λn=(nπ2L)2,n=1,3,5,Xn=Ancos(λnx)u(x,t)=T0+n=1,3,5,Ancos(λnx)ekλnt
u(0)x=0 u(L)=0 f(x) No λn=(nπ2L)2,n=1,3,5,Xn=Ancos(λnx)u(x,t)=n=1,3,5Ancos(λnx)ekλnt
u(0)=0 u(L)x=0 f(x) No λn=(nπ2L)2,n=1,3,5,Xn=Bnsin(λnx)u(x,t)=n=1,3,5Bnsin(λnx)ekλnt
u(0)=0 u(L)+u(L)x=0 f(x) No tan(λnL)+λn=0Xn=Bnsin(λnx)u(x,t)=n=1Bnsin(λnx)ekλnt
u(0)+u(0)x=0 u(0)=0 0 λ0=0X0=A0 tan(λnL)λn=0
u(1)=0 u(1)=0 f(x) No λn=nπ2n=1,2,3,Xn=Ancos(λnx),sin(λnx)u(x,t)=n=1,3,Ancos(λnx)eλnt+n=2,4,Bnsin(λnx)eλnt

Heat PDE ut=α2ux2βu in 1D (in a rod) with α,β>0 for 0<x<π

Left side Right side initial condition λ=0 λ>0 analytical solution u(x,t)
u(0,t)x=0 u(π,t)x=0 u(x,0)=x λ0=0X0=A0 λn=n2,n=1,2,3,X(x)=A0+n=1Ancos(nx) π2+c0(eβt1)+2πn=1((1)n1)n2cos(nx)e(n2α+β)t

(TO DO) Heat PDE for periodic conditions u(L)=u(L) and u(L)x=u(L)x

λn=(nπL)2,n=1,2,3,u(x,t)=a0+n=1Ancos(λnx)ekλnt+n=1Bnsin(λnx)ekλnt

6.2 Using Mathematica to obtain the eigenvalues and eigenfunctions for heat PDE in 1D

6.2.1 u(0)=0,u(L)=0
6.2.2 u(0)=0,u(L)=0
6.2.3 u(0)=0,u(L)=0
6.2.4 u(0)=0,u(L)=0
6.2.5 u(0)=0,u(L)+u(L)=0
6.2.6 u(0)+u(0)=0,u(L)=0
6.2.7 u(L)=0,u(L)=0

6.2.1 u(0)=0,u(L)=0

For eigenvalue

ClearAll[y,x,L]; 
op={-y''[x]  ,DirichletCondition[y[x]==0,x==0], 
DirichletCondition[y[x]==0,x==L]}; 
(*or simply*) 
op={-y''[x],DirichletCondition[y[x]==0,True]}; 
eig=DEigenvalues[op,y[x],{x,0,L},5]
 

{π2L2,4π2L2,9π2L2,16π2L2,25π2L2}

FindSequenceFunction[eig,n]
 

π2n2L2

For eigenfunctions

ClearAll[y,x,L]; 
op={-y''[x]  ,DirichletCondition[y[x]==0,x==0], 
DirichletCondition[y[x]==0,x==L]}; 
eigf=Last@DEigensystem[op,y[x],{x,0,L},5]
 

{sin(πxL),sin(2πxL),sin(3πxL),sin(4πxL),sin(5πxL)}

FullSimplify[FindSequenceFunction[eigf,n]];
 

sin(πnxL)

6.2.2 u(0)=0,u(L)=0

For eigenvalue

ClearAll[y,x,L]; 
op={-y''[x]+NeumannValue[0,True]}; 
eig=DEigenvalues[op,y[x],{x,0,L},5]
 

{0,π2L2,4π2L2,9π2L2,16π2L2}

FindSequenceFunction[eig,n]
 

π2(n1)2L2

ClearAll[y,x,L]; 
op={-y''[x]+NeumannValue[0,True]}; 
eigf=Last@DEigensystem[op,y[x],{x,0,L},5]
 

{1,cos(πxL),cos(2πxL),cos(3πxL),cos(4πxL)}

FullSimplify[FindSequenceFunction[eigf, n]];
 

cos(π(n1)xL)

6.2.3 u(0)=0,u(L)=0

For eigenvalue

ClearAll[y,x,L]; 
op={-y''[x]+NeumannValue[0,x==0],DirichletCondition[y[x]==0,x==L]}; 
eig=DEigenvalues[op,y[x],{x,0,L},6] 
\begin{MMAinline} 
 
\[ 
\left\{\frac{\pi^2}{4 L^2},\frac{9 \pi^2}{4 L^2},\frac{25 \pi^2}{4 L^2}% 
,\frac{49 \pi^2}{4 L^2},\frac{81 \pi^2}{4 L^2},\frac{121 \pi^2}{4 L^2}\right\} 
\] 
 
\begin{MMAinline} 
Simplify[FindSequenceFunction[eig,n]]
 

π2(12n)24L2

For eigenfunctions

eigf=Last@DEigensystem[op,y[x],{x,0,L},7]
 

{cos(πx2L),cos(3πx2L),cos(5πx2L),cos(7πx2L),cos(9πx2L)}

FullSimplify[FindSequenceFunction[eigf,n]];
 

cos(π(12n)x2L)

6.2.4 u(0)=0,u(L)=0

Eigenvalue are the same as above

ClearAll[y,x,L]; 
op={-y''[x]+NeumannValue[0,x==L],DirichletCondition[y[x]==0,x==0]}; 
eig=DEigenvalues[op,y[x],{x,0,L},6]
 

{π24L2,9π24L2,25π24L2,49π24L2,81π24L2,121π24L2}

FindSequenceFunction[eig,n]
 

π2(12n)24L2

For eigenfunctions

eigf=Last@DEigensystem[op,y[x],{x,0,L},6]
 

{sin(πx2L),sin(3πx2L),sin(5πx2L),sin(7πx2L),sin(9πx2L),sin(11πx2L)}

FullSimplify[FindSequenceFunction[eigf, n]];
 

sin(π(12n)x2L)

6.2.5 u(0)=0,u(L)+u(L)=0

For eigenvalue

(*can only find them numerially*) 
ClearAll[y,x]; 
op={-y''[x]+NeumannValue[y[x],x==1],DirichletCondition[y[x]==0,x==0]}; 
eig=DEigenvalues[op,y[x],{x,0,1},6]//N 
(* {4.11586,24.1393,63.6591,122.889,201.851,300.55}*) 
NSolve[Tan[Sqrt[lam]]+Sqrt[lam]==0&& 0<lam<130,lam] 
(*{{lam->4.11586},{lam->24.1393},{lam->63.6591},{lam->122.889}}*)
 

For eigenfunctions

ClearAll[y,x]; 
op={-y''[x]+NeumannValue[y[x],x==1],DirichletCondition[y[x]==0,x==0]}; 
eig=Last@DEigensystem[op,y[x],{x,0,1},6]//N
 

{sin(2.02876x),sin(4.91318x),sin(7.97867x),sin(11.0855x),sin(14.2074x),sin(17.3364x)}

6.2.6 u(0)+u(0)=0,u(L)=0

For eigenvalue

 
(*can only find them numerially. Notice the sign difference now. *) 
ClearAll[y,x]; 
op={-y''[x]+NeumannValue[-y[x],x==0],DirichletCondition[y[x]==0,x==1]}; 
eig=DEigenvalues[op,y[x],{x,0,1},6]//N 
(* {0.,20.1908,59.6814,118.914,197.924,296.774}*) 
NSolve[Tan[Sqrt[lam]]-Sqrt[lam]==0&& 0<=lam<130,lam] 
(*{{lam->0.},{lam->20.1907},{lam->59.6795},{lam->118.9},{lam->197.858}% 
,{lam->296.554}}*)
 

For eigenfunctions, mathematica only gives plots, so not shown.

6.2.7 u(L)=0,u(L)=0

For eigenvalue

ClearAll[y,x,L]; 
op={-y''[x],DirichletCondition[y[x]==0,x==-L],DirichletCondition[y[x]==0,x==L]}% 
; 
eig=DEigenvalues[op,y[x],{x,-L,L},6]
 

{π24L2,π2L2,9π24L2,4π2L2,25π24L2,9π2L2}

Simplify[FindSequenceFunction[eig,n]]
 

π2n24L2

For eigenfunctions

eigf= Last@DEigensystem[op,y[x],{x,-L,L},6]
 

{sin(π(L+x)2L),sin(π(L+x)L),sin(3π(L+x)2L),sin(2π(L+x)L),sin(5π(L+x)2L)}

FullSimplify[FindSequenceFunction[eigf,n]]; 
Assuming[Element[n,Integers]&&Element[L,Reals],FullSimplify[
 

12i((ieiπx2L)n(ieiπx2L)n)