Skip to main content
Tweeted twitter.com/#!/StackMma/status/206207053088296960
added 27 characters in body
Source Link

I want to set up a PDE model, which takes a two dimensional-dimensional diffusion equation into account. The key problem is, that I have some trouble to solvein solving the two dimensional-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,T}, 0, T}]

Mathematica graphics

As you can see for t=10t = 10 there are artifacts at the two edges where the Neumann conditions were applied.

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

Any suggestions how to fix it?

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,T}, 0, T}]

Mathematica graphics

As you can see for t=10 there are artifacts at the two edges where the Neumann conditions were applied.

Obviously, c[x,y,t]=1 solves the system and since this is the initial condition Mathematica should 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?

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 in solving 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,T}, 0, T}]

Mathematica graphics

As you can see for t = 10 there are artifacts at the two edges where the Neumann conditions were applied.

Obviously, c[x, y, t] = 1 solves the system and since this is the initial condition Mathematica should 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?

added 61 characters in body
Source Link
Sjoerd C. de Vries
  • 66.1k
  • 15
  • 189
  • 327

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,T}, 0, T}]

Mathematica graphics

As you can see for t=10 there are artifacts at the two edges where the Neumann conditions were applied.

Obviously, c[x,y,t]=1 solves the system and since this is the initial condition Mathematica souldshould 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?

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,T}, 0, T}]

As you can see for t=10 there are artifacts at the two edges where the Neumann conditions were applied.

Obviously, c[x,y,t]=1 solves the system and since this is the initial condition 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?

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,T}, 0, T}]

Mathematica graphics

As you can see for t=10 there are artifacts at the two edges where the Neumann conditions were applied.

Obviously, c[x,y,t]=1 solves the system and since this is the initial condition Mathematica should 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?

edited tags
Link
Source Link
Loading