- #1
Rapier
- 87
- 0
Homework Statement
So I'm back to my wonderful computational physics course after a brief hiatus and once again, I am teaching myself the material. This unit we are working on some thermodynamics. We've just used the "Leap Frog" method to determine heat transfer of a 100k bar with both ends put in touch with a 0k sink. No problems there. The next part of the assignment is to use the Crank-Nicolson method to solve the same problem (1m bar, 100K, each end placed against a 0K sink). Our instructor and course material seem to believe that we should all be intimately familiar with Crank and Nicolson, but until now I would have thought them a body shop or law office.
Apparently the method requires some use of a guassian elimination and matrices. So I'm gone ahead and coded a program that solves a gaussian elminiation. So now my only problem is determining what the base equations are that will populate this matrix. I've been doing quite a bit of digging but I'm just not getting it. None of my textbooks I have hear speak of Crank-Nicolson. Could any link me or work through not even this problem but any problem with setting up Crank-Nicolson? What are the basic equations I'm supposed to be using?
Homework Equations
From the class slides I have:
T(i, j+1) - T(i,j) = η/2 [T(i-1,j+1) - 2T(i,j+1) + T(i+1,j+1) + T(i-1,j) - 2T(i,j) + T(i+1,j)
-T(i-1,j+1) + (2/η + 2)*T(i,j+1) - T(i+1,j+1) = T(i-1,j)+(2/η - 2)*T(i,j) + t(i+1,j)
The Attempt at a Solution
Obviously T is the temperature and T(i,j) refers to the temperature at position i (assuming that the left side of the bar is at 0 and the right side is at 1m) and j is the time elapsed since the start (this was how we defined the problem in the first portion so I can't imagine that has changed). Personally I've been using T(x,t) because that seems to make a whole heck of a lot more sense to me than i and j.
I'm kind of lost. If I could just see how any Crank-Nicolson problem was solved I think I could do it. But I'm trying to create code based off a half-assed stab at instruction and no fore-knowledge of the method in question. Please help!