mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
reducing paramter list for more functions in StandardWells
computeWellFlux updateWellState updateWellControls addWellControlEq computeWellPotentials
This commit is contained in:
parent
a35c3e7468
commit
1f2442fe80
@ -774,7 +774,7 @@ namespace detail {
|
||||
// get reasonable initial conditions for the wells
|
||||
// asImpl().updateWellControls(well_state);
|
||||
// asImpl().stdWells().updateWellControls(well_state);
|
||||
asImpl().stdWells().updateWellControls(fluid_.phaseUsage(), gravity, vfp_properties_, terminal_output_, active_, well_state);
|
||||
asImpl().stdWells().updateWellControls(gravity, vfp_properties_, terminal_output_, well_state);
|
||||
|
||||
// Create the primary variables.
|
||||
SolutionState state = asImpl().variableState(reservoir_state, well_state);
|
||||
@ -817,17 +817,16 @@ namespace detail {
|
||||
}
|
||||
V aliveWells;
|
||||
std::vector<ADB> cq_s;
|
||||
asImpl().stdWells().computeWellFlux(state, fluid_.phaseUsage(), active_, mob_perfcells, b_perfcells, aliveWells, 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().addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
asImpl().stdWells().addWellControlEq(state, well_state, aliveWells, active_, vfp_properties_, gravity, residual_);
|
||||
asImpl().stdWells().addWellControlEq(state, well_state, aliveWells, vfp_properties_, gravity, residual_);
|
||||
// asImpl().computeWellPotentials(state, mob_perfcells, b_perfcells, well_state);
|
||||
{
|
||||
SolutionState state0 = state;
|
||||
asImpl().makeConstantState(state0);
|
||||
asImpl().stdWells().computeWellPotentials(state0, mob_perfcells, b_perfcells,
|
||||
fluid_.phaseUsage(), active_, vfp_properties_,
|
||||
asImpl().stdWells().computeWellPotentials(state0, mob_perfcells, b_perfcells, vfp_properties_,
|
||||
param_.compute_well_potentials_, gravity, well_state);
|
||||
}
|
||||
|
||||
@ -1072,11 +1071,11 @@ namespace detail {
|
||||
|
||||
SolutionState wellSolutionState = state0;
|
||||
asImpl().variableStateExtractWellsVars(indices, vars, wellSolutionState);
|
||||
asImpl().stdWells().computeWellFlux(wellSolutionState, fluid_.phaseUsage(), active_, mob_perfcells_const, b_perfcells_const, aliveWells, cq_s);
|
||||
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,
|
||||
active_, vfp_properties_, gravity, residual_);
|
||||
vfp_properties_, gravity, residual_);
|
||||
converged = getWellConvergence(it);
|
||||
|
||||
if (converged) {
|
||||
@ -1100,8 +1099,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(), gravity, dpMaxRel(), fluid_.phaseUsage(), active_, vfp_properties_, well_state);
|
||||
asImpl().stdWells(). updateWellControls(fluid_.phaseUsage(), gravity, vfp_properties_, terminal_output_, active_, well_state);
|
||||
asImpl().stdWells().updateWellState(dx.array(), gravity, dpMaxRel(), vfp_properties_, well_state);
|
||||
asImpl().stdWells().updateWellControls(gravity, vfp_properties_, terminal_output_, well_state);
|
||||
}
|
||||
} while (it < 15);
|
||||
|
||||
@ -2333,8 +2332,8 @@ namespace detail {
|
||||
WellState& well_state)
|
||||
{
|
||||
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
||||
asImpl().stdWells().updateWellState(dwells, gravity, dpMaxRel(), fluid_.phaseUsage(),
|
||||
active_, vfp_properties_, well_state);
|
||||
asImpl().stdWells().updateWellState(dwells, gravity, dpMaxRel(),
|
||||
vfp_properties_, well_state);
|
||||
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,6 @@ namespace Opm {
|
||||
|
||||
template <class SolutionState>
|
||||
void computeWellFlux(const SolutionState& state,
|
||||
const Opm::PhaseUsage& phase_usage,
|
||||
const std::vector<bool>& active,
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
Vector& aliveWells,
|
||||
@ -127,17 +125,13 @@ namespace Opm {
|
||||
void updateWellState(const Vector& dwells,
|
||||
const double gravity,
|
||||
const double dpmaxrel,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const std::vector<bool>& active,
|
||||
const VFPProperties& vfp_properties,
|
||||
WellState& well_state);
|
||||
|
||||
template <class WellState>
|
||||
void updateWellControls(const Opm::PhaseUsage& pu,
|
||||
const double gravity,
|
||||
void updateWellControls(const double gravity,
|
||||
const VFPProperties& vfp_properties,
|
||||
const bool terminal_output,
|
||||
const std::vector<bool>& active,
|
||||
WellState& xw) const;
|
||||
|
||||
// TODO: should LinearisedBlackoilResidual also be a template class?
|
||||
@ -151,7 +145,6 @@ namespace Opm {
|
||||
void addWellControlEq(const SolutionState& state,
|
||||
const WellState& xw,
|
||||
const Vector& aliveWells,
|
||||
const std::vector<bool> active,
|
||||
const VFPProperties& vfp_properties,
|
||||
const double gravity,
|
||||
LinearisedBlackoilResidual& residual);
|
||||
@ -168,8 +161,6 @@ namespace Opm {
|
||||
computeWellPotentials(SolutionState& state0,
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const std::vector<bool> active,
|
||||
const VFPProperties& vfp_properties,
|
||||
const bool compute_well_potentials,
|
||||
const bool gravity,
|
||||
|
@ -356,8 +356,6 @@ namespace Opm
|
||||
void
|
||||
StandardWells::
|
||||
computeWellFlux(const SolutionState& state,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const std::vector<bool>& active,
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
Vector& aliveWells,
|
||||
@ -365,7 +363,7 @@ namespace Opm
|
||||
{
|
||||
if( ! localWellsActive() ) return ;
|
||||
|
||||
const int np = wells().number_of_phases;
|
||||
const int np = num_phases_;
|
||||
const int nw = wells().number_of_wells;
|
||||
const int nperf = wells().well_connpos[nw];
|
||||
Vector Tw = Eigen::Map<const Vector>(wells().WI, nperf);
|
||||
@ -422,7 +420,8 @@ namespace Opm
|
||||
const ADB cq_p = -(selectProducingPerforations * Tw) * (mob_perfcells[phase] * drawdown);
|
||||
cq_ps[phase] = b_perfcells[phase] * cq_p;
|
||||
}
|
||||
if (active[Oil] && active[Gas]) {
|
||||
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
||||
if (active_[Oil] && active_[Gas]) {
|
||||
const int oilpos = pu.phase_pos[Oil];
|
||||
const int gaspos = pu.phase_pos[Gas];
|
||||
const ADB cq_psOil = cq_ps[oilpos];
|
||||
@ -469,12 +468,12 @@ namespace Opm
|
||||
// compute volume ratio between connection at standard conditions
|
||||
ADB volumeRatio = ADB::constant(Vector::Zero(nperf));
|
||||
|
||||
if (active[Water]) {
|
||||
if (active_[Water]) {
|
||||
const int watpos = pu.phase_pos[Water];
|
||||
volumeRatio += cmix_s[watpos] / b_perfcells[watpos];
|
||||
}
|
||||
|
||||
if (active[Oil] && active[Gas]) {
|
||||
if (active_[Oil] && active_[Gas]) {
|
||||
// Incorporate RS/RV factors if both oil and gas active
|
||||
const ADB& rv_perfcells = subset(state.rv, well_cells);
|
||||
const ADB& rs_perfcells = subset(state.rs, well_cells);
|
||||
@ -490,11 +489,11 @@ namespace Opm
|
||||
volumeRatio += tmp_gas / b_perfcells[gaspos];
|
||||
}
|
||||
else {
|
||||
if (active[Oil]) {
|
||||
if (active_[Oil]) {
|
||||
const int oilpos = pu.phase_pos[Oil];
|
||||
volumeRatio += cmix_s[oilpos] / b_perfcells[oilpos];
|
||||
}
|
||||
if (active[Gas]) {
|
||||
if (active_[Gas]) {
|
||||
const int gaspos = pu.phase_pos[Gas];
|
||||
volumeRatio += cmix_s[gaspos] / b_perfcells[gaspos];
|
||||
}
|
||||
@ -563,15 +562,13 @@ namespace Opm
|
||||
updateWellState(const Vector& dwells,
|
||||
const double gravity,
|
||||
const double dpmaxrel,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const std::vector<bool>& active,
|
||||
const VFPProperties& vfp_properties,
|
||||
WellState& well_state)
|
||||
{
|
||||
if( localWellsActive() )
|
||||
{
|
||||
// TODO: these parameter should be stored in the StandardWells class
|
||||
const int np = wells().number_of_phases;
|
||||
const int np = num_phases_;
|
||||
const int nw = wells().number_of_wells;
|
||||
|
||||
// Extract parts of dwells corresponding to each part.
|
||||
@ -599,6 +596,8 @@ namespace Opm
|
||||
const Vector bhp = bhp_old - dbhp_limited;
|
||||
std::copy(&bhp[0], &bhp[0] + bhp.size(), well_state.bhp().begin());
|
||||
|
||||
|
||||
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
||||
//Loop over all wells
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
@ -613,13 +612,13 @@ namespace Opm
|
||||
double liquid = 0.0;
|
||||
double vapour = 0.0;
|
||||
|
||||
if (active[ Water ]) {
|
||||
if (active_[ Water ]) {
|
||||
aqua = wr[w*np + pu.phase_pos[ Water ] ];
|
||||
}
|
||||
if (active[ Oil ]) {
|
||||
if (active_[ Oil ]) {
|
||||
liquid = wr[w*np + pu.phase_pos[ Oil ] ];
|
||||
}
|
||||
if (active[ Gas ]) {
|
||||
if (active_[ Gas ]) {
|
||||
vapour = wr[w*np + pu.phase_pos[ Gas ] ];
|
||||
}
|
||||
|
||||
@ -660,11 +659,9 @@ namespace Opm
|
||||
template <class WellState>
|
||||
void
|
||||
StandardWells::
|
||||
updateWellControls(const Opm::PhaseUsage& pu,
|
||||
const double gravity,
|
||||
updateWellControls(const double gravity,
|
||||
const VFPProperties& vfp_properties,
|
||||
const bool terminal_output,
|
||||
const std::vector<bool>& active,
|
||||
WellState& xw) const
|
||||
{
|
||||
if( !localWellsActive() ) return ;
|
||||
@ -726,13 +723,15 @@ namespace Opm
|
||||
double liquid = 0.0;
|
||||
double vapour = 0.0;
|
||||
|
||||
if (active[ Water ]) {
|
||||
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
||||
|
||||
if (active_[ Water ]) {
|
||||
aqua = xw.wellRates()[w*np + pu.phase_pos[ Water ] ];
|
||||
}
|
||||
if (active[ Oil ]) {
|
||||
if (active_[ Oil ]) {
|
||||
liquid = xw.wellRates()[w*np + pu.phase_pos[ Oil ] ];
|
||||
}
|
||||
if (active[ Gas ]) {
|
||||
if (active_[ Gas ]) {
|
||||
vapour = xw.wellRates()[w*np + pu.phase_pos[ Gas ] ];
|
||||
}
|
||||
|
||||
@ -846,7 +845,6 @@ namespace Opm
|
||||
StandardWells::addWellControlEq(const SolutionState& state,
|
||||
const WellState& xw,
|
||||
const Vector& aliveWells,
|
||||
const std::vector<bool> active,
|
||||
const VFPProperties& vfp_properties,
|
||||
const double gravity,
|
||||
LinearisedBlackoilResidual& residual)
|
||||
@ -860,13 +858,13 @@ namespace Opm
|
||||
ADB liquid = ADB::constant(Vector::Zero(nw));
|
||||
ADB vapour = ADB::constant(Vector::Zero(nw));
|
||||
|
||||
if (active[Water]) {
|
||||
if (active_[Water]) {
|
||||
aqua += subset(state.qs, Span(nw, 1, BlackoilPhases::Aqua*nw));
|
||||
}
|
||||
if (active[Oil]) {
|
||||
if (active_[Oil]) {
|
||||
liquid += subset(state.qs, Span(nw, 1, BlackoilPhases::Liquid*nw));
|
||||
}
|
||||
if (active[Gas]) {
|
||||
if (active_[Gas]) {
|
||||
vapour += subset(state.qs, Span(nw, 1, BlackoilPhases::Vapour*nw));
|
||||
}
|
||||
|
||||
@ -1017,8 +1015,6 @@ namespace Opm
|
||||
StandardWells::computeWellPotentials(SolutionState& state0,
|
||||
const std::vector<ADB>& mob_perfcells,
|
||||
const std::vector<ADB>& b_perfcells,
|
||||
const Opm::PhaseUsage& pu,
|
||||
const std::vector<bool> active,
|
||||
const VFPProperties& vfp_properties,
|
||||
const bool compute_well_potentials,
|
||||
const bool gravity,
|
||||
@ -1028,6 +1024,8 @@ namespace Opm
|
||||
if (compute_well_potentials) {
|
||||
const int nw = wells().number_of_wells;
|
||||
const int np = wells().number_of_phases;
|
||||
const Opm::PhaseUsage& pu = fluid_.phaseUsage();
|
||||
|
||||
Vector bhps = Vector::Zero(nw);
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
const WellControls* ctrl = wells().ctrls[w];
|
||||
@ -1046,13 +1044,13 @@ namespace Opm
|
||||
double liquid = 0.0;
|
||||
double vapour = 0.0;
|
||||
|
||||
if (active[ Water ]) {
|
||||
if (active_[ Water ]) {
|
||||
aqua = well_state.wellRates()[w*np + pu.phase_pos[ Water ] ];
|
||||
}
|
||||
if (active[ Oil ]) {
|
||||
if (active_[ Oil ]) {
|
||||
liquid = well_state.wellRates()[w*np + pu.phase_pos[ Oil ] ];
|
||||
}
|
||||
if (active[ Gas ]) {
|
||||
if (active_[ Gas ]) {
|
||||
vapour = well_state.wellRates()[w*np + pu.phase_pos[ Gas ] ];
|
||||
}
|
||||
|
||||
@ -1098,7 +1096,7 @@ namespace Opm
|
||||
// compute well potentials
|
||||
Vector aliveWells;
|
||||
std::vector<ADB> well_potentials;
|
||||
computeWellFlux(state0, pu, active, mob_perfcells, b_perfcells, aliveWells, well_potentials);
|
||||
computeWellFlux(state0, mob_perfcells, b_perfcells, aliveWells, well_potentials);
|
||||
|
||||
// store well potentials in the well state
|
||||
// transform to a single vector instead of separate vectors pr phase
|
||||
|
@ -501,7 +501,7 @@ namespace Opm {
|
||||
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
||||
const V depth = cellCentroidsZToEigen(grid_);
|
||||
// updateWellControls(well_state);
|
||||
stdWells().updateWellControls(fluid_.phaseUsage(), gravity, vfp_properties_, terminal_output_, active_, well_state);
|
||||
stdWells().updateWellControls(gravity, vfp_properties_, terminal_output_, well_state);
|
||||
|
||||
// Create the primary variables.
|
||||
SolutionState state = variableState(reservoir_state, well_state);
|
||||
@ -554,7 +554,7 @@ namespace Opm {
|
||||
Base::solveWellEq(mob_perfcells, b_perfcells, state, well_state);
|
||||
}
|
||||
|
||||
stdWells().computeWellFlux(state, fluid_.phaseUsage(), active_, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
stdWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
|
||||
if (has_plyshlog_) {
|
||||
std::vector<double> water_vel_wells;
|
||||
@ -573,11 +573,11 @@ namespace Opm {
|
||||
mob_perfcells[water_pos] = mob_perfcells[water_pos] / shear_mult_wells_adb;
|
||||
}
|
||||
|
||||
stdWells().computeWellFlux(state, fluid_.phaseUsage(), active_, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
stdWells().computeWellFlux(state, mob_perfcells, b_perfcells, aliveWells, cq_s);
|
||||
stdWells().updatePerfPhaseRatesAndPressures(cq_s, state, well_state);
|
||||
stdWells().addWellFluxEq(cq_s, state, residual_);
|
||||
addWellContributionToMassBalanceEq(cq_s, state, well_state);
|
||||
stdWells().addWellControlEq(state, well_state, aliveWells, active_, vfp_properties_, gravity, residual_);
|
||||
stdWells().addWellControlEq(state, well_state, aliveWells, vfp_properties_, gravity, residual_);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user