Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.



Re: 2D finite difference code for non steady state Heat Equation
Posted:
Oct 10, 2013 12:36 PM


On 10/10/2013 7:32 AM, saheed wrote: > Hi guys, I am writing a matlab code for 2D non steady state heat equation for non uniform grids. >i am having a problem with adding the time domain index (k) to my equation: > for j=1:1:m > for i=2:1:n > T(j,i)=T(j,i)+ lambda*( T(j,i+1) 4*T(j,i) + T(j,i1)+T(j+1,i)+T(j1,i) ) > end > end > Anyone with some hints should help me out. still I would appreciate if >i can get a template code to solve the problem. Thanks >
I do not see an 'h_x' and 'h_y' there? How come this is for non uniform?
Any way. There is no time domain index.
The current matrix represents the current time.
When writing T(i,j)= T(i,j) + .....
you are basically updating in time the LHS from the older time step in the RHS.
If needed, depending on the algorithm, another copy of the matrix T is used. That is all. You do not need to keep a copy of T for each time step. THat is not how things are implemented. Else, you'll run out of RAM soon, and it makes no sense to keep a copy of T for each time step.
Nasser



