ODESolvers/RKF45: Error evaluation is now consistent with the other RK solvers

This commit is contained in:
Henry
2013-11-03 16:03:03 +00:00
parent 277d153bef
commit b1c955337f
2 changed files with 22 additions and 26 deletions

View File

@ -56,19 +56,17 @@ const scalar
RKF45::a64 = 1859.0/4104.0, RKF45::a64 = 1859.0/4104.0,
RKF45::a65 = -11.0/40.0, RKF45::a65 = -11.0/40.0,
RKF45::b41 = 25.0/216.0, RKF45::b1 = 16.0/135.0,
RKF45::b42 = 0.0, RKF45::b3 = 6656.0/12825.0,
RKF45::b43 = 1408.0/2565.0, RKF45::b4 = 28561.0/56430.0,
RKF45::b44 = 2197.0/4104.0, RKF45::b5 = -9.0/50.0,
RKF45::b45 = -1.0/5.0, RKF45::b6 = 2.0/55.0,
RKF45::b46 = 0.0,
RKF45::b51 = 16.0/135.0, RKF45::e1 = 25.0/216.0 - RKF45::b1,
RKF45::b52 = 0.0, RKF45::e3 = 1408.0/2565.0 - RKF45::b3,
RKF45::b53 = 6656.0/12825.0, RKF45::e4 = 2197.0/4104.0 - RKF45::b4,
RKF45::b54 = 28561.0/56430.0, RKF45::e5 = -1.0/5.0 - RKF45::b5,
RKF45::b55 = -9.0/50.0, RKF45::e6 = -RKF45::b6;
RKF45::b56 = 2.0/55.0;
} }
@ -143,7 +141,7 @@ Foam::scalar Foam::RKF45::solve
{ {
y[i] = y0[i] y[i] = y0[i]
+ dx + dx
*(b51*dydx0[i] + b53*k3_[i] + b54*k4_[i] + b55*k5_[i] + b56*k6_[i]); *(b1*dydx0[i] + b3*k3_[i] + b4*k4_[i] + b5*k5_[i] + b6*k6_[i]);
} }
// Calculate the error estimate from the difference between the // Calculate the error estimate from the difference between the
@ -152,9 +150,7 @@ Foam::scalar Foam::RKF45::solve
{ {
err_[i] = err_[i] =
dx dx
*(b41*dydx0[i] + b43*k3_[i] + b44*k4_[i] + b45*k5_[i]) *(e1*dydx0[i] + e3*k3_[i] + e4*k4_[i] + e5*k5_[i] + e6*k6_[i]);
- (y[i] - y0[i])
;
} }
return normalizeError(y0, y, err_); return normalizeError(y0, y, err_);

View File

@ -31,15 +31,15 @@ Description
\verbatim \verbatim
"Low-order classical Runge-Kutta formulas with step size control "Low-order classical Runge-Kutta formulas with step size control
and their application to some heat transfer problems." and their application to some heat transfer problems."
Fehlberg, E., Fehlberg, E.,
NASA Technical Report 315 1969 NASA Technical Report 315, 1969.
"Solving Ordinary Differential Equations I: Nonstiff Problems, "Solving Ordinary Differential Equations I: Nonstiff Problems,
second edition", second edition",
Hairer, E., Hairer, E.,
Nørsett, S., Nørsett, S.,
Wanner, G., Wanner, G.,
Springer-Verlag, Berlin. 1993, ISBN 3-540-56670-8. Springer-Verlag, Berlin. 1993, ISBN 3-540-56670-8.
\endverbatim \endverbatim
This method embedds the 4-th order integration step into the 5-th order step This method embedds the 4-th order integration step into the 5-th order step
@ -112,8 +112,8 @@ class RKF45
c2, c3, c4, c5, c6, c2, c3, c4, c5, c6,
a21, a31, a32, a41, a42, a43, a51, a52, a53, a54, a21, a31, a32, a41, a42, a43, a51, a52, a53, a54,
a61, a62, a63, a64, a65, a61, a62, a63, a64, a65,
b41, b42, b43, b44, b45, b46, b1, b3, b4, b5, b6,
b51, b52, b53, b54, b55, b56; e1, e3, e4, e5, e6;
// Temporary fields // Temporary fields