ADI method for 2-D heat equation with mixed boundary conditions

  • Topic: MATLAB 
  • Thread starter Thread starter womfalcs3
  • Start date Start date
  • Tags Tags
    Code Matlab Method
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
4 replies · 23K views
womfalcs3
Messages
60
Reaction score
5
Hi,

I've been having some difficulty with Matlab. I keep getting confused with the indexing and the loops.

To set up the code, I am trying to implement the ADI method for a 2-D heat equation (u_t=u_xx+u_yy+f(x,y,t)). I have Dirichlet boundary conditions on the left, upper, and lower boundaries, and a mixed boundary condition on the right boundary.

The coefficient matrix and source vector look okay after the x-direction loop. I have spent well over a 10 hours trying to get it to work.

Can somebody check the code please?

Here's the code:

http://docs.google.com/Doc?docid=0AS848wqcdh80ZHE0Njk2a18xMjZnN3I2cG1kaw&hl=en

f, robinbc, and uexact are obtained from separate script files.

Thank you.
 
Physics news on Phys.org
I finally figured it out... I believe, at least. I'll go ahead and post the code for reference for future visitors who may run into the same issues.

http://www.filefront.com/14925931/ADI-Matlab-Mixed-BC.pdf/

It seems to converge to second-order accuracy with larger and larger mesh size. Other than the fact the solution is good compared to an exact solution, it seems to follow the behavior of the ADI scheme in that regard.
 
Hello,

I was wondering if you could repost your code as I having trouble viewing it. I am working on a similar problem, and am stuck on the indexing.

Thanks a lot.
 
I would also appreciate if you upload the file again.The link does not work, it says that the file is unavailable.