mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-11 09:55:34 -06:00
using well_model_ to represent the WellModel member
This commit is contained in:
parent
06775ee02c
commit
184bff95ba
@ -295,7 +295,7 @@ namespace Opm {
|
||||
std::vector<PhasePresence> phaseCondition_;
|
||||
|
||||
// Well Model
|
||||
WellModel std_wells_;
|
||||
WellModel well_model_;
|
||||
|
||||
V isRs_;
|
||||
V isRv_;
|
||||
@ -331,17 +331,17 @@ namespace Opm {
|
||||
}
|
||||
|
||||
/// return the WellModel object
|
||||
WellModel& stdWells() { return std_wells_; }
|
||||
const WellModel& stdWells() const { return std_wells_; }
|
||||
WellModel& wellModel() { return well_model_; }
|
||||
const WellModel& wellModel() const { return well_model_; }
|
||||
|
||||
/// return the Well struct in the WellModel
|
||||
const Wells& wells() const { return std_wells_.wells(); }
|
||||
const Wells& wells() const { return well_model_.wells(); }
|
||||
|
||||
/// return true if wells are available in the reservoir
|
||||
bool wellsActive() const { return std_wells_.wellsActive(); }
|
||||
bool wellsActive() const { return well_model_.wellsActive(); }
|
||||
|
||||
/// return true if wells are available on this process
|
||||
bool localWellsActive() const { return std_wells_.localWellsActive(); }
|
||||
bool localWellsActive() const { return well_model_.localWellsActive(); }
|
||||
|
||||
int numWellVars() const;
|
||||
|
||||
|
@ -191,7 +191,7 @@ namespace detail {
|
||||
, use_threshold_pressure_(false)
|
||||
, rq_ (fluid.numPhases())
|
||||
, phaseCondition_(AutoDiffGrid::numCells(grid))
|
||||
, std_wells_ (well_model)
|
||||
, well_model_ (well_model)
|
||||
, isRs_(V::Zero(AutoDiffGrid::numCells(grid)))
|
||||
, isRv_(V::Zero(AutoDiffGrid::numCells(grid)))
|
||||
, isSg_(V::Zero(AutoDiffGrid::numCells(grid)))
|
||||
@ -219,11 +219,11 @@ namespace detail {
|
||||
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
||||
const V depth = Opm::AutoDiffGrid::cellCentroidsZToEigen(grid_);
|
||||
|
||||
std_wells_.init(&fluid_, &active_, &phaseCondition_, &vfp_properties_, gravity, depth);
|
||||
well_model_.init(&fluid_, &active_, &phaseCondition_, &vfp_properties_, gravity, depth);
|
||||
|
||||
// TODO: put this for now to avoid modify the following code.
|
||||
// TODO: this code is fragile.
|
||||
const Wells* wells_arg = &(asImpl().std_wells_.wells());
|
||||
const Wells* wells_arg = &(asImpl().well_model_.wells());
|
||||
|
||||
#if HAVE_MPI
|
||||
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
|
||||
@ -237,7 +237,7 @@ namespace detail {
|
||||
int local_number_of_wells = localWellsActive() ? wells().number_of_wells : 0;
|
||||
int global_number_of_wells = info.communicator().sum(local_number_of_wells);
|
||||
const bool wells_active = ( wells_arg && global_number_of_wells > 0 );
|
||||
stdWells().setWellsActive(wells_active);
|
||||
wellModel().setWellsActive(wells_active);
|
||||
// Compute the global number of cells
|
||||
std::vector<int> v( Opm::AutoDiffGrid::numCells(grid_), 1);
|
||||
global_nc_ = 0;
|
||||
@ -245,7 +245,7 @@ namespace detail {
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
stdWells().setWellsActive( localWellsActive() );
|
||||
wellModel().setWellsActive( localWellsActive() );
|
||||
global_nc_ = Opm::AutoDiffGrid::numCells(grid_);
|
||||
}
|
||||
}
|
||||
@ -465,7 +465,7 @@ namespace detail {
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::numWellVars() const
|
||||
{
|
||||
// For each well, we have a bhp variable, and one flux per phase.
|
||||
const int nw = stdWells().localWellsActive() ? wells().number_of_wells : 0;
|
||||
const int nw = wellModel().localWellsActive() ? wells().number_of_wells : 0;
|
||||
return (numPhases() + 1) * nw;
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ namespace detail {
|
||||
// and bhp and Q for the wells
|
||||
vars0.reserve(np + 1);
|
||||
variableReservoirStateInitials(x, vars0);
|
||||
asImpl().stdWells().variableWellStateInitials(xw, vars0);
|
||||
asImpl().wellModel().variableWellStateInitials(xw, vars0);
|
||||
return vars0;
|
||||
}
|
||||
|
||||
@ -595,7 +595,7 @@ namespace detail {
|
||||
if (active_[Gas]) {
|
||||
indices[Xvar] = next++;
|
||||
}
|
||||
asImpl().stdWells().variableStateWellIndices(indices, next);
|
||||
asImpl().wellModel().variableStateWellIndices(indices, next);
|
||||
assert(next == fluid_.numPhases() + 2);
|
||||
return indices;
|
||||
}
|
||||
@ -775,14 +775,14 @@ namespace detail {
|
||||
asImpl().makeConstantState(state0);
|
||||
// asImpl().computeWellConnectionPressures(state0, well_state);
|
||||
// Extract well connection depths.
|
||||
asImpl().stdWells().computeWellConnectionPressures(state0, well_state);
|
||||
asImpl().wellModel().computeWellConnectionPressures(state0, well_state);
|
||||
}
|
||||
|
||||
// Possibly switch well controls and updating well state to
|
||||
// get reasonable initial conditions for the wells
|
||||
// asImpl().updateWellControls(well_state);
|
||||
// asImpl().stdWells().updateWellControls(well_state);
|
||||
asImpl().stdWells().updateWellControls(terminal_output_, well_state);
|
||||
// asImpl().wellModel().updateWellControls(well_state);
|
||||
asImpl().wellModel().updateWellControls(terminal_output_, well_state);
|
||||
|
||||
// Create the primary variables.
|
||||
SolutionState state = asImpl().variableState(reservoir_state, well_state);
|
||||
@ -795,7 +795,7 @@ namespace detail {
|
||||
// and well connection pressures.
|
||||
asImpl().computeAccum(state0, 0);
|
||||
// asImpl().computeWellConnectionPressures(state0, well_state);
|
||||
asImpl().stdWells().computeWellConnectionPressures(state0, well_state);
|
||||
asImpl().wellModel().computeWellConnectionPressures(state0, well_state);
|
||||
}
|
||||
|
||||
// OPM_AD_DISKVAL(state.pressure);
|
||||
@ -818,23 +818,23 @@ namespace detail {
|
||||
|
||||
std::vector<ADB> mob_perfcells;
|
||||
std::vector<ADB> b_perfcells;
|
||||
asImpl().stdWells().extractWellPerfProperties(state, rq_, mob_perfcells, b_perfcells);
|
||||
asImpl().wellModel().extractWellPerfProperties(state, rq_, mob_perfcells, b_perfcells);
|
||||
if (param_.solve_welleq_initially_ && initial_assembly) {
|
||||
// solve the well equations as a pre-processing step
|
||||
asImpl().solveWellEq(mob_perfcells, b_perfcells, state, well_state);
|
||||
}
|
||||
V aliveWells;
|
||||
std::vector<ADB> cq_s;
|
||||
asImpl().stdWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
asImpl().stdWells().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
asImpl().stdWells().addWellFluxEq(cq_s, state, residual_);
|
||||
asImpl().wellModel().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
asImpl().wellModel().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
asImpl().wellModel().addWellFluxEq(cq_s, state, residual_);
|
||||
asImpl().addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
asImpl().stdWells().addWellControlEq(state, well_state, aliveWells, residual_);
|
||||
asImpl().wellModel().addWellControlEq(state, well_state, aliveWells, residual_);
|
||||
// asImpl().computeWellPotentials(state, mob_perfcells, b_perfcells, well_state);
|
||||
{
|
||||
SolutionState state0 = state;
|
||||
asImpl().makeConstantState(state0);
|
||||
asImpl().stdWells().computeWellPotentials(state0, mob_perfcells, b_perfcells, vfp_properties_,
|
||||
asImpl().wellModel().computeWellPotentials(state0, mob_perfcells, b_perfcells, vfp_properties_,
|
||||
param_.compute_well_potentials_, gravity, well_state);
|
||||
}
|
||||
|
||||
@ -963,7 +963,7 @@ namespace detail {
|
||||
const int nc = Opm::AutoDiffGrid::numCells(grid_);
|
||||
const int np = asImpl().numPhases();
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
residual_.material_balance_eq[phase] -= superset(cq_s[phase], stdWells().wellOps().well_cells, nc);
|
||||
residual_.material_balance_eq[phase] -= superset(cq_s[phase], wellModel().wellOps().well_cells, nc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1018,7 +1018,7 @@ namespace detail {
|
||||
V aliveWells;
|
||||
const int np = wells().number_of_phases;
|
||||
std::vector<ADB> cq_s(np, ADB::null());
|
||||
std::vector<int> indices = asImpl().stdWells().variableWellStateIndices();
|
||||
std::vector<int> indices = asImpl().wellModel().variableWellStateIndices();
|
||||
SolutionState state0 = state;
|
||||
WellState well_state0 = well_state;
|
||||
asImpl().makeConstantState(state0);
|
||||
@ -1041,15 +1041,15 @@ namespace detail {
|
||||
// bhp and Q for the wells
|
||||
std::vector<V> vars0;
|
||||
vars0.reserve(2);
|
||||
asImpl().stdWells().variableWellStateInitials(well_state, vars0);
|
||||
asImpl().wellModel().variableWellStateInitials(well_state, vars0);
|
||||
std::vector<ADB> vars = ADB::variables(vars0);
|
||||
|
||||
SolutionState wellSolutionState = state0;
|
||||
asImpl().variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
asImpl().stdWells().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
asImpl().stdWells().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
|
||||
asImpl().stdWells().addWellFluxEq(cq_s, wellSolutionState, residual_);
|
||||
asImpl().stdWells().addWellControlEq(wellSolutionState, well_state, aliveWells, residual_);
|
||||
asImpl().wellModel().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
asImpl().wellModel().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
|
||||
asImpl().wellModel().addWellFluxEq(cq_s, wellSolutionState, residual_);
|
||||
asImpl().wellModel().addWellControlEq(wellSolutionState, well_state, aliveWells, residual_);
|
||||
converged = getWellConvergence(it);
|
||||
|
||||
if (converged) {
|
||||
@ -1073,8 +1073,8 @@ namespace detail {
|
||||
const Eigen::VectorXd& dx = solver.solve(total_residual_v.matrix());
|
||||
assert(dx.size() == total_residual_v.size());
|
||||
// asImpl().updateWellState(dx.array(), well_state);
|
||||
asImpl().stdWells().updateWellState(dx.array(), dpMaxRel(), well_state);
|
||||
asImpl().stdWells().updateWellControls(terminal_output_, well_state);
|
||||
asImpl().wellModel().updateWellState(dx.array(), dpMaxRel(), well_state);
|
||||
asImpl().wellModel().updateWellControls(terminal_output_, well_state);
|
||||
}
|
||||
} while (it < 15);
|
||||
|
||||
@ -1103,7 +1103,7 @@ namespace detail {
|
||||
}
|
||||
// asImpl().computeWellConnectionPressures(state, well_state);
|
||||
const ADB::V depth = Opm::AutoDiffGrid::cellCentroidsZToEigen(grid_);
|
||||
asImpl().stdWells().computeWellConnectionPressures(state, well_state);
|
||||
asImpl().wellModel().computeWellConnectionPressures(state, well_state);
|
||||
}
|
||||
|
||||
if (!converged) {
|
||||
@ -1463,7 +1463,7 @@ namespace detail {
|
||||
|
||||
// TODO: gravity should be stored as a member
|
||||
// const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
||||
// asImpl().stdWells().updateWellState(dwells, gravity, dpMaxRel(), fluid_.phaseUsage(), active_, vfp_properties_, well_state);
|
||||
// asImpl().wellModel().updateWellState(dwells, gravity, dpMaxRel(), fluid_.phaseUsage(), active_, vfp_properties_, well_state);
|
||||
asImpl().updateWellState(dwells,well_state);
|
||||
|
||||
// Update phase conditions used for property calculations.
|
||||
@ -2305,7 +2305,7 @@ namespace detail {
|
||||
updateWellState(const V& dwells,
|
||||
WellState& well_state)
|
||||
{
|
||||
asImpl().stdWells().updateWellState(dwells, dpMaxRel(), well_state);
|
||||
asImpl().wellModel().updateWellState(dwells, dpMaxRel(), well_state);
|
||||
|
||||
}
|
||||
|
||||
|
@ -137,10 +137,11 @@ namespace Opm {
|
||||
using Base::linsolver_;
|
||||
using Base::phaseCondition_;
|
||||
using Base::vfp_properties_;
|
||||
using Base::well_model_;
|
||||
|
||||
MultisegmentWells ms_wells_;
|
||||
|
||||
// using Base::stdWells;
|
||||
using Base::wellModel;
|
||||
// using Base::wells;
|
||||
using Base::wellsActive;
|
||||
using Base::updatePrimalVariableFromState;
|
||||
@ -160,13 +161,10 @@ namespace Opm {
|
||||
using Base::asImpl;
|
||||
using Base::variableReservoirStateInitials;
|
||||
|
||||
// TODO: fixing the confusing naming
|
||||
const MultisegmentWells& msWells() const { return ms_wells_; }
|
||||
MultisegmentWells& msWells() { return ms_wells_; }
|
||||
|
||||
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return msWells().msWells(); }
|
||||
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return well_model_.msWells(); }
|
||||
|
||||
const MultisegmentWells::MultisegmentWellOps& msWellOps() const { return msWells().wellOps(); }
|
||||
const MultisegmentWells::MultisegmentWellOps& msWellOps() const { return well_model_.wellOps(); }
|
||||
|
||||
// TODO: kept for now. to be removed soon.
|
||||
void updateWellState(const V& dwells,
|
||||
|
@ -99,7 +99,7 @@ namespace Opm {
|
||||
const int nw = wellsMultiSegment().size();
|
||||
|
||||
if ( !msWellOps().has_multisegment_wells ) {
|
||||
msWells().segVDt() = V::Zero(nw);
|
||||
wellModel().segVDt() = V::Zero(nw);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ namespace Opm {
|
||||
segment_volume.insert(segment_volume.end(), segment_volume_well.begin(), segment_volume_well.end());
|
||||
}
|
||||
assert(int(segment_volume.size()) == nseg_total);
|
||||
msWells().segVDt() = Eigen::Map<V>(segment_volume.data(), nseg_total) / dt;
|
||||
wellModel().segVDt() = Eigen::Map<V>(segment_volume.data(), nseg_total) / dt;
|
||||
}
|
||||
|
||||
|
||||
@ -165,17 +165,17 @@ namespace Opm {
|
||||
// pressures and flows of the top segments.
|
||||
const int np = numPhases();
|
||||
const int ns = state.segp.size();
|
||||
const int nw = msWells().topWellSegments().size();
|
||||
const int nw = wellModel().topWellSegments().size();
|
||||
state.qs = ADB::constant(ADB::V::Zero(np*nw));
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
// Extract segment fluxes for this phase (ns consecutive elements).
|
||||
ADB segqs_phase = subset(state.segqs, Span(ns, 1, ns*phase));
|
||||
// Extract top segment fluxes (= well fluxes)
|
||||
ADB wellqs_phase = subset(segqs_phase, msWells().topWellSegments());
|
||||
ADB wellqs_phase = subset(segqs_phase, wellModel().topWellSegments());
|
||||
// Expand to full size of qs (which contains all phases) and add.
|
||||
state.qs += superset(wellqs_phase, Span(nw, 1, nw*phase), nw*np);
|
||||
}
|
||||
state.bhp = subset(state.segp, msWells().topWellSegments());
|
||||
state.bhp = subset(state.segp, wellModel().topWellSegments());
|
||||
}
|
||||
|
||||
|
||||
@ -204,7 +204,7 @@ namespace Opm {
|
||||
|
||||
// Possibly switch well controls and updating well state to
|
||||
// get reasonable initial conditions for the wells
|
||||
msWells().updateWellControls(terminal_output_, well_state);
|
||||
wellModel().updateWellControls(terminal_output_, well_state);
|
||||
|
||||
// Create the primary variables.
|
||||
SolutionState state = asImpl().variableState(reservoir_state, well_state);
|
||||
@ -216,11 +216,11 @@ namespace Opm {
|
||||
// Compute initial accumulation contributions
|
||||
// and well connection pressures.
|
||||
asImpl().computeAccum(state0, 0);
|
||||
msWells().computeSegmentFluidProperties(state0);
|
||||
wellModel().computeSegmentFluidProperties(state0);
|
||||
const int np = numPhases();
|
||||
assert(np == int(msWells().segmentCompSurfVolumeInitial().size()));
|
||||
assert(np == int(wellModel().segmentCompSurfVolumeInitial().size()));
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
msWells().segmentCompSurfVolumeInitial()[phase] = msWells().segmentCompSurfVolumeCurrent()[phase].value();
|
||||
wellModel().segmentCompSurfVolumeInitial()[phase] = wellModel().segmentCompSurfVolumeCurrent()[phase].value();
|
||||
}
|
||||
|
||||
const std::vector<ADB> kr_adb = Base::computeRelPerm(state0);
|
||||
@ -230,7 +230,7 @@ namespace Opm {
|
||||
const int canonicalPhaseIdx = canph_[phaseIdx];
|
||||
fluid_density[phaseIdx] = fluidDensity(canonicalPhaseIdx, rq_[phaseIdx].b, state0.rs, state0.rv);
|
||||
}
|
||||
msWells().computeWellConnectionPressures(state0, well_state, kr_adb, fluid_density);
|
||||
wellModel().computeWellConnectionPressures(state0, well_state, kr_adb, fluid_density);
|
||||
// asImpl().computeWellConnectionPressures(state0, well_state);
|
||||
}
|
||||
|
||||
@ -253,15 +253,15 @@ namespace Opm {
|
||||
}
|
||||
|
||||
// asImpl().computeSegmentFluidProperties(state);
|
||||
msWells().computeSegmentFluidProperties(state);
|
||||
wellModel().computeSegmentFluidProperties(state);
|
||||
|
||||
// asImpl().computeSegmentPressuresDelta(state);
|
||||
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
||||
msWells().computeSegmentPressuresDelta(gravity);
|
||||
wellModel().computeSegmentPressuresDelta(gravity);
|
||||
|
||||
std::vector<ADB> mob_perfcells;
|
||||
std::vector<ADB> b_perfcells;
|
||||
msWells().extractWellPerfProperties(state, rq_, mob_perfcells, b_perfcells);
|
||||
wellModel().extractWellPerfProperties(state, rq_, mob_perfcells, b_perfcells);
|
||||
if (param_.solve_welleq_initially_ && initial_assembly) {
|
||||
// solve the well equations as a pre-processing step
|
||||
asImpl().solveWellEq(mob_perfcells, b_perfcells, state, well_state);
|
||||
@ -271,12 +271,12 @@ namespace Opm {
|
||||
// it is related to the segment location
|
||||
V aliveWells;
|
||||
std::vector<ADB> cq_s;
|
||||
msWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
msWells().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
msWells().addWellFluxEq(cq_s, state, residual_);
|
||||
wellModel().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
wellModel().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
wellModel().addWellFluxEq(cq_s, state, residual_);
|
||||
asImpl().addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
// asImpl().addWellControlEq(state, well_state, aliveWells);
|
||||
msWells().addWellControlEq(state, well_state, aliveWells, residual_);
|
||||
wellModel().addWellControlEq(state, well_state, aliveWells, residual_);
|
||||
}
|
||||
|
||||
|
||||
@ -324,7 +324,7 @@ namespace Opm {
|
||||
const int canonicalPhaseIdx = canph_[phaseIdx];
|
||||
fluid_density[phaseIdx] = fluidDensity(canonicalPhaseIdx, rq_[phaseIdx].b, state.rs, state.rv);
|
||||
}
|
||||
msWells().computeWellConnectionPressures(state, well_state, kr_adb, fluid_density);
|
||||
wellModel().computeWellConnectionPressures(state, well_state, kr_adb, fluid_density);
|
||||
// asImpl().computeWellConnectionPressures(state, well_state);
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ namespace Opm {
|
||||
BlackoilMultiSegmentModel<Grid>::updateWellState(const V& dwells,
|
||||
WellState& well_state)
|
||||
{
|
||||
msWells().updateWellState(dwells, dpMaxRel(), well_state);
|
||||
wellModel().updateWellState(dwells, dpMaxRel(), well_state);
|
||||
}
|
||||
|
||||
|
||||
@ -355,9 +355,9 @@ namespace Opm {
|
||||
SolutionState& state,
|
||||
WellState& well_state) {
|
||||
V aliveWells;
|
||||
const int np = msWells().numPhases();
|
||||
const int np = wellModel().numPhases();
|
||||
std::vector<ADB> cq_s(np, ADB::null());
|
||||
std::vector<int> indices = msWells().variableWellStateIndices();
|
||||
std::vector<int> indices = wellModel().variableWellStateIndices();
|
||||
SolutionState state0 = state;
|
||||
WellState well_state0 = well_state;
|
||||
makeConstantState(state0);
|
||||
@ -380,18 +380,18 @@ namespace Opm {
|
||||
// bhp and Q for the wells
|
||||
std::vector<V> vars0;
|
||||
vars0.reserve(2);
|
||||
msWells().variableWellStateInitials(well_state, vars0);
|
||||
wellModel().variableWellStateInitials(well_state, vars0);
|
||||
std::vector<ADB> vars = ADB::variables(vars0);
|
||||
|
||||
SolutionState wellSolutionState = state0;
|
||||
variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
|
||||
msWells().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
wellModel().computeWellFlux(wellSolutionState, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
|
||||
msWells().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
|
||||
msWells().addWellFluxEq(cq_s, wellSolutionState, residual_);
|
||||
wellModel().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
|
||||
wellModel().addWellFluxEq(cq_s, wellSolutionState, residual_);
|
||||
// addWellControlEq(wellSolutionState, well_state, aliveWells);
|
||||
msWells().addWellControlEq(wellSolutionState, well_state, aliveWells, residual_);
|
||||
wellModel().addWellControlEq(wellSolutionState, well_state, aliveWells, residual_);
|
||||
converged = Base::getWellConvergence(it);
|
||||
|
||||
if (converged) {
|
||||
@ -415,7 +415,7 @@ namespace Opm {
|
||||
const Eigen::VectorXd& dx = solver.solve(total_residual_v.matrix());
|
||||
assert(dx.size() == total_residual_v.size());
|
||||
asImpl().updateWellState(dx.array(), well_state);
|
||||
msWells().updateWellControls(terminal_output_, well_state);
|
||||
wellModel().updateWellControls(terminal_output_, well_state);
|
||||
}
|
||||
} while (it < 15);
|
||||
|
||||
@ -423,7 +423,7 @@ namespace Opm {
|
||||
if ( terminal_output_ ) {
|
||||
std::cout << "well converged iter: " << it << std::endl;
|
||||
}
|
||||
const int nw = msWells().numWells();
|
||||
const int nw = wellModel().numWells();
|
||||
{
|
||||
// We will set the bhp primary variable to the new ones,
|
||||
// but we do not change the derivatives here.
|
||||
@ -450,7 +450,7 @@ namespace Opm {
|
||||
const int canonicalPhaseIdx = canph_[phaseIdx];
|
||||
fluid_density[phaseIdx] = fluidDensity(canonicalPhaseIdx, rq_[phaseIdx].b, state.rs, state.rv);
|
||||
}
|
||||
msWells().computeWellConnectionPressures(state, well_state, kr_adb, fluid_density);
|
||||
wellModel().computeWellConnectionPressures(state, well_state, kr_adb, fluid_density);
|
||||
// computeWellConnectionPressures(state, well_state);
|
||||
}
|
||||
|
||||
@ -480,7 +480,7 @@ namespace Opm {
|
||||
// and bhp and Q for the wells
|
||||
vars0.reserve(np + 1);
|
||||
variableReservoirStateInitials(x, vars0);
|
||||
msWells().variableWellStateInitials(xw, vars0);
|
||||
wellModel().variableWellStateInitials(xw, vars0);
|
||||
return vars0;
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ namespace Opm {
|
||||
// --------- Protected methods ---------
|
||||
|
||||
// Need to declare Base members we want to use here.
|
||||
using Base::stdWells;
|
||||
using Base::wellModel;
|
||||
using Base::wells;
|
||||
using Base::variableState;
|
||||
using Base::computeGasPressure;
|
||||
|
@ -100,7 +100,8 @@ namespace Opm {
|
||||
Base::material_name_.push_back("Solvent");
|
||||
assert(solvent_pos_ == fluid_.numPhases());
|
||||
residual_.matbalscale.resize(fluid_.numPhases() + 1, 0.0031); // use the same as gas
|
||||
stdWells().initSolvent(&solvent_props_, solvent_pos_, has_solvent_);
|
||||
|
||||
wellModel().initSolvent(&solvent_props_, solvent_pos_, has_solvent_);
|
||||
}
|
||||
if (is_miscible_) {
|
||||
mu_eff_.resize(fluid_.numPhases() + 1, ADB::null());
|
||||
|
@ -179,7 +179,7 @@ namespace Opm {
|
||||
// --------- Protected methods ---------
|
||||
|
||||
// Need to declare Base members we want to use here.
|
||||
using Base::stdWells;
|
||||
using Base::wellModel;
|
||||
using Base::wells;
|
||||
using Base::wellsActive;
|
||||
using Base::variableState;
|
||||
|
@ -499,7 +499,7 @@ namespace Opm {
|
||||
// Possibly switch well controls and updating well state to
|
||||
// get reasonable initial conditions for the wells
|
||||
// updateWellControls(well_state);
|
||||
stdWells().updateWellControls(terminal_output_, well_state);
|
||||
wellModel().updateWellControls(terminal_output_, well_state);
|
||||
|
||||
// Create the primary variables.
|
||||
SolutionState state = variableState(reservoir_state, well_state);
|
||||
@ -512,7 +512,7 @@ namespace Opm {
|
||||
// and well connection pressures.
|
||||
computeAccum(state0, 0);
|
||||
// computeWellConnectionPressures(state0, well_state);
|
||||
stdWells().computeWellConnectionPressures(state0, well_state);
|
||||
wellModel().computeWellConnectionPressures(state0, well_state);
|
||||
}
|
||||
|
||||
// OPM_AD_DISKVAL(state.pressure);
|
||||
@ -552,7 +552,7 @@ namespace Opm {
|
||||
Base::solveWellEq(mob_perfcells, b_perfcells, state, well_state);
|
||||
}
|
||||
|
||||
stdWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
wellModel().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
|
||||
if (has_plyshlog_) {
|
||||
std::vector<double> water_vel_wells;
|
||||
@ -571,11 +571,11 @@ namespace Opm {
|
||||
mob_perfcells[water_pos] = mob_perfcells[water_pos] / shear_mult_wells_adb;
|
||||
}
|
||||
|
||||
stdWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
stdWells().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
stdWells().addWellFluxEq(cq_s, state, residual_);
|
||||
wellModel().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
wellModel().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
wellModel().addWellFluxEq(cq_s, state, residual_);
|
||||
addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
stdWells().addWellControlEq(state, well_state, aliveWells, residual_);
|
||||
wellModel().addWellControlEq(state, well_state, aliveWells, residual_);
|
||||
}
|
||||
|
||||
|
||||
@ -734,8 +734,8 @@ namespace Opm {
|
||||
ADB b_perfcells = subset(rq_[water_pos].b, well_cells);
|
||||
|
||||
const ADB& p_perfcells = subset(state.pressure, well_cells);
|
||||
const V& cdp = stdWells().wellPerforationPressureDiffs();
|
||||
const ADB perfpressure = (stdWells().wellOps().w2p * state.bhp) + cdp;
|
||||
const V& cdp = wellModel().wellPerforationPressureDiffs();
|
||||
const ADB perfpressure = (wellModel().wellOps().w2p * state.bhp) + cdp;
|
||||
// Pressure drawdown (also used to determine direction of flow)
|
||||
const ADB drawdown = p_perfcells - perfpressure;
|
||||
|
||||
|
@ -71,6 +71,8 @@ namespace Opm
|
||||
template <class GridT>
|
||||
class SimulatorFullyImplicitCompressiblePolymer;
|
||||
|
||||
class StandardWells;
|
||||
|
||||
template <class GridT>
|
||||
struct SimulatorTraits<SimulatorFullyImplicitCompressiblePolymer<GridT> >
|
||||
{
|
||||
@ -79,6 +81,7 @@ namespace Opm
|
||||
typedef BlackoilOutputWriter OutputWriter;
|
||||
typedef GridT Grid;
|
||||
typedef FullyImplicitCompressiblePolymerSolver Solver;
|
||||
typedef StandardWells WellModel;
|
||||
/// Dummy class, this Solver does not use a Model.
|
||||
struct Model
|
||||
{
|
||||
@ -94,6 +97,7 @@ namespace Opm
|
||||
typedef SimulatorFullyImplicitCompressiblePolymer ThisType;
|
||||
typedef SimulatorBase<ThisType> BaseType;
|
||||
typedef typename BaseType::Solver Solver;
|
||||
typedef typename BaseType::WellModel WellModel;
|
||||
|
||||
public:
|
||||
/// Initialise from parameters and objects to observe.
|
||||
@ -109,7 +113,7 @@ namespace Opm
|
||||
NewtonIterationBlackoilInterface& linsolver,
|
||||
const double* gravity);
|
||||
|
||||
std::unique_ptr<Solver> createSolver(const Wells* wells);
|
||||
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
|
||||
|
||||
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||
WellsManager& wells_manager,
|
||||
|
@ -57,7 +57,7 @@ SimulatorFullyImplicitCompressiblePolymer(const parameter::ParameterGroup& param
|
||||
|
||||
template <class GridT>
|
||||
auto SimulatorFullyImplicitCompressiblePolymer<GridT>::
|
||||
createSolver(const Wells* wells)
|
||||
createSolver(const WellModel& well_model)
|
||||
-> std::unique_ptr<Solver>
|
||||
{
|
||||
return std::unique_ptr<Solver>(new Solver(BaseType::grid_,
|
||||
@ -65,7 +65,9 @@ createSolver(const Wells* wells)
|
||||
BaseType::geo_,
|
||||
BaseType::rock_comp_props_,
|
||||
polymer_props_,
|
||||
*wells,
|
||||
// *wells,
|
||||
// TODO: it is resulted from refactoring of other simulators.
|
||||
well_model.wells(),
|
||||
BaseType::solver_));
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ BOOST_AUTO_TEST_CASE(testStructure)
|
||||
BOOST_CHECK_EQUAL(nperf, ms_wells->numPerf());
|
||||
|
||||
BOOST_CHECK_EQUAL(nw, ms_wells->topWellSegments().size());
|
||||
BOOST_CHECK_EQUAL(nw, ms_wells->wells().size());
|
||||
BOOST_CHECK_EQUAL(nw, ms_wells->msWells().size());
|
||||
BOOST_CHECK_EQUAL(0, ms_wells->topWellSegments()[0]);
|
||||
BOOST_CHECK_EQUAL(1, ms_wells->topWellSegments()[1]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user