mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 18:50:19 -06:00
moving addWellFluxEq() to StandardWells
Conflicts: opm/autodiff/BlackoilModelBase_impl.hpp
This commit is contained in:
parent
ef05a64a88
commit
eb278c3c9a
@ -410,13 +410,6 @@ namespace Opm {
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
WellState& well_state);
|
||||
|
||||
|
||||
void
|
||||
addWellFluxEq(const std::vector<ADB>& cq_s,
|
||||
const SolutionState& state);
|
||||
|
||||
void
|
||||
addWellContributionToMassBalanceEq(const std::vector<ADB>& cq_s,
|
||||
const SolutionState& state,
|
||||
const WellState& xw);
|
||||
|
@ -901,7 +901,7 @@ namespace detail {
|
||||
std::vector<ADB> cq_s;
|
||||
asImpl().stdWells().computeWellFlux(state, fluid_.phaseUsage(), active_, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
asImpl().stdWells().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
asImpl().addWellFluxEq(cq_s, state);
|
||||
asImpl().stdWells().addWellFluxEq(cq_s, state, residual_);
|
||||
asImpl().addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
asImpl().addWellControlEq(state, well_state, aliveWells);
|
||||
asImpl().computeWellPotentials(state, mob_perfcells, b_perfcells, well_state);
|
||||
@ -1069,34 +1069,6 @@ namespace detail {
|
||||
|
||||
|
||||
|
||||
template <class Grid, class WellModel, class Implementation>
|
||||
void
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::
|
||||
addWellFluxEq(const std::vector<ADB>& cq_s,
|
||||
const SolutionState& state)
|
||||
{
|
||||
if( !asImpl().localWellsActive() )
|
||||
{
|
||||
// If there are no wells in the subdomain of the proces then
|
||||
// cq_s has zero size and will cause a segmentation fault below.
|
||||
return;
|
||||
}
|
||||
|
||||
const int np = wells().number_of_phases;
|
||||
const int nw = wells().number_of_wells;
|
||||
ADB qs = state.qs;
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
qs -= superset(stdWells().wellOps().p2w * cq_s[phase], Span(nw, 1, phase*nw), nw*np);
|
||||
|
||||
}
|
||||
|
||||
residual_.well_flux_eq = qs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class Grid, class WellModel, class Implementation>
|
||||
bool
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::
|
||||
@ -1174,7 +1146,7 @@ namespace detail {
|
||||
asImpl().variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
asImpl().stdWells().computeWellFlux(wellSolutionState, fluid_.phaseUsage(), active_, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
asImpl().stdWells().updatePerfPhaseRatesAndPressures(cq_s, wellSolutionState, well_state);
|
||||
asImpl().addWellFluxEq(cq_s, wellSolutionState);
|
||||
asImpl().stdWells().addWellFluxEq(cq_s, wellSolutionState, residual_);
|
||||
asImpl().addWellControlEq(wellSolutionState, well_state, aliveWells);
|
||||
converged = getWellConvergence(it);
|
||||
|
||||
|
@ -141,6 +141,13 @@ namespace Opm {
|
||||
const std::vector<bool>& active,
|
||||
WellState& xw) const;
|
||||
|
||||
// TODO: should LinearisedBlackoilResidual also be a template class?
|
||||
template <class SolutionState>
|
||||
void addWellFluxEq(const std::vector<ADB>& cq_s,
|
||||
const SolutionState& state,
|
||||
LinearisedBlackoilResidual& residual);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
bool wells_active_;
|
||||
|
@ -778,4 +778,33 @@ namespace Opm
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class SolutionState>
|
||||
void
|
||||
StandardWells::
|
||||
addWellFluxEq(const std::vector<ADB>& cq_s,
|
||||
const SolutionState& state,
|
||||
LinearisedBlackoilResidual& residual)
|
||||
{
|
||||
if( !localWellsActive() )
|
||||
{
|
||||
// If there are no wells in the subdomain of the proces then
|
||||
// cq_s has zero size and will cause a segmentation fault below.
|
||||
return;
|
||||
}
|
||||
|
||||
const int np = wells().number_of_phases;
|
||||
const int nw = wells().number_of_wells;
|
||||
ADB qs = state.qs;
|
||||
for (int phase = 0; phase < np; ++phase) {
|
||||
qs -= superset(wellOps().p2w * cq_s[phase], Span(nw, 1, phase*nw), nw*np);
|
||||
|
||||
}
|
||||
|
||||
residual.well_flux_eq = qs;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ namespace Opm {
|
||||
|
||||
stdWells().computeWellFlux(state, fluid_.phaseUsage(), active_, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
stdWells().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
Base::addWellFluxEq(cq_s, state);
|
||||
stdWells().addWellFluxEq(cq_s, state, residual_);
|
||||
addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
addWellControlEq(state, well_state, aliveWells);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user