Install crude handling of data point outside vertical span

The initial implementation of RK4IVP<>::operator() failed to take
into account the possibility that we might need to evaluate the
function outside the vertical span for which it was initially
defined.  This situation occurs, for instance, in the not uncommon
cases of the GOC being above or the WOC being below the model.

This commit installs a crude Hermitian extrapolation procedure to
handle these cases.  Refinements are likely.
This commit is contained in:
Bård Skaflestad 2014-01-21 17:49:02 +01:00
parent 76844c9c59
commit f71ba5a9f7

View File

@ -73,9 +73,13 @@ namespace Opm
// Dense output (O(h**3)) according to Shampine // Dense output (O(h**3)) according to Shampine
// (Hermite interpolation) // (Hermite interpolation)
const double h = stepsize(); const double h = stepsize();
const int i = (x - span_[0]) / h; int i = (x - span_[0]) / h;
const double t = (x - (span_[0] + i*h)) / h; const double t = (x - (span_[0] + i*h)) / h;
// Crude handling of evaluation point outside "span_";
if (i < 0) { i = 0; }
if (N_ <= i) { i = N_ - 1; }
const double y0 = y_[i], y1 = y_[i + 1]; const double y0 = y_[i], y1 = y_[i + 1];
const double f0 = f_[i], f1 = f_[i + 1]; const double f0 = f_[i], f1 = f_[i + 1];