# solving a heat diffusion problem, using Crank-Nicolson AND gauss-Seidel method

 Register Blogs Members List Search Today's Posts Mark Forums Read

 June 5, 2012, 13:36 solving a heat diffusion problem, using Crank-Nicolson AND gauss-Seidel method #1 New Member   Vagelis Karvounis Join Date: May 2012 Posts: 1 Rep Power: 0 Hello everyone! First of all i 'm not sure if i am posting on the right forum! May someone advise me about that! Here is what i am dealing with. A heat diffusion problem on an aluminum plate. The plate is represented by a grid of points. Crank-Nicolson method gives me an equation to calculate each point's temperature by using the temperatures of the surrounding points. T(i,j)=A*((a*dt/2)*(T'(i-1,j)-2*T'(i,j)+T'(i+1,j)+T(i-1,j)+T(i+1,j))/dx^2 +(a*dt/2)*(T'(i,j-1)-2*T'(i,j)+T'(i,j+1)+T(i,j-1)+T(i,j+1))/dy^2+ T'(i,j)) where T' is the temperature of a point at the previous time point, dt is the time between two time points and a is a heat diffusion constant of aluminum. dx,dy is the spatial division for the grid in x and y axis respectively also A=1/(1+dt*a*(1/dx^2)+dt*a*(1/dy^2)) T'(i,j) must be given, as also some boundary conditions must be given too. But the equation uses T(i-1,j),T(i+1,j),T(i,j-1),T(i,j+1) which are unknown. At this point Gauss-Seidel method is useful. I can use an arbitrary value for these unknown T values and by iterating the calculations for each point, T(i,j) are converging to the right values! Of course after that, T values are placed on T' and the process is repeated to calculate temperatures for the next time point. I am writing a code on matlab for this problem. The code is very slow.Trying to deal with making it faster, i found, that the shorter is the time step(dt) the less are the iterations i need to succeed a convergence on Gauss-Seidel. For my code, i use a 101X301 points grid and if dt=0.01sec it takes about 15 iterations to succeed convergence, more than 50 iterations if dt=0.1sec and more than 500 if dt=1sec. Could someone guide me to find out how the convergence process is being affected by dt or anything else? Thank you very much!

 June 5, 2012, 14:00 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 1,651 Rep Power: 23 when you reduce the time step is absolutely normal and sound phjysical that the number of iterations decreases ... you simply have a physical state at the new time step that is closer to the old one.... Try using a SOR method, is faster than GS.

 March 25, 2015, 02:30 #3 New Member   prudhvi Join Date: Oct 2014 Posts: 1 Rep Power: 0 Hey vagelis, I am trying to solve 2D heat equation using Crank Nicolson implementing gauss siedel method. my grid size is 128*128. time step dt=0.1. code is very slow in matlab. I am not able to get results quickly. please let me know if i can do anything to increase my execution time.

 March 25, 2015, 09:44 #4 Member   Join Date: Dec 2012 Posts: 78 Rep Power: 4 You could try using a different linear solver. Matlab has an implementation of the bi-conjugated gradient method (bicgstab) included. http://de.mathworks.com/help/matlab/ref/bicgstab.html The link explaines how to use it. The conjugate gradient methods are heaps faster than the gauss-seidel, jacobi etc solvers.

 Tags gauss-seidel, heat diffusion

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

All times are GMT -4. The time now is 20:46.