Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Problem with NDSolve and 2-dim Diffusion Equation' topicStudent Support Forum > General > "Problem with NDSolve and 2-dim Diffusion Equation"

Help | Reply To Topic
Author Comment/Response
Frederik
05/10/12 03:39am

Hello,

I want to set up a PDE model, which takes a two dimensional diffusion equation into account. The key problem is, that I have some trouble to solve the two dimensional diffusion equation numerically. Consider the following code:

L = 10;
T = 10;
system = {
D[c[x, y, t], {t, 1}] == D[c[x, y, t], {x, 2}] + D[c[x, y, t], {y, 2}],
Derivative[1, 0, 0][c][0, y, t] == 0,
Derivative[1, 0, 0][c][L, y, t] == 0,
c[x, 0, t] == c[x, L, t],
c[x, y, 0] == 1
};
sol = NDSolve[system, c, {x, 0, L}, {y, 0, L}, {t, 0, T}];
Manipulate[Plot3D[Evaluate[c[x, y, t] /. sol], {x, 0, L}, {y, 0, L}], {t, 0, T}]

As you can see when playing around with the slider for the variable t, after a short amount of time the solution is not displayed (probably because it goes to infinity) and for t=10 there are artifacts at two edges.

Obviously, c[x,y,t]=1 solves the system and since this is the initial condition and Mathematica sould have no trouble to compute it numerically. It tried various ODE solvers (ImplicitRungeKutta,BDF,Adams), but it seems that there is some problem with the spatial discretization, perhaps because of the Neumann boundary condition for the variable x.

Any suggestions how to fix it?

Frederik

URL: ,
Help | Reply To Topic