CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

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

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 5, 2012, 14:36
Default 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
vagelis Karvounis is on a distinguished road
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!
vagelis Karvounis is offline   Reply With Quote

Old   June 5, 2012, 15:00
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
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.
FMDenaro is offline   Reply With Quote

Old   March 25, 2015, 02:30
Default
  #3
New Member
 
prudhvi
Join Date: Oct 2014
Posts: 1
Rep Power: 0
Prudhvi is on a distinguished road
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.
Prudhvi is offline   Reply With Quote

Old   March 25, 2015, 09:44
Default
  #4
Member
 
Join Date: Dec 2012
Posts: 92
Rep Power: 14
beer is on a distinguished road
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.
beer is offline   Reply With Quote

Reply

Tags
gauss-seidel, heat diffusion


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:02.