removing function allow_cross_flow() from StandardWellsDense

This commit is contained in:
Kai Bao 2017-06-28 14:22:16 +02:00
parent 229244142f
commit 9c215faade
5 changed files with 9 additions and 43 deletions

View File

@ -107,7 +107,7 @@ namespace Opm
WellState& well_state, WellState& well_state,
bool only_wells); bool only_wells);
bool crossFlowAllowed(const Simulator& ebosSimulator) const; virtual bool crossFlowAllowed(const Simulator& ebosSimulator) const;
void getMobility(const Simulator& ebosSimulator, void getMobility(const Simulator& ebosSimulator,
const int perf, const int perf,
@ -145,7 +145,6 @@ namespace Opm
using WellInterface<TypeTag>::indexOfWell; using WellInterface<TypeTag>::indexOfWell;
using WellInterface<TypeTag>::name; using WellInterface<TypeTag>::name;
using WellInterface<TypeTag>::wellType; using WellInterface<TypeTag>::wellType;
using WellInterface<TypeTag>::allowCrossFlow;
using WellInterface<TypeTag>::wellControls; using WellInterface<TypeTag>::wellControls;
using WellInterface<TypeTag>::compFrac; using WellInterface<TypeTag>::compFrac;
using WellInterface<TypeTag>::numberOfPhases; using WellInterface<TypeTag>::numberOfPhases;
@ -172,6 +171,7 @@ namespace Opm
using WellInterface<TypeTag>::first_perf_; using WellInterface<TypeTag>::first_perf_;
using WellInterface<TypeTag>::ref_depth_; using WellInterface<TypeTag>::ref_depth_;
using WellInterface<TypeTag>::perf_depth_; using WellInterface<TypeTag>::perf_depth_;
using WellInterface<TypeTag>::allow_cf_;
// densities of the fluid in each perforation // densities of the fluid in each perforation
std::vector<double> perf_densities_; std::vector<double> perf_densities_;

View File

@ -723,7 +723,7 @@ namespace Opm
StandardWell<TypeTag>:: StandardWell<TypeTag>::
crossFlowAllowed(const Simulator& ebosSimulator) const crossFlowAllowed(const Simulator& ebosSimulator) const
{ {
if (allowCrossFlow()) { if (allow_cf_) {
return true; return true;
} }

View File

@ -162,8 +162,6 @@ enum WellVariablePositions {
const int cell_idx, const int cell_idx,
std::vector<EvalWell>& mob) const; std::vector<EvalWell>& mob) const;
bool allow_cross_flow(const int w, const Simulator& ebosSimulator) const;
void localInvert(Mat& istlA) const; void localInvert(Mat& istlA) const;
void print(Mat& istlA) const; void print(Mat& istlA) const;

View File

@ -328,7 +328,7 @@ namespace Opm {
if (PolymerModule::hasPlyshlog()) { if (PolymerModule::hasPlyshlog()) {
// compute the well water velocity with out shear effects. // compute the well water velocity with out shear effects.
const int numComp = numComponents(); const int numComp = numComponents();
bool allow_cf = allow_cross_flow(w, ebosSimulator); const bool allow_cf = well_container_[w]->crossFlowAllowed(ebosSimulator);
const EvalWell& bhp = getBhp(w); const EvalWell& bhp = getBhp(w);
std::vector<EvalWell> cq_s(numComp,0.0); std::vector<EvalWell> cq_s(numComp,0.0);
computeWellFlux(w, wells().WI[perf], intQuants, mob, bhp, wellPerforationPressureDiffs()[perf], allow_cf, cq_s); computeWellFlux(w, wells().WI[perf], intQuants, mob, bhp, wellPerforationPressureDiffs()[perf], allow_cf, cq_s);
@ -364,42 +364,6 @@ namespace Opm {
template<typename TypeTag>
bool
StandardWellsDense<TypeTag>::
allow_cross_flow(const int w, const Simulator& ebosSimulator) const
{
if (wells().allow_cf[w]) {
return true;
}
// check for special case where all perforations have cross flow
// then the wells must allow for cross flow
for (int perf = wells().well_connpos[w] ; perf < wells().well_connpos[w+1]; ++perf) {
const int cell_idx = wells().well_cells[perf];
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_idx, /*timeIdx=*/0));
const auto& fs = intQuants.fluidState();
EvalWell pressure = extendEval(fs.pressure(FluidSystem::oilPhaseIdx));
EvalWell bhp = getBhp(w);
// Pressure drawdown (also used to determine direction of flow)
EvalWell well_pressure = bhp + wellPerforationPressureDiffs()[perf];
EvalWell drawdown = pressure - well_pressure;
if (drawdown.value() < 0 && wells().type[w] == INJECTOR) {
return false;
}
if (drawdown.value() > 0 && wells().type[w] == PRODUCER) {
return false;
}
}
return true;
}
template<typename TypeTag> template<typename TypeTag>
void void
@ -2254,7 +2218,7 @@ namespace Opm {
const int numComp = numComponents(); const int numComp = numComponents();
well_flux.resize(np, 0.0); well_flux.resize(np, 0.0);
const bool allow_cf = allow_cross_flow(well_index, ebosSimulator); const bool allow_cf = well_container_[well_index]->crossFlowAllowed(ebosSimulator);
for (int perf = wells().well_connpos[well_index]; perf < wells().well_connpos[well_index + 1]; ++perf) { for (int perf = wells().well_connpos[well_index]; perf < wells().well_connpos[well_index + 1]; ++perf) {
const int cell_index = wells().well_cells[perf]; const int cell_index = wells().well_cells[perf];
const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_index, /*timeIdx=*/ 0)); const auto& intQuants = *(ebosSimulator.model().cachedIntensiveQuantities(cell_index, /*timeIdx=*/ 0));

View File

@ -135,8 +135,12 @@ namespace Opm
int numComponents() const; int numComponents() const;
// simply returning allow_cf_
// TODO: to check whether needed, it causes name problem with the crossFlowAllowed
bool allowCrossFlow() const; bool allowCrossFlow() const;
virtual bool crossFlowAllowed(const Simulator& ebosSimulator) const = 0;
// TODO: for this kind of function, maybe can make a function with parameter perf // TODO: for this kind of function, maybe can make a function with parameter perf
const std::vector<int>& saturationTableNumber() const; const std::vector<int>& saturationTableNumber() const;