mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
WIP in cleaning up the interfaces of WellInterface and StandardWell
commiting now to save some changes.
This commit is contained in:
@@ -167,18 +167,19 @@ namespace Opm
|
|||||||
using Base::has_solvent;
|
using Base::has_solvent;
|
||||||
using Base::has_polymer;
|
using Base::has_polymer;
|
||||||
|
|
||||||
|
using Base::name;
|
||||||
|
using Base::wellType;
|
||||||
|
using Base::wellControls;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
using Base::phaseUsage;
|
using Base::phaseUsage;
|
||||||
using Base::active;
|
using Base::active;
|
||||||
using Base::numberOfPerforations;
|
using Base::numberOfPerforations;
|
||||||
using Base::wellCells;
|
using Base::wellCells;
|
||||||
using Base::saturationTableNumber;
|
using Base::saturationTableNumber;
|
||||||
using Base::indexOfWell;
|
using Base::indexOfWell;
|
||||||
using Base::name;
|
|
||||||
using Base::wellType;
|
|
||||||
using Base::wellControls;
|
|
||||||
using Base::compFrac;
|
using Base::compFrac;
|
||||||
using Base::numberOfPhases;
|
|
||||||
using Base::perfDepth;
|
|
||||||
using Base::flowToEbosPvIdx;
|
using Base::flowToEbosPvIdx;
|
||||||
using Base::flowPhaseToEbosPhaseIdx;
|
using Base::flowPhaseToEbosPhaseIdx;
|
||||||
using Base::flowPhaseToEbosCompIdx;
|
using Base::flowPhaseToEbosCompIdx;
|
||||||
@@ -188,8 +189,6 @@ namespace Opm
|
|||||||
using Base::wsolvent;
|
using Base::wsolvent;
|
||||||
using Base::wpolymer;
|
using Base::wpolymer;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// TODO: maybe this function can go to some helper file.
|
// TODO: maybe this function can go to some helper file.
|
||||||
void localInvert(DiagMatWell& istlA) const;
|
void localInvert(DiagMatWell& istlA) const;
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ namespace Opm
|
|||||||
// pick the density in the top layer
|
// pick the density in the top layer
|
||||||
const double rho = perf_densities_[0];
|
const double rho = perf_densities_[0];
|
||||||
// TODO: not sure whether it is always correct
|
// 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_);
|
const double dp = wellhelpers::computeHydrostaticCorrection(well_ref_depth, vfp_ref_depth, rho, gravity_);
|
||||||
bhp -= dp;
|
bhp -= dp;
|
||||||
return bhp;
|
return bhp;
|
||||||
@@ -188,7 +188,7 @@ namespace Opm
|
|||||||
EvalWell qs = 0.0;
|
EvalWell qs = 0.0;
|
||||||
|
|
||||||
const WellControls* wc = wellControls();
|
const WellControls* wc = wellControls();
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const double target_rate = well_controls_get_current_target(wc);
|
const double target_rate = well_controls_get_current_target(wc);
|
||||||
|
|
||||||
assert(comp_idx < numComponents());
|
assert(comp_idx < numComponents());
|
||||||
@@ -715,7 +715,7 @@ namespace Opm
|
|||||||
const int perf,
|
const int perf,
|
||||||
std::vector<EvalWell>& mob) const
|
std::vector<EvalWell>& mob) const
|
||||||
{
|
{
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const int cell_idx = wellCells()[perf];
|
const int cell_idx = wellCells()[perf];
|
||||||
assert (int(mob.size()) == numComponents());
|
assert (int(mob.size()) == numComponents());
|
||||||
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
|
||||||
@@ -813,7 +813,7 @@ namespace Opm
|
|||||||
WellState& well_state) const
|
WellState& well_state) const
|
||||||
{
|
{
|
||||||
// TODO: to check whether all the things from PR 1220 were incoporated.
|
// 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 int nw = well_state.bhp().size();
|
||||||
const double dBHPLimit = param.dbhp_max_rel_;
|
const double dBHPLimit = param.dbhp_max_rel_;
|
||||||
const double dFLimit = param.dwell_fraction_max_;
|
const double dFLimit = param.dwell_fraction_max_;
|
||||||
@@ -989,7 +989,7 @@ namespace Opm
|
|||||||
const WellType& well_type = wellType();
|
const WellType& well_type = wellType();
|
||||||
// pick the density in the top layer
|
// pick the density in the top layer
|
||||||
const double rho = perf_densities_[0];
|
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) {
|
if (well_type == INJECTOR) {
|
||||||
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(vfp)->getDatumDepth();
|
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(vfp)->getDatumDepth();
|
||||||
@@ -1082,7 +1082,7 @@ namespace Opm
|
|||||||
|
|
||||||
const WellType& well_type = wellType();
|
const WellType& well_type = wellType();
|
||||||
const double rho = perf_densities_[0];
|
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) {
|
if (well_type == INJECTOR) {
|
||||||
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
|
const double vfp_ref_depth = vfp_properties_->getInj()->getTable(table_id)->getDatumDepth();
|
||||||
|
|
||||||
@@ -1143,7 +1143,7 @@ namespace Opm
|
|||||||
WellState& xw) const
|
WellState& xw) const
|
||||||
{
|
{
|
||||||
// number of phases
|
// number of phases
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const int well_index = indexOfWell();
|
const int well_index = indexOfWell();
|
||||||
const WellControls* wc = wellControls();
|
const WellControls* wc = wellControls();
|
||||||
// Updating well state and primary variables.
|
// Updating well state and primary variables.
|
||||||
@@ -1184,7 +1184,7 @@ namespace Opm
|
|||||||
|
|
||||||
// pick the density in the top layer
|
// pick the density in the top layer
|
||||||
const double rho = perf_densities_[0];
|
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.
|
// TODO: make the following a function and we call it so many times.
|
||||||
if (wellType() == INJECTOR) {
|
if (wellType() == INJECTOR) {
|
||||||
@@ -1362,7 +1362,7 @@ namespace Opm
|
|||||||
StandardWell<TypeTag>::
|
StandardWell<TypeTag>::
|
||||||
updateWellControl(WellState& xw) const
|
updateWellControl(WellState& xw) const
|
||||||
{
|
{
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const int nw = xw.bhp().size();
|
const int nw = xw.bhp().size();
|
||||||
const int w = indexOfWell();
|
const int w = indexOfWell();
|
||||||
|
|
||||||
@@ -1566,7 +1566,7 @@ namespace Opm
|
|||||||
const std::vector<double>& surf_dens_perf)
|
const std::vector<double>& surf_dens_perf)
|
||||||
{
|
{
|
||||||
// Verify that we have consistent input.
|
// Verify that we have consistent input.
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const int nperf = numberOfPerforations();
|
const int nperf = numberOfPerforations();
|
||||||
const int num_comp = numComponents();
|
const int num_comp = numComponents();
|
||||||
const PhaseUsage* phase_usage = phase_usage_;
|
const PhaseUsage* phase_usage = phase_usage_;
|
||||||
@@ -1704,7 +1704,7 @@ namespace Opm
|
|||||||
typedef double Scalar;
|
typedef double Scalar;
|
||||||
typedef std::vector< Scalar > Vector;
|
typedef std::vector< Scalar > Vector;
|
||||||
|
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const int numComp = numComponents();
|
const int numComp = numComponents();
|
||||||
|
|
||||||
// the following implementation assume that the polymer is always after the w-o-g phases
|
// the following implementation assume that the polymer is always after the w-o-g phases
|
||||||
@@ -1787,7 +1787,7 @@ namespace Opm
|
|||||||
// Compute densities
|
// Compute densities
|
||||||
const int nperf = numberOfPerforations();
|
const int nperf = numberOfPerforations();
|
||||||
const int numComponent = numComponents();
|
const int numComponent = numComponents();
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
std::vector<double> perfRates(b_perf.size(),0.0);
|
std::vector<double> perfRates(b_perf.size(),0.0);
|
||||||
|
|
||||||
for (int perf = 0; perf < nperf; ++perf) {
|
for (int perf = 0; perf < nperf; ++perf) {
|
||||||
@@ -1942,7 +1942,7 @@ namespace Opm
|
|||||||
const EvalWell& bhp,
|
const EvalWell& bhp,
|
||||||
std::vector<double>& well_flux) const
|
std::vector<double>& well_flux) const
|
||||||
{
|
{
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const int numComp = numComponents();
|
const int numComp = numComponents();
|
||||||
well_flux.resize(np, 0.0);
|
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: 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?
|
// 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()) );
|
assert( np == int(initial_potential.size()) );
|
||||||
|
|
||||||
@@ -2099,7 +2099,7 @@ namespace Opm
|
|||||||
const WellState& well_state,
|
const WellState& well_state,
|
||||||
std::vector<double>& well_potentials) const
|
std::vector<double>& well_potentials) const
|
||||||
{
|
{
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
|
|
||||||
well_potentials.resize(np, 0.0);
|
well_potentials.resize(np, 0.0);
|
||||||
|
|
||||||
|
|||||||
@@ -96,12 +96,6 @@ namespace Opm
|
|||||||
/// Well controls
|
/// Well controls
|
||||||
WellControls* wellControls() const;
|
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,
|
virtual void init(const PhaseUsage* phase_usage_arg,
|
||||||
const std::vector<bool>* active_arg,
|
const std::vector<bool>* active_arg,
|
||||||
const VFPProperties* vfp_properties_arg,
|
const VFPProperties* vfp_properties_arg,
|
||||||
@@ -172,14 +166,15 @@ namespace Opm
|
|||||||
|
|
||||||
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
|
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
|
||||||
|
|
||||||
int numPhases() const;
|
|
||||||
|
|
||||||
// number of phases
|
// number of phases
|
||||||
int numberOfPhases() const;
|
int numPhases() const;
|
||||||
|
|
||||||
// TODO: it is dumplicated with StandardWellsDense
|
// TODO: it is dumplicated with StandardWellsDense
|
||||||
int numComponents() const;
|
int numComponents() const;
|
||||||
|
|
||||||
|
// Number of the perforations
|
||||||
|
int numberOfPerforations() const;
|
||||||
|
|
||||||
// simply returning allow_cf_
|
// simply returning allow_cf_
|
||||||
// TODO: to check whether needed, it causes name problem with the crossFlowAllowed
|
// TODO: to check whether needed, it causes name problem with the crossFlowAllowed
|
||||||
bool allowCrossFlow() const;
|
bool allowCrossFlow() const;
|
||||||
@@ -280,7 +275,7 @@ namespace Opm
|
|||||||
// Component fractions for each phase for the well
|
// Component fractions for each phase for the well
|
||||||
const std::vector<double>& compFrac() const;
|
const std::vector<double>& compFrac() const;
|
||||||
|
|
||||||
/// Well productivity index for each perforation.
|
// Well productivity index for each perforation.
|
||||||
const std::vector<double>& wellIndex() const;
|
const std::vector<double>& wellIndex() const;
|
||||||
|
|
||||||
double mostStrictBhpFromBhpLimits() const;
|
double mostStrictBhpFromBhpLimits() const;
|
||||||
|
|||||||
@@ -148,17 +148,6 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
int
|
|
||||||
WellInterface<TypeTag>::
|
|
||||||
numberOfPhases() const
|
|
||||||
{
|
|
||||||
return number_of_phases_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
const std::vector<double>&
|
const std::vector<double>&
|
||||||
WellInterface<TypeTag>::
|
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>
|
template<typename TypeTag>
|
||||||
const std::vector<int>&
|
const std::vector<int>&
|
||||||
WellInterface<TypeTag>::
|
WellInterface<TypeTag>::
|
||||||
@@ -502,7 +479,7 @@ namespace Opm
|
|||||||
const WellState& well_state) const
|
const WellState& well_state) const
|
||||||
{
|
{
|
||||||
const Opm::PhaseUsage& pu = *phase_usage_;
|
const Opm::PhaseUsage& pu = *phase_usage_;
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
|
|
||||||
if (econ_production_limits.onMinOilRate()) {
|
if (econ_production_limits.onMinOilRate()) {
|
||||||
assert(active()[Oil]);
|
assert(active()[Oil]);
|
||||||
@@ -557,7 +534,7 @@ namespace Opm
|
|||||||
bool last_connection = false;
|
bool last_connection = false;
|
||||||
double violation_extent = -1.0;
|
double violation_extent = -1.0;
|
||||||
|
|
||||||
const int np = numberOfPhases();
|
const int np = numPhases();
|
||||||
const Opm::PhaseUsage& pu = *phase_usage_;
|
const Opm::PhaseUsage& pu = *phase_usage_;
|
||||||
const int well_number = index_of_well_;
|
const int well_number = index_of_well_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user