Split WELPI Application Into Two Parts

First part, implemented in a new member function

    Well::getWellPIScalingFactor

calculates a CTF scaling factor from stored WELPI information and a
dynamically calculated well-level PI value.  The second part, using
the original name applyWellProdIndexScaling, applies an externally
calculate CTF scaling factor to all eligble connections.

This is needed to enable applying multiple scalings across the time
direction.  Update unit tests accordingly.
This commit is contained in:
Bård Skaflestad
2020-10-19 19:16:12 +02:00
parent 452c222f71
commit dabf988aa7
4 changed files with 52 additions and 14 deletions
@@ -600,6 +600,7 @@ public:
bool operator==(const Well& data) const;
void setInsertIndex(std::size_t index);
void applyWellProdIndexScaling(const double currentEffectivePI);
double getWellPIScalingFactor(const double currentEffectivePI) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
@@ -826,7 +826,23 @@ void Well::setInsertIndex(std::size_t index) {
this->insert_index = index;
}
void Well::applyWellProdIndexScaling(const double currentEffectivePI) {
double Well::getWellPIScalingFactor(const double currentEffectivePI) const {
if (this->connections->empty())
// No connections for this well. Unexpected.
return 1.0;
if (!this->productivity_index)
// WELPI not activated. Nothing to do.
return 1.0;
if (this->productivity_index->pi_value == currentEffectivePI)
// No change in scaling.
return 1.0;
return this->productivity_index->pi_value / currentEffectivePI;
}
void Well::applyWellProdIndexScaling(const double scalingFactor) {
if (this->connections->empty())
// No connections for this well. Unexpected.
return;
@@ -835,11 +851,11 @@ void Well::applyWellProdIndexScaling(const double currentEffectivePI) {
// WELPI not activated. Nothing to do.
return;
if (this->productivity_index->pi_value == currentEffectivePI)
if (scalingFactor == 1.0)
// No change in scaling.
return;
this->connections->applyWellPIScaling(this->productivity_index->pi_value / currentEffectivePI);
this->connections->applyWellPIScaling(scalingFactor);
}
const WellConnections& Well::getConnections() const {
+8 -2
View File
@@ -3790,7 +3790,10 @@ END
const auto expectCF = (200.0 / 100.0) * 100.0*cp_rm3_per_db();
auto wellP = sched.getWell("P", 1);
wellP.applyWellProdIndexScaling(100.0*liquid_PI_unit());
const auto scalingFactor = wellP.getWellPIScalingFactor(100.0*liquid_PI_unit());
BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10);
wellP.applyWellProdIndexScaling(scalingFactor);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), expectCF, 1.0e-10);
}
@@ -3801,7 +3804,10 @@ END
const auto expectCF = (200.0 / 100.0) * 100.0*cp_rm3_per_db();
auto wellP = sched.getWell("P", 2);
wellP.applyWellProdIndexScaling(100.0*liquid_PI_unit());
const auto scalingFactor = wellP.getWellPIScalingFactor(100.0*liquid_PI_unit());
BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10);
wellP.applyWellProdIndexScaling(scalingFactor);
const auto& connP = wellP.getConnections();
BOOST_CHECK_CLOSE(connP[0].CF(), expectCF , 1.0e-10);
BOOST_CHECK_CLOSE(connP[1].CF(), 50*cp_rm3_per_db(), 1.0e-10);
+24 -9
View File
@@ -1229,15 +1229,25 @@ END
"Second call to updateWellProductivityIndex() must NOT be a state change");
// Want PI=2, but actual/effective PI=1 => scale CF by 2.0/1.0.
wellP.applyWellProdIndexScaling(1.0);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), 2.0*expectCF, 1.0e-10);
{
const auto scalingFactor = wellP.getWellPIScalingFactor(1.0);
BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10);
wellP.applyWellProdIndexScaling(scalingFactor);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), 2.0*expectCF, 1.0e-10);
}
}
// Repeated application of WELPI multiplies scaling factors.
wellP.applyWellProdIndexScaling(1.0);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), 4.0*expectCF, 1.0e-10);
{
const auto scalingFactor = wellP.getWellPIScalingFactor(1.0);
BOOST_CHECK_CLOSE(scalingFactor, 2.0, 1.0e-10);
wellP.applyWellProdIndexScaling(scalingFactor);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), 4.0*expectCF, 1.0e-10);
}
}
// New WELPI record does not reset the scaling factors
@@ -1247,9 +1257,14 @@ END
}
// Effective PI=desired PI => no scaling change
wellP.applyWellProdIndexScaling(3.0);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), 4.0*expectCF, 1.0e-10);
{
const auto scalingFactor = wellP.getWellPIScalingFactor(3.0);
BOOST_CHECK_CLOSE(scalingFactor, 1.0, 1.0e-10);
wellP.applyWellProdIndexScaling(scalingFactor);
for (const auto& conn : wellP.getConnections()) {
BOOST_CHECK_CLOSE(conn.CF(), 4.0*expectCF, 1.0e-10);
}
}
BOOST_CHECK_MESSAGE(wellP.updateWellProductivityIndex(WellPI{ 3.0, Phase::OIL }),