mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
moving variableStateExtractWellsVars() from models to Well Models.
This commit is contained in:
parent
fbe7143f54
commit
879f127ae8
@ -365,11 +365,6 @@ namespace Opm {
|
||||
const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars) const;
|
||||
|
||||
void
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const;
|
||||
|
||||
void
|
||||
computeAccum(const SolutionState& state,
|
||||
const int aix );
|
||||
|
@ -668,7 +668,7 @@ namespace detail {
|
||||
}
|
||||
}
|
||||
// wells
|
||||
asImpl().variableStateExtractWellsVars(indices, vars, state);
|
||||
asImpl().wellModel().variableStateExtractWellsVars(indices, vars, state);
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -676,24 +676,6 @@ namespace detail {
|
||||
|
||||
|
||||
|
||||
template <class Grid, class WellModel, class Implementation>
|
||||
void
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const
|
||||
{
|
||||
// Qs.
|
||||
state.qs = std::move(vars[indices[Qs]]);
|
||||
|
||||
// Bhp.
|
||||
state.bhp = std::move(vars[indices[Bhp]]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class Grid, class WellModel, class Implementation>
|
||||
void
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::
|
||||
@ -1024,7 +1006,7 @@ namespace detail {
|
||||
std::vector<ADB> vars = ADB::variables(vars0);
|
||||
|
||||
SolutionState wellSolutionState = state0;
|
||||
asImpl().variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
asImpl().wellModel().variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
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_);
|
||||
|
@ -173,11 +173,6 @@ namespace Opm {
|
||||
void
|
||||
makeConstantState(SolutionState& state) const;
|
||||
|
||||
void
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const;
|
||||
|
||||
// TODO: added since the interfaces of the function are different
|
||||
// TODO: for StandardWells and MultisegmentWells
|
||||
void
|
||||
|
@ -125,43 +125,6 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
template <class Grid>
|
||||
void
|
||||
BlackoilMultiSegmentModel<Grid>::variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const
|
||||
{
|
||||
// TODO: using the original Qs for the segment rates for now, to be fixed eventually.
|
||||
// TODO: using the original Bhp for the segment pressures for now, to be fixed eventually.
|
||||
|
||||
// segment phase rates in surface volume
|
||||
state.segqs = std::move(vars[indices[Qs]]);
|
||||
|
||||
// segment pressures
|
||||
state.segp = std::move(vars[indices[Bhp]]);
|
||||
|
||||
// The qs and bhp are no longer primary variables, but could
|
||||
// still be used in computations. They are identical to the
|
||||
// pressures and flows of the top segments.
|
||||
const int np = numPhases();
|
||||
const int ns = state.segp.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, 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, wellModel().topWellSegments());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class Grid>
|
||||
void
|
||||
BlackoilMultiSegmentModel<Grid>::
|
||||
|
@ -241,7 +241,7 @@ namespace Opm {
|
||||
}
|
||||
}
|
||||
// wells
|
||||
Base::variableStateExtractWellsVars(indices, vars, state);
|
||||
wellModel().variableStateExtractWellsVars(indices, vars, state);
|
||||
return state;
|
||||
|
||||
}
|
||||
|
@ -201,6 +201,13 @@ namespace Opm {
|
||||
void
|
||||
variableStateWellIndices(std::vector<int>& indices,
|
||||
int& next) const;
|
||||
|
||||
template <class SolutionState>
|
||||
void
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const;
|
||||
|
||||
std::vector<int>
|
||||
variableWellStateIndices() const;
|
||||
|
||||
|
@ -1122,6 +1122,44 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
template <class SolutionState>
|
||||
void
|
||||
MultisegmentWells::
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const
|
||||
{
|
||||
// TODO: using the original Qs for the segment rates for now, to be fixed eventually.
|
||||
// TODO: using the original Bhp for the segment pressures for now, to be fixed eventually.
|
||||
|
||||
// segment phase rates in surface volume
|
||||
state.segqs = std::move(vars[indices[Qs]]);
|
||||
|
||||
// segment pressures
|
||||
state.segp = std::move(vars[indices[Bhp]]);
|
||||
|
||||
// The qs and bhp are no longer primary variables, but could
|
||||
// still be used in computations. They are identical to the
|
||||
// pressures and flows of the top segments.
|
||||
const int np = num_phases_;
|
||||
const int ns = nseg_total_;
|
||||
const int nw = numWells();
|
||||
state.qs = ADB::constant(Vector::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, 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, topWellSegments());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class WellState>
|
||||
void
|
||||
MultisegmentWells::
|
||||
|
@ -143,12 +143,16 @@ namespace Opm {
|
||||
SolutionState& state0,
|
||||
WellState& well_state);
|
||||
|
||||
template <class SolutionState>
|
||||
void
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const;
|
||||
|
||||
void
|
||||
variableStateWellIndices(std::vector<int>& indices,
|
||||
int& next) const;
|
||||
|
||||
|
||||
std::vector<int>
|
||||
variableWellStateIndices() const;
|
||||
|
||||
|
@ -1137,6 +1137,24 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
template <class SolutionState>
|
||||
void
|
||||
StandardWells::
|
||||
variableStateExtractWellsVars(const std::vector<int>& indices,
|
||||
std::vector<ADB>& vars,
|
||||
SolutionState& state) const
|
||||
{
|
||||
// Qs.
|
||||
state.qs = std::move(vars[indices[Qs]]);
|
||||
|
||||
// Bhp.
|
||||
state.bhp = std::move(vars[indices[Bhp]]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::vector<int>
|
||||
StandardWells::variableWellStateIndices() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user