mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-04 13:36:57 -06:00
adding const Wells* wells_ for MultisegmentWells
for interface refactoring. At the moment, both wells_ and wells_multisegment_ contain all the wells.
This commit is contained in:
parent
4180fea951
commit
718ba5470b
@ -141,7 +141,7 @@ namespace Opm {
|
||||
MultisegmentWells ms_wells_;
|
||||
|
||||
// using Base::stdWells;
|
||||
using Base::wells;
|
||||
// using Base::wells;
|
||||
using Base::wellsActive;
|
||||
using Base::updatePrimalVariableFromState;
|
||||
using Base::phaseCondition;
|
||||
|
@ -319,13 +319,13 @@ namespace Opm {
|
||||
// 2. Compute densities
|
||||
std::vector<double> cd =
|
||||
WellDensitySegmented::computeConnectionDensities(
|
||||
wells(), xw, fluid_.phaseUsage(),
|
||||
msWells().wellsStruct(), xw, fluid_.phaseUsage(),
|
||||
b_perf, rsmax_perf, rvmax_perf, surf_dens_perf);
|
||||
|
||||
// 3. Compute pressure deltas
|
||||
std::vector<double> cdp =
|
||||
WellDensitySegmented::computeConnectionPressureDelta(
|
||||
wells(), perf_cell_depth, cd, grav);
|
||||
msWells().wellsStruct(), perf_cell_depth, cd, grav);
|
||||
|
||||
// 4. Store the results
|
||||
msWells().wellPerforationDensities() = Eigen::Map<const V>(cd.data(), nperf_total); // This one is not useful for segmented wells at all
|
||||
@ -501,12 +501,7 @@ namespace Opm {
|
||||
// it is related to the segment location
|
||||
V aliveWells;
|
||||
std::vector<ADB> cq_s;
|
||||
const int nw = wellsMultiSegment().size();
|
||||
const int np = numPhases();
|
||||
const DataBlock compi = Eigen::Map<const DataBlock>(wells().comp_frac, nw, np);
|
||||
const V perf_press_diffs = msWells().wellPerforationPressureDiffs();
|
||||
msWells().computeWellFlux(state, perf_press_diffs, compi,
|
||||
mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
msWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
asImpl().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
msWells().addWellFluxEq(cq_s, state, residual_);
|
||||
asImpl().addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
@ -629,7 +624,7 @@ namespace Opm {
|
||||
SolutionState& state,
|
||||
WellState& well_state) {
|
||||
V aliveWells;
|
||||
const int np = wells().number_of_phases;
|
||||
const int np = msWells().numPhases();
|
||||
std::vector<ADB> cq_s(np, ADB::null());
|
||||
std::vector<int> indices = msWells().variableWellStateIndices();
|
||||
SolutionState state0 = state;
|
||||
@ -660,11 +655,7 @@ namespace Opm {
|
||||
SolutionState wellSolutionState = state0;
|
||||
variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
|
||||
const int nw = wellsMultiSegment().size();
|
||||
const DataBlock compi = Eigen::Map<const DataBlock>(wells().comp_frac, nw, np);
|
||||
const V perf_press_diffs = msWells().wellPerforationPressureDiffs();
|
||||
msWells().computeWellFlux(wellSolutionState, perf_press_diffs, compi,
|
||||
mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
msWells().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
|
||||
updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
|
||||
msWells().addWellFluxEq(cq_s, wellSolutionState, residual_);
|
||||
@ -701,7 +692,7 @@ namespace Opm {
|
||||
if ( terminal_output_ ) {
|
||||
std::cout << "well converged iter: " << it << std::endl;
|
||||
}
|
||||
const int nw = wells().number_of_wells;
|
||||
const int nw = msWells().numWells();
|
||||
{
|
||||
// We will set the bhp primary variable to the new ones,
|
||||
// but we do not change the derivatives here.
|
||||
|
@ -146,6 +146,7 @@ namespace Opm {
|
||||
: wells_multisegment_( createMSWellVector(wells_arg, wells_ecl, time_step) )
|
||||
, wops_ms_(wells_multisegment_)
|
||||
, num_phases_(wells_arg ? wells_arg->number_of_phases : 0)
|
||||
, wells_(wells_arg)
|
||||
, well_segment_perforation_pressure_diffs_(ADB::null())
|
||||
, well_segment_densities_(ADB::null())
|
||||
, well_segment_pressures_delta_(ADB::null())
|
||||
@ -240,6 +241,17 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
const Wells&
|
||||
MultisegmentWells::wellsStruct() const
|
||||
{
|
||||
assert(wells_ != nullptr);
|
||||
return *(wells_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const MultisegmentWells::MultisegmentWellOps&
|
||||
MultisegmentWells::wellOps() const
|
||||
{
|
||||
|
@ -95,8 +95,12 @@ namespace Opm {
|
||||
const std::vector<WellMultiSegmentConstPtr>& wells() const;
|
||||
const MultisegmentWellOps& wellOps() const;
|
||||
|
||||
const Wells& wellsStruct() const;
|
||||
|
||||
int numPhases() const { return num_phases_; };
|
||||
|
||||
int numWells() const { return wells_multisegment_.size(); }
|
||||
|
||||
int numSegment() const { return nseg_total_; };
|
||||
|
||||
int numPerf() const { return nperf_total_; };
|
||||
@ -135,8 +139,6 @@ namespace Opm {
|
||||
template <class SolutionState>
|
||||
void
|
||||
computeWellFlux(const SolutionState& state,
|
||||
const Vector& well_perforation_pressure_diffs,
|
||||
const DataBlock& compi,
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
Vector& aliveWells,
|
||||
@ -186,6 +188,12 @@ namespace Opm {
|
||||
int nseg_total_;
|
||||
int nperf_total_;
|
||||
|
||||
// TODO: put the Wells here to simplify the interface
|
||||
// TODO: at the moment, both wells_ and wells_multisegment_
|
||||
// TODO: acutally contain all the wells
|
||||
// TODO: they should be split eventually.
|
||||
const Wells* wells_;
|
||||
|
||||
const BlackoilPropsAdInterface* fluid_;
|
||||
const std::vector<bool>* active_;
|
||||
const std::vector<PhasePresence>* phase_condition_;
|
||||
|
@ -122,8 +122,6 @@ namespace Opm
|
||||
void
|
||||
MultisegmentWells::
|
||||
computeWellFlux(const SolutionState& state,
|
||||
const Vector& well_perforation_pressure_diffs,
|
||||
const DataBlock& compi,
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
Vector& aliveWells,
|
||||
@ -168,7 +166,7 @@ namespace Opm
|
||||
|
||||
// Compute drawdown.
|
||||
ADB h_nc = msperf_selector.select(well_segment_perforation_pressure_diffs_,
|
||||
ADB::constant(well_perforation_pressure_diffs));
|
||||
ADB::constant(well_perforation_pressure_diffs_));
|
||||
const Vector h_cj = msperf_selector.select(well_perforation_cell_pressure_diffs_, Vector::Zero(nperf));
|
||||
|
||||
// Special handling for when we are called from solveWellEq().
|
||||
@ -238,6 +236,8 @@ namespace Opm
|
||||
std::vector<ADB> wbq(np, ADB::null());
|
||||
ADB wbqt = ADB::constant(Vector::Zero(nseg));
|
||||
|
||||
const DataBlock compi = Eigen::Map<const DataBlock>(wellsStruct().comp_frac, nw, np);
|
||||
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
const ADB& q_ps = wellOps().p2s * cq_ps[phase];
|
||||
const ADB& q_s = subset(state.segqs, Span(nseg, 1, phase * nseg));
|
||||
|
Loading…
Reference in New Issue
Block a user