mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-24 00:10:02 -06:00
not extrapolating towards negative in VFP tables
This commit is contained in:
parent
8f2997fde6
commit
a772d1ef03
@ -199,15 +199,19 @@ struct InterpData {
|
||||
|
||||
/**
|
||||
* Helper function to find indices etc. for linear interpolation and extrapolation
|
||||
* @param value Value to find in values
|
||||
* @param value_in Value to find in values
|
||||
* @param values Sorted list of values to search for value in.
|
||||
* @return Data required to find the interpolated value
|
||||
*/
|
||||
inline InterpData findInterpData(const double& value, const std::vector<double>& values) {
|
||||
inline InterpData findInterpData(const double& value_in, const std::vector<double>& values) {
|
||||
InterpData retval;
|
||||
|
||||
const int nvalues = values.size();
|
||||
|
||||
// chopping the value to be zero, which means we do not
|
||||
// extrapolate the table towards nagative ranges
|
||||
const double value = value_in < 0.? 0. : value_in;
|
||||
|
||||
//If we only have one value in our vector, return that
|
||||
if (values.size() == 1) {
|
||||
retval.ind_[0] = 0;
|
||||
|
@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(findInterpData)
|
||||
|
||||
BOOST_CHECK_EQUAL(eval2.ind_[0], 0);
|
||||
BOOST_CHECK_EQUAL(eval2.ind_[1], 1);
|
||||
BOOST_CHECK_EQUAL(eval2.factor_, -0.5);
|
||||
BOOST_CHECK_EQUAL(eval2.factor_, -0.25);
|
||||
|
||||
BOOST_CHECK_EQUAL(eval3.ind_[0], 4);
|
||||
BOOST_CHECK_EQUAL(eval3.ind_[1], 5);
|
||||
|
Loading…
Reference in New Issue
Block a user