moving wsolvent and wpolymer to WellInterface

to do this, adding well_ecl_ and current_step_ to WelInterface.
This commit is contained in:
Kai Bao 2017-07-25 12:10:13 +02:00
parent a02a0d8599
commit 7e9eee4ee4
4 changed files with 47 additions and 74 deletions

View File

@ -355,10 +355,6 @@ enum WellVariablePositions {
const WellState& well_state,
const WellMapEntryType& map_entry) const;
double wsolvent(const int well_index) const;
double wpolymer(const int well_index) const;
void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed ) const;
void computeRepRadiusPerfLength(const Grid& grid);

View File

@ -1374,71 +1374,6 @@ namespace Opm {
template<typename TypeTag>
double
StandardWellsDense<TypeTag>::
wsolvent(const int well_index) const {
if (!has_solvent_) {
return 0.0;
}
// loop over all wells until we find the well with the matching name
for (const auto& well : wells_ecl_) {
if (well->getStatus( current_timeIdx_ ) == WellCommon::SHUT) {
continue;
}
WellInjectionProperties injection = well->getInjectionProperties(current_timeIdx_);
if (injection.injectorType == WellInjector::GAS) {
double solventFraction = well->getSolventFraction(current_timeIdx_);
// Look until we find the correct well
if (well->name() == wells().name[well_index]) {
return solventFraction;
}
}
}
// we didn't find it return 0;
assert(false);
return 0.0;
}
template<typename TypeTag>
double
StandardWellsDense<TypeTag>::
wpolymer(const int well_index) const {
if (!has_polymer_) {
return 0.0;
}
// loop over all wells until we find the well with the matching name
for (const auto& well : wells_ecl_) {
if (well->getStatus( current_timeIdx_ ) == WellCommon::SHUT) {
continue;
}
WellInjectionProperties injection = well->getInjectionProperties(current_timeIdx_);
WellPolymerProperties polymer = well->getPolymerProperties(current_timeIdx_);
if (injection.injectorType == WellInjector::WATER) {
double polymerFraction = polymer.m_polymerConcentration;
// Look until we find the correct well
if (well->name() == wells().name[well_index]) {
return polymerFraction;
}
}
}
// we didn't find it return 0;
assert(false);
return 0.0;
}
template<typename TypeTag>
void
StandardWellsDense<TypeTag>::

View File

@ -79,9 +79,10 @@ namespace Opm
typedef DenseAd::Evaluation<double, /*size=*/numEq> Eval;
static const bool has_solvent = GET_PROP_VALUE(TypeTag, EnableSolvent);
static const bool has_polymer = GET_PROP_VALUE(TypeTag, EnablePolymer);
/// Constructor
// TODO: Wel can be reference.
// TODO: Well can be reference.
WellInterface(const Well* well, const int time_step, const Wells* wells);
/// Well name.
@ -161,6 +162,8 @@ namespace Opm
double wsolvent() const;
double wpolymer() const;
virtual bool getWellConvergence(Simulator& ebosSimulator,
const std::vector<double>& B_avg,
const ModelParameters& param) const = 0;
@ -202,6 +205,11 @@ namespace Opm
std::vector<double>& well_potentials) const = 0;
protected:
const Well* well_ecl_;
const int current_step_;
// TODO: some variables shared by all the wells should be made static
// well name
std::string name_;

View File

@ -26,6 +26,8 @@ namespace Opm
template<typename TypeTag>
WellInterface<TypeTag>::
WellInterface(const Well* well, const int time_step, const Wells* wells)
: well_ecl_(well)
, current_step_(time_step)
{
// TODO: trying to use wells struct as little as possible here, be prepared to
@ -380,10 +382,42 @@ namespace Opm
WellInterface<TypeTag>::
wsolvent() const
{
// TODO: not handling it for the moment
// TODO: it needs information from the well_ecl
// TODO: will decide on well_ecl role later.
// It can be just one member variable and no need to deal with well_ecl at all
if (!has_solvent) {
return 0.0;
}
WellInjectionProperties injection = well_ecl_->getInjectionProperties(current_step_);
if (injection.injectorType == WellInjector::GAS) {
double solvent_fraction = well_ecl_->getSolventFraction(current_step_);
return solvent_fraction;
}
assert(false);
return 0.0;
}
template<typename TypeTag>
double
WellInterface<TypeTag>::
wpolymer() const
{
if (!has_polymer) {
return 0.0;
}
WellInjectionProperties injection = well_ecl_->getInjectionProperties(current_step_);
WellPolymerProperties polymer = well_ecl_->getPolymerProperties(current_step_);
if (injection.injectorType == WellInjector::WATER) {
const double polymer_injection_concentration = polymer.m_polymerConcentration;
return polymer_injection_concentration;
}
assert(false); // TODO: find a more logical way to handle this situation
return 0.0;
}