Include EQUIL-based inititalisation for 3-phase.
Fix phase property references

Methods 'computeRelperm()' and 'computePressures()' *always* return
a three-element vector of phase properties.  We must therefore
translate to canonical phase indices before indexing into the
results.
variableState: Don't reference non-existing variable

The "xvar" exists only if Gas is active.  Therefore, we cannot
extract that variable from "vars" unless we know that Gas is an
active phase.  Failing to do so would wrongfully increment 'nextvar'
whence the final BHP variable would be an out-of-bounds access.
variableState: Defer r{s,v}Sat calculation

Quantities rsSat and rvSat are not needed unless we have an active
Gas phase.  Don't calculate them until we know that they are
actually needed.
variableState: Use pre-computed list of "all cells"

Class FullyImplicitBlackoilSolver<Grid> already features a list of
"all" cells, built at object construction time.  There's no need to
re-compute that list on every call to variableState() (when Gas is
active).
variableState: Don't form objects when references suffice

There's no need to form new objects, especially for the 'xvar', when
there are existing objects to which read-only references can be
bound.
assemble: Fix out-of-bounds indexing

The 'material_balance_eq' is indexed by active, not canonical, phase
indices.  Replace 'Oil' and 'Gas' with the appropriate 'phase_pos'
values.
Fix one-sided gravity potential calculation

Commit 5112b8a misinterpreted the role of index 'i' and, as a result,
installed code that would only define one-sided gravity potentials of
the first cell (roughly)--albeit eventually using the geometry of the
last active cell.

This commit restores the original, intended behaviour.
Merge pull request #146 from bska/nphase

Fix a few two-phase implementation errors
Merge pull request #158 from osae/equil

Include EQUIL-based inititalisation for 3-phase.
Merge pull request #159 from bska/fix-gpot

Fix one-sided gravity potential calculation
Fix contextual misprint: face -> phase
Time loop: Remove control mode switching

The solver (class FullyImplicitBlackoilSolver<>) gained the ability
to do control mode switching/updating in commit 4a22c56 at which
point using WellsManager::conditionsMet() ceased to be useful.  This
is a preparatory step towards adding support for RESV-type control
modes.

If we need this type of behaviour in the Simulator*, we can bring it
back (in modified form) at a later time.
Time loop: Remove unused variable
RESV: Add facility for surface-to-reservoir rate conversion

This commit adds a simple facility for converting component rates at
surface conditions to voidage rates at reservoir conditions.  It is
intentionally limited in scope and meant to be employed only in the
context of class FullyImplicitBlackoilSolver<> or something very
similar.  In particular, class SurfaceToReservoirVoidage<> assumes
that it will be used to compute conversion coefficients for
component rates to voidage rates, and that those coefficients will
typically be entered into the coefficient matrix of a linearised
residual.

Add a trivial test just to demonstrate the setup and calling
process.  This is not a feature or correctness test.
Prune unused header

The column-extraction feature was not used in this module.
Remove long-disabled parameter setup code

This was copy-pasted into the class at its inception (a94f1921) and
never used thereafter.  If we need it we can bring it back in
modified form at a later stage.
RESV: Prepare for dynamic rate distribution calculation

This commit changes the API of class SimulatorFullyImplicitBlackoil<>
in order to support wells controlled by (total) reservoir voidage
volume rates.  Specifically, we switch to holding a mutable Wells
object (backed by a std::shared_ptr<>) in class Impl rather than a
reference to a WellsManager.  This allows dynamically updating rate
distributions and targets of individual well controls.  That, in
turn, is a prerequisite to supporting ECL-style "RESV" control
modes--be it in prediction or history matching capacity.

While in the process of API changes, also prepare for the second
stage of "WCONHIST/RESV" support: Accept a ScheduleConstPtr that
holds the input deck's notion of the history matching vs. prediction
controls.  We need to distinguish the two in order to support the
exact semantics of "WCONHIST/RESV".

Update SimFIBO<> clients accordingly.
Implement RESV control mode for producers

This commit introduces support for the RESV control mode of
prediction (WCONPROD) and history-matching (WCONHIST) alike.  The
implementation uses class SurfaceToReservoirVoidage<> to compute
coefficients that convert component rates at surface conditions
(i.e., the primary degrees of freedom in the well residual) to phase
rates at reservoir condition.  The resulting coefficients can be
entered directly into system matrix of the linearised residual.

Note: We abuse the "distr" mechanism of struct WellControls to store
the conversion coefficients.  This may require refactorisation and
clarification at a later stage.  In the meantime, it allows for
transparent assembly of well equations--irrespective of surface- or
reservoir (voidage) rates.

Note: We do not yet support injectors controlled by total reservoir
voidage rate--either in history-matching (WCONINJH) or
prediction-scenario capacity.
Aesthetics: Turn if-else into switch()

This commit replaces an if-else-based query of the primaryVariable_
with the equivalent switch() statement for uniformity with the rest
of the implementation.