Why is the PDE Toolbox solving my parabolic equation incorrectly?
Afficher commentaires plus anciens
Hello all,
I'm having a problem with getting the PDE Toolbox function 'parabolic' to return the correct solutions.
I'm working with the equation:
u_t = u_xx + u_yy +nu for any real c value
on the domain [-1, 1] x [-1, 1]
From the analytic solution, I know that with an initial condition of sin(pi*x)*sin(pi*y), the solution should be
u=e^(n-2pi^2)*t)*sin(pi*x)*sin(pi*y)
so if n < 2pi^2, then u should go to 0 over time. (e is raised to a negative exponent)
If n=2pi^2, then u should go to sin(pi*x)*sin(pi*y) (e is raised to 0)
and if n > 2pi^2, then u should go to positive infinity over time. (e is raised to a positive exponent)
I tried to simulate these results using PDE Toolbox and the parabolic function, but the results are far from what they're supposed to be as indicated by the analytic solution. Most of the solutions go to negative infinity, regardless of the n value. Can anyone tell me where I'm going wrong in my code/logic and why I'm getting wacky results?
I use the gui to define the boundaries and the mesh from x = -1:1 and y= -1:1, then I export decomposed geometry as p, e, and t.
Then, here's the MATLAB code I'm using to solve and plot:
tlist=0:.1:1; %Set tspan
c=1;
a=-(n); % I input actual values for n before I run the code.
f=0;
d=1;
u0='sin(pi*x).*sin(pi*y)';
u1=parabolic(u0,tlist,'squareb1',p,e,t,c,a,f,d);
pdemesh(p,e,t,u1(:,end))
The code runs and plots a solution, it's just not the correct solution according to the analytic solution.
*I'm using the raw code instead of the pde toolbox gui to solve simply because I prefer the raw code. I get the same results if I use the pde toolbox gui.
Any suggestions or comments are greatly appreciated!
Réponse acceptée
Plus de réponses (1)
Bill Greene
le 18 Nov 2013
0 votes
Hi,
I have looked further into this issue of a divergent solution when n is positive but less than 2*pi^2.
Not surprisingly, this behavior can be reproduced with the simpler 1D case. I get essentially the same results if I run the 1D case with the MATLAB pdepe function or with non-MathWorks PDE solvers.
The behavior can also be reproduced with a very simple numerical algorithm based on the central difference operator in the 1D spatial direction and a backward-Euler operator in time. It is not too difficult to show that the backward-Euler operator is not unconditionally stable when the n-coefficient is positive.
Numerical methods may exist for reliably solving this equation for positive n less than 2*pi^2 but I haven't been able to find them.
Bill
1 commentaire
Catherine
le 18 Nov 2013
Catégories
En savoir plus sur Eigenvalue Problems dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!