mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Move addCellRates to interface and add is_cell_penetrated
This commit is contained in:
parent
8b376f9b14
commit
3a38b9fe53
@ -278,6 +278,8 @@ namespace Opm {
|
||||
// map from logically cartesian cell indices to compressed ones
|
||||
std::vector<int> cartesian_to_compressed_;
|
||||
|
||||
std::vector<bool> is_cell_perforated_;
|
||||
|
||||
// create the well container
|
||||
std::vector<WellInterfacePtr > createWellContainer(const int time_step);
|
||||
|
||||
|
@ -46,6 +46,8 @@ namespace Opm {
|
||||
|
||||
// add the eWoms auxiliary module for the wells to the list
|
||||
ebosSimulator_.model().addAuxiliaryModule(this);
|
||||
|
||||
is_cell_perforated_.resize(number_of_cells_, false);
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
@ -200,8 +202,6 @@ namespace Opm {
|
||||
schedule().getVFPInjTables(timeStepIdx),
|
||||
schedule().getVFPProdTables(timeStepIdx)) );
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -228,6 +228,12 @@ namespace Opm {
|
||||
well->init(&phase_usage_, depth_, gravity_, number_of_cells_);
|
||||
}
|
||||
|
||||
// update the updated cell flag
|
||||
std::fill(is_cell_perforated_.begin(), is_cell_perforated_.end(), false);
|
||||
for (auto& well : well_container_) {
|
||||
well->updatePerforatedCell(is_cell_perforated_);
|
||||
}
|
||||
|
||||
// calculate the efficiency factors for each well
|
||||
calculateEfficiencyFactors();
|
||||
|
||||
@ -342,6 +348,10 @@ namespace Opm {
|
||||
{
|
||||
rate = 0;
|
||||
int elemIdx = context.globalSpaceIndex(spaceIdx, timeIdx);
|
||||
|
||||
if (!is_cell_perforated_[elemIdx])
|
||||
return;
|
||||
|
||||
for (const auto& well : well_container_)
|
||||
well->addCellRates(rate, elemIdx);
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ namespace Opm
|
||||
{
|
||||
public:
|
||||
typedef WellInterface<TypeTag> Base;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
||||
|
||||
using typename Base::WellState;
|
||||
using typename Base::Simulator;
|
||||
@ -152,17 +151,6 @@ namespace Opm
|
||||
|
||||
int numberOfPerforations() const;
|
||||
|
||||
void addCellRates(RateVector& rates, int cellIdx) const override
|
||||
{
|
||||
for (int perfIdx = 0; perfIdx < number_of_perforations_; ++perfIdx) {
|
||||
if (Base::cells()[perfIdx] == cellIdx) {
|
||||
for (int i = 0; i < RateVector::dimension; ++i) {
|
||||
rates[i] += connectionRates_[perfIdx][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
int number_segments_;
|
||||
|
||||
@ -194,6 +182,7 @@ namespace Opm
|
||||
using Base::well_controls_;
|
||||
using Base::perf_depth_;
|
||||
using Base::num_components_;
|
||||
using Base::connectionRates_;
|
||||
|
||||
// protected functions from the Base class
|
||||
using Base::phaseUsage;
|
||||
@ -264,8 +253,6 @@ namespace Opm
|
||||
|
||||
std::vector<double> segment_depth_diffs_;
|
||||
|
||||
std::vector<RateVector> connectionRates_;
|
||||
|
||||
void initMatrixAndVectors(const int num_cells) const;
|
||||
|
||||
// protected functions
|
||||
|
@ -114,8 +114,6 @@ namespace Opm
|
||||
{
|
||||
Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells);
|
||||
|
||||
connectionRates_.resize(number_of_perforations_);
|
||||
|
||||
// TODO: for StandardWell, we need to update the perf depth here using depth_arg.
|
||||
// for MultisegmentWell, it is much more complicated.
|
||||
// It can be specified directly, it can be calculated from the segment depth,
|
||||
|
@ -37,7 +37,6 @@ namespace Opm
|
||||
|
||||
public:
|
||||
typedef WellInterface<TypeTag> Base;
|
||||
typedef typename GET_PROP_TYPE(TypeTag, RateVector) RateVector;
|
||||
|
||||
// TODO: some functions working with AD variables handles only with values (double) without
|
||||
// dealing with derivatives. It can be beneficial to make functions can work with either AD or scalar value.
|
||||
@ -177,17 +176,6 @@ namespace Opm
|
||||
return param_.matrix_add_well_contributions_;
|
||||
}
|
||||
|
||||
void addCellRates(RateVector& rates, int cellIdx) const override
|
||||
{
|
||||
for (int perfIdx = 0; perfIdx < number_of_perforations_; ++perfIdx) {
|
||||
if (Base::cells()[perfIdx] == cellIdx) {
|
||||
for (int i = 0; i < RateVector::dimension; ++i) {
|
||||
rates[i] += connectionRates_[perfIdx][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// protected functions from the Base class
|
||||
@ -222,6 +210,7 @@ namespace Opm
|
||||
using Base::well_controls_;
|
||||
using Base::well_type_;
|
||||
using Base::num_components_;
|
||||
using Base::connectionRates_;
|
||||
|
||||
using Base::perf_rep_radius_;
|
||||
using Base::perf_length_;
|
||||
@ -241,8 +230,6 @@ namespace Opm
|
||||
// diagonal matrix for the well
|
||||
DiagMatWell invDuneD_;
|
||||
|
||||
std::vector<RateVector> connectionRates_;
|
||||
|
||||
// several vector used in the matrix calculation
|
||||
mutable BVectorWell Bx_;
|
||||
mutable BVectorWell invDrw_;
|
||||
|
@ -58,8 +58,6 @@ namespace Opm
|
||||
{
|
||||
Base::init(phase_usage_arg, depth_arg, gravity_arg, num_cells);
|
||||
|
||||
connectionRates_.resize(number_of_perforations_);
|
||||
|
||||
perf_depth_.resize(number_of_perforations_, 0.);
|
||||
for (int perf = 0; perf < number_of_perforations_; ++perf) {
|
||||
const int cell_idx = well_cells_[perf];
|
||||
|
@ -195,8 +195,7 @@ namespace Opm
|
||||
virtual void addWellContributions(Mat&) const
|
||||
{}
|
||||
|
||||
virtual void addCellRates(RateVector& rates, int cellIdx) const
|
||||
{}
|
||||
void addCellRates(RateVector& rates, int cellIdx) const;
|
||||
|
||||
template <class EvalWell>
|
||||
Eval restrictEval(const EvalWell& in) const
|
||||
@ -220,6 +219,9 @@ namespace Opm
|
||||
const WellTestConfig::Reason testing_reason, const WellState& well_state,
|
||||
WellTestState& welltest_state);
|
||||
|
||||
void updatePerforatedCell(std::vector<bool>& is_cell_perforated);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// to indicate a invalid completion
|
||||
@ -299,6 +301,8 @@ namespace Opm
|
||||
|
||||
const int num_components_;
|
||||
|
||||
std::vector<RateVector> connectionRates_;
|
||||
|
||||
const PhaseUsage& phaseUsage() const;
|
||||
|
||||
int flowPhaseToEbosCompIdx( const int phaseIdx ) const;
|
||||
@ -351,6 +355,7 @@ namespace Opm
|
||||
|
||||
void scaleProductivityIndex(const int perfIdx, double& productivity_index) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -102,11 +102,23 @@ namespace Opm
|
||||
wells->sat_table_id + perf_index_end,
|
||||
saturation_table_number_.begin() );
|
||||
}
|
||||
|
||||
well_efficiency_factor_ = 1.0;
|
||||
|
||||
connectionRates_.resize(number_of_perforations_);
|
||||
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
updatePerforatedCell(std::vector<bool>& is_cell_perforated)
|
||||
{
|
||||
|
||||
for (int perf_idx = 0; perf_idx<number_of_perforations_; ++perf_idx) {
|
||||
is_cell_perforated[well_cells_[perf_idx]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -116,7 +128,7 @@ namespace Opm
|
||||
init(const PhaseUsage* phase_usage_arg,
|
||||
const std::vector<double>& /* depth_arg */,
|
||||
const double gravity_arg,
|
||||
const int /* num_cells */)
|
||||
const int /*num_cells*/)
|
||||
{
|
||||
phase_usage_ = phase_usage_arg;
|
||||
gravity_ = gravity_arg;
|
||||
@ -125,7 +137,6 @@ namespace Opm
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
@ -1125,5 +1136,18 @@ namespace Opm
|
||||
(std::log(well_ecl_->getDrainageRadius(current_step_) / connection.rw()) + connection.skinFactor());
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::addCellRates(RateVector& rates, int cellIdx) const
|
||||
{
|
||||
for (int perfIdx = 0; perfIdx < number_of_perforations_; ++perfIdx) {
|
||||
if (cells()[perfIdx] == cellIdx) {
|
||||
for (int i = 0; i < RateVector::dimension; ++i) {
|
||||
rates[i] += connectionRates_[perfIdx][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user