# Numerical method on heat diffusion problem

#### loukoumas

Hello there!

I am solving a heat diffusion problem wich is described by the differential equation: θΤ/θt=a*(θ^2Τ/ΘΤ^2). I will apply two diffrent temperatures on the ends of a metal rod. Solving the equation i conclude, according to the boundary conditions of course, at the function:
Τ(x,t)=sum i=1-infinity [e^-i^2 * Pi^2 *a*t*(160*(-1)^i /(i*Pi) + 40/(i*Pi))*sin(i*Pi*x)] +100 x.( I gues its not very readable!sorry)

i also use a numerical method, crank-nicolson. It uses the previous(T') accordinng to time temperatures and previous(Ti-1) and next(Ti+1) temperatures according to length
Ti=A*T'(i) + B[T(i-1) +T(i+1)+T'(i-1)+T'(i+1)] A,B are known and also temperatures on the ends are known( 0,100 degrees respectively) so if i cut the rod on n+1 i get nXn system to solve! So far so good. Where is my question?
Comparing the temperatures that i get from both methods are satisfactorily close,but only after 60-70 seconds. On the first tens of seconds, on the points next to the ends of the rod(10cm and 90 cm if the hole rod is 1m), i have 3-5 degrees difference between these two methods.Wich results are the most relyable? why do i find these differences?
thank you very much!

#### AlephZero

Homework Helper
On the first tens of seconds, on the points next to the ends of the rod(10cm and 90 cm if the hole rod is 1m), i have 3-5 degrees difference between these two methods.
So you are only using 10 (or 9 or 11) points along length of the rod?

Try using more points (for example twice as many) and see what happens to the results. If temperature against time at each mesh point is oscillating up and down at each time step, you need to reduce the time step as well.

In the first part of the solution, you probably have a rapid change of temperature along the length of the rod near to the ends, and you don't have enough points in the finite difference mesh to represent that accurately.

Assuming you did the math right, your series solution should be exact, so long as you include enough terms to ensure it has converged to the accuracy you want.

### 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