using well name and allow_cf form well_ecl.

This commit is contained in:
Kai Bao 2017-08-21 11:26:21 +02:00
parent a908bd7cf1
commit 9a4a9a2bcc
4 changed files with 49 additions and 43 deletions

View File

@ -62,6 +62,7 @@ namespace Opm
using Base::has_solvent;
using Base::has_polymer;
using Base::name;
// TODO: with flow_ebosfor a 2P deck, // TODO: for the 2p deck, numEq will be 3, a dummy phase is already added from the reservoir side.
// it will cause problem here without processing the dummy phase.
@ -165,6 +166,7 @@ namespace Opm
protected:
// protected functions from the Base class
using Base::getAllowCrossFlow;
using Base::phaseUsage;
using Base::active;
using Base::flowToEbosPvIdx;
@ -177,7 +179,6 @@ namespace Opm
using Base::mostStrictBhpFromBhpLimits;
// protected member variables from the Base class
using Base::name_;
using Base::vfp_properties_;
using Base::gravity_;
using Base::well_efficiency_factor_;
@ -185,7 +186,6 @@ namespace Opm
using Base::first_perf_;
using Base::ref_depth_;
using Base::perf_depth_;
using Base::allow_cf_;
using Base::well_cells_;
using Base::number_of_perforations_;
using Base::number_of_phases_;

View File

@ -282,7 +282,7 @@ namespace Opm
// ReservoirRate
return target_rate * wellVolumeFractionScaled(comp_idx);
} else {
OPM_THROW(std::logic_error, "Unknown control type for well " << name_);
OPM_THROW(std::logic_error, "Unknown control type for well " << name());
}
// avoid warning of condition reaches end of non-void function
@ -488,7 +488,7 @@ namespace Opm
const EvalWell d = 1.0 - rv * rs;
if (d.value() == 0.0) {
OPM_THROW(Opm::NumericalProblem, "Zero d value obtained for well " << name_ << " during flux calcuation"
OPM_THROW(Opm::NumericalProblem, "Zero d value obtained for well " << name() << " during flux calcuation"
<< " with rs " << rs << " and rv " << rv);
}
@ -648,7 +648,7 @@ namespace Opm
StandardWell<TypeTag>::
crossFlowAllowed(const Simulator& ebosSimulator) const
{
if (allow_cf_) {
if (getAllowCrossFlow()) {
return true;
}
@ -1195,7 +1195,7 @@ namespace Opm
// checking whether control changed
if (updated_control_index != old_control_index) {
logger.wellSwitched(name_,
logger.wellSwitched(name(),
well_controls_iget_type(wc, old_control_index),
well_controls_iget_type(wc, updated_control_index));
}
@ -1498,11 +1498,11 @@ namespace Opm
const auto& phaseName = FluidSystem::phaseName(flowPhaseToEbosPhaseIdx(phaseIdx));
if (std::isnan(well_flux_residual[phaseIdx])) {
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << phaseName << " for well " << name_);
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << phaseName << " for well " << name());
}
if (well_flux_residual[phaseIdx] > maxResidualAllowed) {
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << phaseName << " for well " << name_);
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << phaseName << " for well " << name());
}
}
@ -1769,7 +1769,7 @@ namespace Opm
// there should be always some available bhp/thp constraints there
if (std::isinf(bhp) || std::isnan(bhp)) {
OPM_THROW(std::runtime_error, "Unvalid bhp value obtained during the potential calculation for well " << name_);
OPM_THROW(std::runtime_error, "Unvalid bhp value obtained during the potential calculation for well " << name());
}
converged = std::abs(old_bhp - bhp) < bhp_tolerance;
@ -1779,7 +1779,7 @@ namespace Opm
// checking whether the potentials have valid values
for (const double value : potentials) {
if (std::isinf(value) || std::isnan(value)) {
OPM_THROW(std::runtime_error, "Unvalid potential value obtained during the potential calculation for well " << name_);
OPM_THROW(std::runtime_error, "Unvalid potential value obtained during the potential calculation for well " << name());
}
}
@ -1798,7 +1798,7 @@ namespace Opm
}
if (!converged) {
OPM_THROW(std::runtime_error, "Failed in getting converged for the potential calculation for well " << name_);
OPM_THROW(std::runtime_error, "Failed in getting converged for the potential calculation for well " << name());
}
return potentials;

View File

@ -157,27 +157,6 @@ namespace Opm
virtual void setWellSolutions(const WellState& well_state) const = 0;
protected:
const std::vector<bool>& active() const;
const PhaseUsage& phaseUsage() const;
int flowPhaseToEbosCompIdx( const int phaseIdx ) const;
int flowToEbosPvIdx( const int flowPv ) const;
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
// TODO: it is dumplicated with StandardWellsDense
int numComponents() const;
virtual bool crossFlowAllowed(const Simulator& ebosSimulator) const = 0;
double wsolvent() const;
double wpolymer() const;
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
const WellState& well_state) const;
// to indicate a invalid connection
static const int INVALIDCONNECTION = -100000;
@ -186,10 +165,6 @@ namespace Opm
const int current_step_;
// TODO: some variables shared by all the wells should be made static
// well name
std::string name_;
// the index of well in Wells struct
int index_of_well_;
@ -197,9 +172,6 @@ namespace Opm
// INJECTOR or PRODUCER
enum WellType well_type_;
// whether the well allows crossflow
bool allow_cf_;
// number of phases
int number_of_phases_;
@ -248,12 +220,36 @@ namespace Opm
const PhaseUsage* phase_usage_;
bool getAllowCrossFlow() const;
const std::vector<bool>* active_;
const VFPProperties* vfp_properties_;
double gravity_;
const std::vector<bool>& active() const;
const PhaseUsage& phaseUsage() const;
int flowPhaseToEbosCompIdx( const int phaseIdx ) const;
int flowToEbosPvIdx( const int flowPv ) const;
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
// TODO: it is dumplicated with StandardWellsDense
int numComponents() const;
virtual bool crossFlowAllowed(const Simulator& ebosSimulator) const = 0;
double wsolvent() const;
double wpolymer() const;
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
const WellState& well_state) const;
bool wellHasTHPConstraints() const;
// Component fractions for each phase for the well

View File

@ -44,10 +44,8 @@ namespace Opm
// here, just another assertion.
assert(index_well != wells->number_of_wells);
name_ = well_name;
index_of_well_ = index_well;
well_type_ = wells->type[index_well];
allow_cf_ = wells->allow_cf[index_well];
number_of_phases_ = wells->number_of_phases;
// copying the comp_frac
@ -127,7 +125,7 @@ namespace Opm
WellInterface<TypeTag>::
name() const
{
return name_;
return well_ecl_->name();
}
@ -158,6 +156,18 @@ namespace Opm
template<typename TypeTag>
bool
WellInterface<TypeTag>::
getAllowCrossFlow() const
{
return well_ecl_->getAllowCrossFlow();
}
template<typename TypeTag>
const std::vector<bool>&
WellInterface<TypeTag>::
@ -593,7 +603,7 @@ namespace Opm
return;
}
const std::string well_name = name_;
const std::string well_name = name();
// for the moment, we only handle rate limits, not handling potential limits
// the potential limits should not be difficult to add