mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
cleaning up some interface in WellInterface.
This commit is contained in:
@@ -92,14 +92,6 @@ namespace Opm
|
|||||||
|
|
||||||
StandardWell(const Well* well, const int time_step, const Wells* wells);
|
StandardWell(const Well* well, const int time_step, const Wells* wells);
|
||||||
|
|
||||||
/// the densities of the fluid in each perforation
|
|
||||||
virtual const std::vector<double>& perfDensities() const;
|
|
||||||
virtual std::vector<double>& perfDensities();
|
|
||||||
|
|
||||||
/// the pressure difference between different perforations
|
|
||||||
virtual const std::vector<double>& perfPressureDiffs() const;
|
|
||||||
virtual std::vector<double>& perfPressureDiffs();
|
|
||||||
|
|
||||||
virtual void setWellVariables(const WellState& well_state);
|
virtual void setWellVariables(const WellState& well_state);
|
||||||
|
|
||||||
EvalWell wellVolumeFractionScaled(const int phase) const;
|
EvalWell wellVolumeFractionScaled(const int phase) const;
|
||||||
|
|||||||
@@ -100,54 +100,6 @@ namespace Opm
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
const std::vector<double>&
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
perfDensities() const
|
|
||||||
{
|
|
||||||
return perf_densities_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
std::vector<double>&
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
perfDensities()
|
|
||||||
{
|
|
||||||
return perf_densities_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
const std::vector<double>&
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
perfPressureDiffs() const
|
|
||||||
{
|
|
||||||
return perf_pressure_diffs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
|
||||||
std::vector<double>&
|
|
||||||
StandardWell<TypeTag>::
|
|
||||||
perfPressureDiffs()
|
|
||||||
{
|
|
||||||
return perf_pressure_diffs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void StandardWell<TypeTag>::
|
void StandardWell<TypeTag>::
|
||||||
setWellVariables(const WellState& well_state)
|
setWellVariables(const WellState& well_state)
|
||||||
@@ -631,7 +583,7 @@ namespace Opm
|
|||||||
std::vector<EvalWell> cq_s(numComp,0.0);
|
std::vector<EvalWell> cq_s(numComp,0.0);
|
||||||
std::vector<EvalWell> mob(numComp, 0.0);
|
std::vector<EvalWell> mob(numComp, 0.0);
|
||||||
getMobility(ebosSimulator, perf, mob);
|
getMobility(ebosSimulator, perf, mob);
|
||||||
computePerfRate(intQuants, mob, wellIndex()[perf], bhp, perfPressureDiffs()[perf], allow_cf, cq_s);
|
computePerfRate(intQuants, mob, wellIndex()[perf], bhp, perf_pressure_diffs_[perf], allow_cf, cq_s);
|
||||||
|
|
||||||
for (int componentIdx = 0; componentIdx < numComp; ++componentIdx) {
|
for (int componentIdx = 0; componentIdx < numComp; ++componentIdx) {
|
||||||
// the cq_s entering mass balance equations need to consider the efficiency factors.
|
// the cq_s entering mass balance equations need to consider the efficiency factors.
|
||||||
@@ -693,7 +645,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store the perforation pressure for later usage.
|
// Store the perforation pressure for later usage.
|
||||||
well_state.perfPress()[first_perf_ + perf] = well_state.bhp()[indexOfWell()] + perfPressureDiffs()[perf];
|
well_state.perfPress()[first_perf_ + perf] = well_state.bhp()[indexOfWell()] + perf_pressure_diffs_[perf];
|
||||||
}
|
}
|
||||||
|
|
||||||
// add vol * dF/dt + Q to the well equations;
|
// add vol * dF/dt + Q to the well equations;
|
||||||
@@ -740,7 +692,7 @@ namespace Opm
|
|||||||
EvalWell bhp = getBhp();
|
EvalWell bhp = getBhp();
|
||||||
|
|
||||||
// Pressure drawdown (also used to determine direction of flow)
|
// Pressure drawdown (also used to determine direction of flow)
|
||||||
EvalWell well_pressure = bhp + perfPressureDiffs()[perf];
|
EvalWell well_pressure = bhp + perf_pressure_diffs_[perf];
|
||||||
EvalWell drawdown = pressure - well_pressure;
|
EvalWell drawdown = pressure - well_pressure;
|
||||||
|
|
||||||
if (drawdown.value() < 0 && wellType() == INJECTOR) {
|
if (drawdown.value() < 0 && wellType() == INJECTOR) {
|
||||||
@@ -821,7 +773,7 @@ namespace Opm
|
|||||||
const bool allow_cf = crossFlowAllowed(ebosSimulator);
|
const bool allow_cf = crossFlowAllowed(ebosSimulator);
|
||||||
const EvalWell& bhp = getBhp();
|
const EvalWell& bhp = getBhp();
|
||||||
std::vector<EvalWell> cq_s(numComp,0.0);
|
std::vector<EvalWell> cq_s(numComp,0.0);
|
||||||
computePerfRate(intQuants, mob, wellIndex()[perf], bhp, perfPressureDiffs()[perf], allow_cf, cq_s);
|
computePerfRate(intQuants, mob, wellIndex()[perf], bhp, perf_pressure_diffs_[perf], allow_cf, cq_s);
|
||||||
// TODO: make area a member
|
// TODO: make area a member
|
||||||
double area = 2 * M_PI * perf_rep_radius_[perf] * perf_length_[perf];
|
double area = 2 * M_PI * perf_rep_radius_[perf] * perf_length_[perf];
|
||||||
const auto& materialLawManager = ebosSimulator.problem().materialLawManager();
|
const auto& materialLawManager = ebosSimulator.problem().materialLawManager();
|
||||||
@@ -2005,7 +1957,7 @@ namespace Opm
|
|||||||
std::vector<EvalWell> cq_s(numComp, 0.0);
|
std::vector<EvalWell> cq_s(numComp, 0.0);
|
||||||
std::vector<EvalWell> mob(numComp, 0.0);
|
std::vector<EvalWell> mob(numComp, 0.0);
|
||||||
getMobility(ebosSimulator, perf, mob);
|
getMobility(ebosSimulator, perf, mob);
|
||||||
computePerfRate(intQuants, mob, wellIndex()[perf], bhp, perfPressureDiffs()[perf], allow_cf, cq_s);
|
computePerfRate(intQuants, mob, wellIndex()[perf], bhp, perf_pressure_diffs_[perf], allow_cf, cq_s);
|
||||||
|
|
||||||
for(int p = 0; p < np; ++p) {
|
for(int p = 0; p < np; ++p) {
|
||||||
well_flux[p] += cq_s[p].value();
|
well_flux[p] += cq_s[p].value();
|
||||||
|
|||||||
@@ -85,52 +85,23 @@ namespace Opm
|
|||||||
static const bool has_polymer = GET_PROP_VALUE(TypeTag, EnablePolymer);
|
static const bool has_polymer = GET_PROP_VALUE(TypeTag, EnablePolymer);
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
// TODO: Well can be reference.
|
|
||||||
WellInterface(const Well* well, const int time_step, const Wells* wells);
|
WellInterface(const Well* well, const int time_step, const Wells* wells);
|
||||||
|
|
||||||
/// Well name.
|
/// Well name.
|
||||||
const std::string& name() const;
|
const std::string& name() const;
|
||||||
|
|
||||||
/// The index of the well in Wells struct
|
|
||||||
// It is used to locate the inforation in Wells and also WellState for now.
|
|
||||||
int indexOfWell() const;
|
|
||||||
|
|
||||||
/// Well type, INJECTOR or PRODUCER.
|
/// Well type, INJECTOR or PRODUCER.
|
||||||
WellType wellType() const;
|
WellType wellType() const;
|
||||||
|
|
||||||
/// number of phases
|
|
||||||
int numberOfPhases() const;
|
|
||||||
|
|
||||||
/// Component fractions for each phase for the well
|
|
||||||
const std::vector<double>& compFrac() const;
|
|
||||||
|
|
||||||
/// Well controls
|
/// Well controls
|
||||||
// TODO: later to see whether we need to return const.
|
|
||||||
WellControls* wellControls() const;
|
WellControls* wellControls() const;
|
||||||
|
|
||||||
/// Number of the perforations
|
/// Number of the perforations
|
||||||
int numberOfPerforations() const;
|
int numberOfPerforations() const;
|
||||||
|
|
||||||
/// Well productivity index for each perforation.
|
|
||||||
const std::vector<double>& wellIndex() const;
|
|
||||||
|
|
||||||
/// Depth of perforations
|
/// Depth of perforations
|
||||||
const std::vector<double>& perfDepth() const;
|
const std::vector<double>& perfDepth() const;
|
||||||
|
|
||||||
/// Indices of the grid cells/blocks that perforations are completed within.
|
|
||||||
const std::vector<int>& wellCells() const;
|
|
||||||
|
|
||||||
// TODO: the following function should be able to be removed by refactoring the well class
|
|
||||||
// It is probably only needed for StandardWell
|
|
||||||
/// the densities of the fluid in each perforation
|
|
||||||
virtual const std::vector<double>& perfDensities() const = 0;
|
|
||||||
virtual std::vector<double>& perfDensities() = 0;
|
|
||||||
|
|
||||||
/// the pressure difference between different perforations
|
|
||||||
virtual const std::vector<double>& perfPressureDiffs() const = 0;
|
|
||||||
virtual std::vector<double>& perfPressureDiffs() = 0;
|
|
||||||
|
|
||||||
// TODO: the parameters need to be optimized/adjusted
|
|
||||||
virtual void init(const PhaseUsage* phase_usage_arg,
|
virtual void init(const PhaseUsage* phase_usage_arg,
|
||||||
const std::vector<bool>* active_arg,
|
const std::vector<bool>* active_arg,
|
||||||
const VFPProperties* vfp_properties_arg,
|
const VFPProperties* vfp_properties_arg,
|
||||||
@@ -138,9 +109,59 @@ namespace Opm
|
|||||||
const double gravity_arg,
|
const double gravity_arg,
|
||||||
const int num_cells);
|
const int num_cells);
|
||||||
|
|
||||||
// TODO: temporary
|
|
||||||
virtual void setWellVariables(const WellState& well_state) = 0;
|
virtual void setWellVariables(const WellState& well_state) = 0;
|
||||||
|
|
||||||
|
virtual bool getWellConvergence(Simulator& ebosSimulator,
|
||||||
|
const std::vector<double>& B_avg,
|
||||||
|
const ModelParameters& param) const = 0;
|
||||||
|
|
||||||
|
virtual void wellEqIteration(Simulator& ebosSimulator,
|
||||||
|
const ModelParameters& param,
|
||||||
|
WellState& well_state) = 0;
|
||||||
|
|
||||||
|
virtual void assembleWellEq(Simulator& ebosSimulator,
|
||||||
|
const double dt,
|
||||||
|
WellState& well_state,
|
||||||
|
bool only_wells) = 0;
|
||||||
|
|
||||||
|
void updateListEconLimited(const WellState& well_state,
|
||||||
|
DynamicListEconLimited& list_econ_limited) const;
|
||||||
|
|
||||||
|
void setWellEfficiencyFactor(const double efficiency_factor);
|
||||||
|
|
||||||
|
void computeRepRadiusPerfLength(const Grid& grid, const std::map<int, int>& cartesian_to_compressed);
|
||||||
|
|
||||||
|
// using the solution x to recover the solution xw for wells and applying
|
||||||
|
// xw to update Well State
|
||||||
|
virtual void applySolutionWellState(const BVector& x, const ModelParameters& param,
|
||||||
|
WellState& well_state) const = 0;
|
||||||
|
|
||||||
|
// Ax = Ax - C D^-1 B x
|
||||||
|
virtual void apply(const BVector& x, BVector& Ax) const = 0;
|
||||||
|
|
||||||
|
// r = r - C D^-1 Rw
|
||||||
|
virtual void apply(BVector& r) const = 0;
|
||||||
|
|
||||||
|
virtual void computeWellPotentials(const Simulator& ebosSimulator,
|
||||||
|
const WellState& well_state,
|
||||||
|
std::vector<double>& well_potentials) const = 0;
|
||||||
|
|
||||||
|
virtual void computeAccumWell() = 0;
|
||||||
|
|
||||||
|
// TODO: it should come with a different name
|
||||||
|
// for MS well, the definition is different and should not use this name anymore
|
||||||
|
virtual void computeWellConnectionPressures(const Simulator& ebosSimulator,
|
||||||
|
const WellState& xw) = 0;
|
||||||
|
|
||||||
|
virtual void updateWellStateWithTarget(const int current,
|
||||||
|
WellState& xw) const = 0;
|
||||||
|
|
||||||
|
virtual void updateWellControl(WellState& xw) const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Indices of the grid cells/blocks that perforations are completed within.
|
||||||
|
const std::vector<int>& wellCells() const;
|
||||||
|
|
||||||
const std::vector<bool>& active() const;
|
const std::vector<bool>& active() const;
|
||||||
|
|
||||||
const PhaseUsage& phaseUsage() const;
|
const PhaseUsage& phaseUsage() const;
|
||||||
@@ -153,6 +174,10 @@ namespace Opm
|
|||||||
|
|
||||||
int numPhases() const;
|
int numPhases() const;
|
||||||
|
|
||||||
|
// number of phases
|
||||||
|
int numberOfPhases() const;
|
||||||
|
|
||||||
|
// TODO: it is dumplicated with StandardWellsDense
|
||||||
int numComponents() const;
|
int numComponents() const;
|
||||||
|
|
||||||
// simply returning allow_cf_
|
// simply returning allow_cf_
|
||||||
@@ -168,58 +193,9 @@ namespace Opm
|
|||||||
|
|
||||||
double wpolymer() const;
|
double wpolymer() const;
|
||||||
|
|
||||||
virtual bool getWellConvergence(Simulator& ebosSimulator,
|
|
||||||
const std::vector<double>& B_avg,
|
|
||||||
const ModelParameters& param) const = 0;
|
|
||||||
|
|
||||||
virtual void wellEqIteration(Simulator& ebosSimulator,
|
|
||||||
const ModelParameters& param,
|
|
||||||
WellState& well_state) = 0;
|
|
||||||
|
|
||||||
virtual void assembleWellEq(Simulator& ebosSimulator,
|
|
||||||
const double dt,
|
|
||||||
WellState& well_state,
|
|
||||||
bool only_wells) = 0;
|
|
||||||
|
|
||||||
virtual void updateWellStateWithTarget(const int current,
|
|
||||||
WellState& xw) const = 0;
|
|
||||||
|
|
||||||
virtual void updateWellControl(WellState& xw) const = 0;
|
|
||||||
|
|
||||||
virtual void computeAccumWell() = 0;
|
|
||||||
|
|
||||||
// TODO: it should come with a different name
|
|
||||||
// for MS well, the definition is different and should not use this name anymore
|
|
||||||
virtual void computeWellConnectionPressures(const Simulator& ebosSimulator,
|
|
||||||
const WellState& xw) = 0;
|
|
||||||
|
|
||||||
// Ax = Ax - C D^-1 B x
|
|
||||||
virtual void apply(const BVector& x, BVector& Ax) const = 0;
|
|
||||||
|
|
||||||
// r = r - C D^-1 Rw
|
|
||||||
virtual void apply(BVector& r) const = 0;
|
|
||||||
|
|
||||||
// using the solution x to recover the solution xw for wells and applying
|
|
||||||
// xw to update Well State
|
|
||||||
virtual void applySolutionWellState(const BVector& x, const ModelParameters& param,
|
|
||||||
WellState& well_state) const = 0;
|
|
||||||
|
|
||||||
virtual void computeWellPotentials(const Simulator& ebosSimulator,
|
|
||||||
const WellState& well_state,
|
|
||||||
std::vector<double>& well_potentials) const = 0;
|
|
||||||
|
|
||||||
void setWellEfficiencyFactor(const double efficiency_factor);
|
|
||||||
|
|
||||||
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
bool checkRateEconLimits(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state) const;
|
const WellState& well_state) const;
|
||||||
|
|
||||||
void updateListEconLimited(const WellState& well_state,
|
|
||||||
DynamicListEconLimited& list_econ_limited) const;
|
|
||||||
|
|
||||||
void computeRepRadiusPerfLength(const Grid& grid, const std::map<int, int>& cartesian_to_compressed);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// to indicate a invalid connection
|
// to indicate a invalid connection
|
||||||
static const int INVALIDCONNECTION = -100000;
|
static const int INVALIDCONNECTION = -100000;
|
||||||
|
|
||||||
@@ -297,6 +273,16 @@ namespace Opm
|
|||||||
|
|
||||||
bool wellHasTHPConstraints() const;
|
bool wellHasTHPConstraints() const;
|
||||||
|
|
||||||
|
// The index of the well in Wells struct
|
||||||
|
// It is used to locate the inforation in Wells and also WellState for now.
|
||||||
|
int indexOfWell() const;
|
||||||
|
|
||||||
|
// Component fractions for each phase for the well
|
||||||
|
const std::vector<double>& compFrac() const;
|
||||||
|
|
||||||
|
/// Well productivity index for each perforation.
|
||||||
|
const std::vector<double>& wellIndex() const;
|
||||||
|
|
||||||
double mostStrictBhpFromBhpLimits() const;
|
double mostStrictBhpFromBhpLimits() const;
|
||||||
|
|
||||||
// a tuple type for ratio limit check.
|
// a tuple type for ratio limit check.
|
||||||
@@ -308,7 +294,6 @@ namespace Opm
|
|||||||
// the ratio of the actual value to the value of the violated limit.
|
// the ratio of the actual value to the value of the violated limit.
|
||||||
using RatioCheckTuple = std::tuple<bool, bool, int, double>;
|
using RatioCheckTuple = std::tuple<bool, bool, int, double>;
|
||||||
|
|
||||||
|
|
||||||
RatioCheckTuple checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
RatioCheckTuple checkMaxWaterCutLimit(const WellEconProductionLimits& econ_production_limits,
|
||||||
const WellState& well_state) const;
|
const WellState& well_state) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user