iqjump123 said:
Hey alephzero,
Thanks so much for your help. It definitely helped in me understanding the approach. I have been consulting some numerical methods handbooks to get myself familiar with when mck are single variables. It seems that I will have to build a tri-diagonal matrix and make it solve for a vector of x values(it seems at the very minimum, I will need x1, x2, xj, xn-2 xn-1 values, with j being the iteration i am solving for, and n-1 being the last iteration. If I am going for more iterations, however, then the xj portion will be lengthened, right?)
You seem be getting confused about the the number of variables at different points in space, and the values of their displacement at diffferent times.
If you have a single variable problem like a mass on a spring, the equation of motion equation is mu'' + cu' + ku = f(t)
You convert that into an equation connecting the values of x at three different times, using difference approximations. Call the three times t-h, t, and t+h where h is the time step.
You can approximate u'(t) by [u(t+h) - u(t-h)] / 2h
and u''(t) by [u(t+h) - 2u(t) +u(t-h)] / h^2
So the finite difference version of the equation of motion is
m [u(t+h) - 2u(t) +u(t-h)] / h^2 + c [u(t+h) - u(t-h)] / 2h + k u(t) = f(t)
or
m [u(t+h) - 2u(t) +u(t-h)] + (ch/2) [u(t+h) - u(t-h)] + kh^2 u(t) = h^2 f(t)
As you work through the solution, you already know u(t) and u(t-h) so you can rearrange this to find u(t+h)
[m + ch/2] u(t+h) = (2m - kh^2) u(t) + (-m + ch/2) u(t-h) + h^2 f(t)
If you are starting from t = 0, the initial conditons give you the values of u(0) and u'(0).
To get the calculation started you need the values of u(0) and u(-h). One way to get u(-h) is use a Taylor series approximation and say
u(-h) = u(0) - h u'(0).
So the first time step of the CDM is to calculate u(h) from
[m + ch/2] u(h) = (2m - kh^2) u(0) + (-m + ch/2) u(-h) + h^2 f(0)
For the next time steps, you calculate
[m + ch/2] u(2h) = (2m - kh^2) u(h) + (-m + ch/2) u(0) + h^2 f(h)
[m + ch/2] u(3h) = (2m - kh^2) u(2h) + (-m + ch/2) u(h) + h^2 f(2h)
etc.
You don't need to make one big set of equations for all the time steps.
If you have more than 1 variable (3 in your case), at each step you have to solve a 3x3 set of equations. The equation
[m + ch/2] u(t+h) = (2m - kh^2) u(t) + (-m + ch/2) u(t-h) + h^2 f(t)
is a matrix equation like Au(t+h) = b, where A = m + ch/2. You have to do the matrix multiplcations on the right hand side to calculate the vector b, and then solve the simultaneous equations for u(t+h).
Note, in my first post I said you just needed to invert m. Sorry, I forgot you had the damping matrix c in your model so that wasn't quite right.