Do not store number of phases in StandardWells.

The wells pointer might be null and we need to access its number of
phases in the constructor to store it. With this commit we prevent that
storage and simply ask the well struct whenever we need the number of
phases. Of course the code using it needs to check that there are wells
but that is done in most parts of the opm-simulators currently
(MultiSegmentWells and Solvent are/might be an exception).
This commit is contained in:
Markus Blatt 2016-06-27 12:14:17 +02:00
parent c1e5a64329
commit 9a7b77af9c
2 changed files with 4 additions and 5 deletions

View File

@ -70,7 +70,7 @@ namespace Opm {
const WellOps& wellOps() const;
int numPhases() const { return num_phases_; };
int numPhases() const { return wells().number_of_phases; };
const Wells& wells() const;
@ -173,7 +173,6 @@ namespace Opm {
bool wells_active_;
const Wells* wells_;
const WellOps wops_;
const int num_phases_;
const BlackoilPropsAdInterface* fluid_;
const std::vector<bool>* active_;

View File

@ -74,7 +74,6 @@ namespace Opm
StandardWells::StandardWells(const Wells* wells_arg)
: wells_(wells_arg)
, wops_(wells_arg)
, num_phases_(wells_arg->number_of_phases)
, fluid_(nullptr)
, active_(nullptr)
, phase_condition_(nullptr)
@ -365,6 +364,7 @@ namespace Opm
return;
} else {
const std::vector<int>& well_cells = wellOps().well_cells;
const int num_phases_ = wells().number_of_phases;
mob_perfcells.resize(num_phases_, ADB::null());
b_perfcells.resize(num_phases_, ADB::null());
for (int phase = 0; phase < num_phases_; ++phase) {
@ -390,7 +390,7 @@ namespace Opm
{
if( ! localWellsActive() ) return ;
const int np = num_phases_;
const int np = wells().number_of_phases;
const int nw = wells().number_of_wells;
const int nperf = wells().well_connpos[nw];
Vector Tw = Eigen::Map<const Vector>(wells().WI, nperf);
@ -603,7 +603,7 @@ namespace Opm
{
if( localWellsActive() )
{
const int np = num_phases_;
const int np = wells().number_of_phases;
const int nw = wells().number_of_wells;
// Extract parts of dwells corresponding to each part.