MATLAB A convergence problem when i change a parameter in an algorithm wrote in MatLab

loukoumas

Hello!!

I use the Crank-Nicolson numerical method to calculate temperatures on a metalic plate(aluminium) 10cmx30cm.

I assume that the left vertical side is always in 0 degrees Celsious and the right vertical side in 100 degrees.Both horizontal sides are insulated. So we have a heat diffusion problem. Crank-Nicolson numerical method, says in few words, we divide the plate in intervals using points, each point 's temperature is calculated by using the temperatures of its adjacent points in x,y directions.

T(i,j) = 1/2*a*dt*[E(i-1,j)-2E(i,j)+E(i+1,j)+T(i-1,j)-2T(i,j)+T(i+1,j)]/dx^2 +

+ 1/2*a*dt*[E(i,j-1)-2E(i,j)+E(i,j+1)+T(i,j-1)-2T(i,j)+T(i,j+1)]/dy^2 +

+E(i,j)

E is the temperature for the previous time point(we have also divided time in dt intervals)
For t=0 E is known(20 degrees)

For the uknown values of T we use an arbitary value(lets say 1) and by repeating the calculation for all the points' temperatures T values must converge on the right ones.

I wrote a very simple algorithm that calculates T(i,j) for the first second(dt=1) when the plate is divided by 2cm intervals (dx=dy=2cm this means i have 6 points on y and 16 on x direction)
All i care about is the convergence procedure. It works fine!!

The problem is it doesn't work if i just use dx=dy=1cm which means a 11X31 matrix

I send you both of the algorithms, they are simple enough i hope

I really look forward to your reply!! Thanks for your time!

Attachments

• 710 bytes Views: 182
• 1.3 KB Views: 198
Related Math Software Workshop News on Phys.org

"A convergence problem when i change a parameter in an algorithm wrote in MatLab"

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving