numComponents has been a very misleading name and something causes
confusion when coming to phase/component indices.
For example, mobility is not way to be associated with compoent.
replacing it with a new PhaseUsageInfo and FluidSystem, both of which
are using the same implementation of PhaseUsageInfo, and only one set of
indices is used. Currently, it is the BlackOilDefaultFluidSystemIndices.
Instead of evaluating the well at the state given by its current
state (primary variables) use the bhp limit (or 1 bar) to get the
rates that provide the correct fractions.
Now that the AD (Evaluation) primary variables in the well classes
are always updated whenever the value primary variables are, we
no longer need to remember to explicitly update them, simplifying
the code and enabling removal of functions.
The init() function of the primary variable classes have been renamed
to setEvaluationsFromValues() and made private.
inactive components are represented using negative values in the
index(traits) class so we should not be using unsigned values
in the fluidsystem
while at it make activeToCanonicalComponentIndex usable at compile time
Since std::clamp returns a reference we must be careful to not capture
the return value by reference, when there is a temporary among the input
parameters.
For the second change (adding the explicit Scalar return type to a lambda)
this is strictly speaking not necessary, as the lambda's return type is not
a reference, but that is obscure so the change is just done as to clarify.
with multi-segments, the segment pressure can be lower than the bhp, so
it is not desirable to use spres_lower_limit to limit the segment
pressure. We only use spres_lower_limit to limit the bhp, which is still
valid until we begin using bhp limit lower than 1 bar.
1. stopped production wells
2. production wells under zero rate control
We guarantee the objective through enforce zero values for the WQTotal
primary variable during the initialization and update process during the
Newton solution.