This commit adds a new helper function
getCompletionNumberFromGlobalConnectionIndex
which returns an optional<int> containing the completion number of
the connection with the associated global cell index, or nullopt if
no such connection exists. We then reimplement the CxL summary
keywords in terms of this function to handle connections being added
dynamically during the simulation. The connections at the end of
the simulation, from which we configure all connection-related
summary nodes, might not accurately reflect the connections existing
at all times during the simulation.
Heed advice from [at]joakim-hove to keep client code as close to
strictly SI as possible. We must nevertheless continue to store the
raw (input/output units) requested PI value internally as this is
the only way to ensure that both the client and implementation has
consistent view of the well's preferred phase. This means pushing
the unit conversion into Well::getWellPIScalingFactor().
Thanks to [at]joakim-hove for pointing out that the Well already
maintains an internal UnitSystem data member which makes the process
of converting the PI units trivial.
This commit ensures that we record a general, Schedule-level
WELL_PRODUCTIVITY_INDEX
event in addition to the well-specific event already recorded when
we encounter a WELPI keyword. We need this information in order to
trigger a PI calculation across all MPI processes in opm-simulators.
This makes the interface less convenient to use, but it is the only
way to guarantee that we have a consistent notion of preferred phase
for injectors. The downside is that the users of
Well::getWellPIScalingFactor()
must convert the argument to raw/input units before calling the
function.
There and back again. We don't actually need the preferred phase at
the time of encountering the WELPI request. [at]joakim-hove was
right, the preferred phase of an injector must reflect the state at
the same report step as the WELPI keyword. In other words, if the
injected phase is reset at the same report step as a WELPI keyword,
then the new preferred phase must be that of the new injected phase.
This reverts commit 3eef45e87d.
1. The well reference depth should *not* be updated when new connections are
added with COMPDAT.
2. The well reference depth should be recalculated when the well is updated with
the WELSPECS keyword.
This commit adds a new member function
applyWellProdIndexScaling(well_name, report_step, scalingFactor)
which applies WELPI-based CTF scaling (by scalingFactor) for all
pertinent report steps from 'report_step' and until the end of the
simulation run. We use the 'scalingApplicable' array to communicate
connection eligibility between report steps and only apply the
scaling if the internal connections pointers differ between report
steps.
This commit adds a new in/out parameter, scalingApplicable, to the
applyWellProdIndexScaling functions. This parameter carries time
(history) information on whether or not a particular connection is
eligible for WELPI-based CTF scaling. Entries are marked ineligible
(false) and left untouched on subsequent calls if the corresponding
connection is ineligible at any point--e.g., as a result of new
COMPDAT entries.
This ability enables implementing WELPI CTF scaling at the Schedule
level which is the only level that has sufficient time information
to identify all the unique Well/WellConnections object combinations.