PDE with RecurrenceTable
- To: mathgroup at smc.vnet.net
- Subject: [mg124740] PDE with RecurrenceTable
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Fri, 3 Feb 2012 02:11:36 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Dear Community,
I am trying to make a simple numeric FEM solution of parabolic PDE. It seems that RecurrenceTable function is designed exactly for such a job. Indeed, in the Help/RecurrenceTable/Scope/Partial Difference Equations one finds an example. My problem is that this example is only one, and I would say, it is not basic enough.
My question: do you know some other examples of the use of the RecurrenceTable for this sort of equations??
I would like to explain: I already went through the MathGroup archive and have seen numerous posts recommending various sophisticated FEM packages. My question is not about them. I want to learn to make simple programs of this sort myself to fast test an equation at hand.
For example, here is a classical equation of temperature conductivity:
(\[PartialD]u(x,t))/\[PartialD]t=a^2*(\[PartialD]^2u(x,t))/\[PartialD]x^2
with a=0.1, the boundary conditions: u[0,t]==1 and u[1,t]==0 and the initial condition u[x,0]== Cos[3 \[Pi]*x/2];
using the explicit method on the rectangular lattice, taken from a textbook:
u[j,k+1]=\[Sigma]*u[j+1,k]+(1-2*\[Sigma])*u[j,k]+\[Sigma]*u[j-1,k];
\[Sigma]=(a^2*\[Tau])/h^2;
Tau and h are temporal and spatial step sizes.
This is the code:
a = 0.1;
h = 0.1;
\[Tau] = 0.0001;
\[Sigma] = a^2*\[Tau]/h^2;
lst2 = RecurrenceTable[{u[j,
k + 1] == \[Sigma]*u[j + 1, k] + (1 - 2*\[Sigma])*
u[j, k] + \[Sigma]*u[j - 1, k], u[j, 0] == Cos[3 Pi*j/20.],
u[0, k] == 1, u[10, k] == 0}, u, {j, 0, 10}, {k, 0, 100}];
Show[{
ListPlot3D[lst2,
AxesLabel -> {Style["t", 16, Italic], Style["x", 16, Italic],
Style["u", 16, Italic]}, PlotStyle -> Blue],
Plot3D[0, {t, 0, 100}, {x, 0, 10},
PlotStyle -> {Yellow, Opacity[0.4]}]
}]
The solution obtained this way, however, does not show evolution. It is clear that with increasing t the temperature, u, should forget its initial form and approach to a straight line. What is wrong?
Thank you, Alexei
Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG
Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44
e-mail: alexei.boulbitch at iee.lu<mailto:alexei.boulbitch at iee.lu>