I'm having a problem with getting parabolic to return the correct solutions.
I'm working with the equation: u_t = u_xx + u_yy +nu for any 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))
*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!