OPM/opm-core — pull request #30 by bska (2012-09-20 20:40:32+00:00)
Title: Fix Impedance Mismatch Between CompressibleTpfa and cfs_tpfa_residual

Andrea Capolei on the OPM mailing list highlighted an issue that currently prevents running examples (in particular, the `sim_2p_comp_reorder` simulator) without wells.

There was a mismatch between what the low-level system assembler `cfs_tpfa_residual` expected and what the `CompressibleTpfa` pressure solver provided in a simulation model without wells. The former expected its `forces->wells` pointer to be `NULL` while the latter passed a non-`NULL` pointer but set the `W` member to `NULL` to signify "no wells". This patch set extends `cfs_tpfa_residual` to support the latter convention, while still maintaining support for the original interpretation.

We also add some of the support needed to actually run a simulation based on `CompressibleTpfa` without wells. In particular, we add checks to guard against dereferencing the `wells_` member if it is null or generating pointers into empty standard vectors where applicable.

There is still work missing to fully support simulations without wells, but this change does at least prevent crashes if such models are presented to the simulator.