WIP in cleaning up the interfaces of WellInterface and StandardWell

commiting now to save some changes.
This commit is contained in:
Kai Bao
2017-08-04 11:20:55 +02:00
parent d4f26ad47a
commit 1550fb7600
4 changed files with 28 additions and 57 deletions

View File

@@ -167,18 +167,19 @@ namespace Opm
using Base::has_solvent;
using Base::has_polymer;
using Base::name;
using Base::wellType;
using Base::wellControls;
protected:
using Base::phaseUsage;
using Base::active;
using Base::numberOfPerforations;
using Base::wellCells;
using Base::saturationTableNumber;
using Base::indexOfWell;
using Base::name;
using Base::wellType;
using Base::wellControls;
using Base::compFrac;
using Base::numberOfPhases;
using Base::perfDepth;
using Base::flowToEbosPvIdx;
using Base::flowPhaseToEbosPhaseIdx;
using Base::flowPhaseToEbosCompIdx;
@@ -188,8 +189,6 @@ namespace Opm
using Base::wsolvent;
using Base::wpolymer;
protected:
// TODO: maybe this function can go to some helper file.
void localInvert(DiagMatWell& istlA) const;

View File

@@ -167,7 +167,7 @@ namespace Opm
// pick the density in the top layer
const double rho = perf_densities_[0];
// TODO: not sure whether it is always correct
const double well_ref_depth = perfDepth()[0];
const double well_ref_depth = perf_depth_[0];
const double dp = wellhelpers::computeHydrostaticCorrection(well_ref_depth, vfp_ref_depth, rho, gravity_);
bhp -= dp;
return bhp;
@@ -188,7 +188,7 @@ namespace Opm
EvalWell qs = 0.0;
const WellControls* wc = wellControls();
const int np = numberOfPhases();
const int np = numPhases();
const double target_rate = well_controls_get_current_target(wc);
assert(comp_idx < numComponents());
@@ -715,7 +715,7 @@ namespace Opm
const int perf,
std::vector<EvalWell>& mob) const
{
const int np = numberOfPhases();
const int np = numPhases();
const int cell_idx = wellCells()[perf];
assert (int(mob.size()) == numComponents());
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
@@ -813,7 +813,7 @@ namespace Opm
WellState& well_state) const
{
// TODO: to check whether all the things from PR 1220 were incoporated.
const int np = numberOfPhases();
const int np = numPhases();
const int nw = well_state.bhp().size();
const double dBHPLimit = param.dbhp_max_rel_;
const double dFLimit = param.dwell_fraction_max_;
@@ -989,7 +989,7 @@ namespace Opm
const WellType& well_type = wellType();
// pick the density in the top layer
const double rho = perf_densities_[0];
const double well_ref_depth = perfDepth()[0];
const double well_ref_depth = perf_depth_[0];
if (well_type == INJECTOR) {
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(vfp)->getDatumDepth();
@@ -1082,7 +1082,7 @@ namespace Opm
const WellType& well_type = wellType();
const double rho = perf_densities_[0];
const double well_ref_depth = perfDepth()[0];
const double well_ref_depth = perf_depth_[0];
if (well_type == INJECTOR) {
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
@@ -1143,7 +1143,7 @@ namespace Opm
WellState& xw) const
{
// number of phases
const int np = numberOfPhases();
const int np = numPhases();
const int well_index = indexOfWell();
const WellControls* wc = wellControls();
// Updating well state and primary variables.
@@ -1184,7 +1184,7 @@ namespace Opm
// pick the density in the top layer
const double rho = perf_densities_[0];
const double well_ref_depth = perfDepth()[0];
const double well_ref_depth = perf_depth_[0];
// TODO: make the following a function and we call it so many times.
if (wellType() == INJECTOR) {
@@ -1362,7 +1362,7 @@ namespace Opm
StandardWell<TypeTag>::
updateWellControl(WellState& xw) const
{
const int np = numberOfPhases();
const int np = numPhases();
const int nw = xw.bhp().size();
const int w = indexOfWell();
@@ -1566,7 +1566,7 @@ namespace Opm
const std::vector<double>& surf_dens_perf)
{
// Verify that we have consistent input.
const int np = numberOfPhases();
const int np = numPhases();
const int nperf = numberOfPerforations();
const int num_comp = numComponents();
const PhaseUsage* phase_usage = phase_usage_;
@@ -1704,7 +1704,7 @@ namespace Opm
typedef double Scalar;
typedef std::vector< Scalar > Vector;
const int np = numberOfPhases();
const int np = numPhases();
const int numComp = numComponents();
// the following implementation assume that the polymer is always after the w-o-g phases
@@ -1787,7 +1787,7 @@ namespace Opm
// Compute densities
const int nperf = numberOfPerforations();
const int numComponent = numComponents();
const int np = numberOfPhases();
const int np = numPhases();
std::vector<double> perfRates(b_perf.size(),0.0);
for (int perf = 0; perf < nperf; ++perf) {
@@ -1942,7 +1942,7 @@ namespace Opm
const EvalWell& bhp,
std::vector<double>& well_flux) const
{
const int np = numberOfPhases();
const int np = numPhases();
const int numComp = numComponents();
well_flux.resize(np, 0.0);
@@ -1976,7 +1976,7 @@ namespace Opm
{
// TODO: pay attention to the situation that finally the potential is calculated based on the bhp control
// TODO: should we consider the bhp constraints during the iterative process?
const int np = numberOfPhases();
const int np = numPhases();
assert( np == int(initial_potential.size()) );
@@ -2099,7 +2099,7 @@ namespace Opm
const WellState& well_state,
std::vector<double>& well_potentials) const
{
const int np = numberOfPhases();
const int np = numPhases();
well_potentials.resize(np, 0.0);

View File

@@ -96,12 +96,6 @@ namespace Opm
/// Well controls
WellControls* wellControls() const;
/// Number of the perforations
int numberOfPerforations() const;
/// Depth of perforations
const std::vector<double>& perfDepth() const;
virtual void init(const PhaseUsage* phase_usage_arg,
const std::vector<bool>* active_arg,
const VFPProperties* vfp_properties_arg,
@@ -172,14 +166,15 @@ namespace Opm
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
int numPhases() const;
// number of phases
int numberOfPhases() const;
int numPhases() const;
// TODO: it is dumplicated with StandardWellsDense
int numComponents() const;
// Number of the perforations
int numberOfPerforations() const;
// simply returning allow_cf_
// TODO: to check whether needed, it causes name problem with the crossFlowAllowed
bool allowCrossFlow() const;
@@ -280,7 +275,7 @@ namespace Opm
// Component fractions for each phase for the well
const std::vector<double>& compFrac() const;
/// Well productivity index for each perforation.
// Well productivity index for each perforation.
const std::vector<double>& wellIndex() const;
double mostStrictBhpFromBhpLimits() const;

View File

@@ -148,17 +148,6 @@ namespace Opm
template<typename TypeTag>
int
WellInterface<TypeTag>::
numberOfPhases() const
{
return number_of_phases_;
}
template<typename TypeTag>
const std::vector<double>&
WellInterface<TypeTag>::
@@ -219,18 +208,6 @@ namespace Opm
template<typename TypeTag>
const std::vector<double>&
WellInterface<TypeTag>::
perfDepth() const
{
return perf_depth_;
}
template<typename TypeTag>
const std::vector<int>&
WellInterface<TypeTag>::
@@ -502,7 +479,7 @@ namespace Opm
const WellState& well_state) const
{
const Opm::PhaseUsage& pu = *phase_usage_;
const int np = numberOfPhases();
const int np = numPhases();
if (econ_production_limits.onMinOilRate()) {
assert(active()[Oil]);
@@ -557,7 +534,7 @@ namespace Opm
bool last_connection = false;
double violation_extent = -1.0;
const int np = numberOfPhases();
const int np = numPhases();
const Opm::PhaseUsage& pu = *phase_usage_;
const int well_number = index_of_well_;