- #1
- 36
- 0
Trying to understand what is going on here, and how this technique removes the dependence of sample rate from the solution.
If you Taylor expand out the function in time, you get for time step h:
##r(t+h) = r(t) + h r'(t) + \frac{h^2}{2} r''(t) + \frac{h^3}{3!} r'''(t)...\\
r(t - h) = r(t) - h r'(t) + \frac{h^2}{2} r''(t) -\frac{h^3}{3!} r'''(t)... \\
r(t-2h) = r(t) - 2h r'(t) + \frac{4h^2}{2} r''(t) -\frac{8h^3}{3!} r'''(t)... ##
##3r(t) - 3r(t-h) + r(t-2h) = r(t) +h r'(t) + \frac{h^2}{2} r''(t) -\frac{5h^3}{6} r'''(t)... ##
So you can see this scheme is accurate to ##\mathcal{O}(h^3). ##
The benefit of this method is that it looks like an semi-implicit method, which should become stable regardless the sample rate. The accuracy will still be dependent on sample rate, but the stability is much improved compared to forward difference methods.
In the attachment, the equation marked (6.46) says
##\frac{dr_1}{dt} = f(\hat r _1, t_1).##
Do you know that function? If not, you can approximate the derivatives simply, but you lose some accuracy.
That seems to work, remember that you are using the approximation ##\hat r_1 ## to approximate the derivative, so plug that estimate (based on prior r data) into the formula for dr/dt.
Once you have that estimate for dr/dt, you apply the averaging and approximation in 6.48 and 6.49.
Assuming you know the previous time data ##r_{i-1},r_{i-2},r_{i-3}##:
1. Set dt timestep.
2. Set pressure rate.
3. Calculate approximation ##\hat r_i## based on previous r information.
4. Use formula with pressure and ##\hat r_i## or ## r_{i-1}## to get ##\frac{dr_i}{dt}## and ##\frac{dr_{i-1}}{dt}##
5. Use equation 6.48 to get average rate of change for the timestep.
6. Use equation 6.49 to approximate ##r_i##.
Based on the example, it looks like you would want to have the radius at the first 3 times. You can surely assume that r = 0 or r = r0 for times prior to start.
Yes, I can look at a script for you.