mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3586 from blattms/tracer-use-well-container
[refactor] Use well_container and PerforationData for tracers
This commit is contained in:
commit
cc1adf0b2a
@ -291,38 +291,21 @@ protected:
|
||||
}
|
||||
|
||||
// Wells terms
|
||||
const int episodeIdx = simulator_.episodeIndex();
|
||||
const auto& wells = simulator_.vanguard().schedule().getWells(episodeIdx);
|
||||
for (const auto& well : wells) {
|
||||
const auto& wellPtrs = simulator_.problem().wellModel().localNonshutWells();
|
||||
for (const auto& wellPtr : wellPtrs) {
|
||||
const auto& well = wellPtr->wellEcl();
|
||||
|
||||
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
||||
this->wellTracerRate_[std::make_pair(well.name(),this->tracerNames_[tr.idx_[tIdx]])] = 0.0;
|
||||
}
|
||||
|
||||
if (well.getStatus() == Well::Status::SHUT)
|
||||
continue;
|
||||
|
||||
if (!simulator_.problem().wellModel().hasWell(well.name()))
|
||||
continue;
|
||||
|
||||
const auto& wellPtr = simulator_.problem().wellModel().getWell(well.name());
|
||||
|
||||
std::vector<double> wtracer(tr.numTracer());
|
||||
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
||||
wtracer[tIdx] = well.getTracerProperties().getConcentration(this->tracerNames_[tr.idx_[tIdx]]);
|
||||
}
|
||||
|
||||
std::array<int, 3> cartesianCoordinate;
|
||||
for (auto& connection : well.getConnections()) {
|
||||
|
||||
if (connection.state() == Connection::State::SHUT)
|
||||
continue;
|
||||
|
||||
cartesianCoordinate[0] = connection.getI();
|
||||
cartesianCoordinate[1] = connection.getJ();
|
||||
cartesianCoordinate[2] = connection.getK();
|
||||
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
||||
const int I = this->cartToGlobal_[cartIdx];
|
||||
for (auto& perfData : wellPtr->perforationData()) {
|
||||
auto I = perfData.cell_index;
|
||||
Scalar rate = wellPtr->volumetricSurfaceRateForConnection(I, tr.phaseIdx_);
|
||||
if (rate > 0) {
|
||||
for (int tIdx =0; tIdx < tr.numTracer(); ++tIdx) {
|
||||
@ -388,34 +371,17 @@ protected:
|
||||
}
|
||||
|
||||
// Store _producer_ tracer rate for reporting
|
||||
const int episodeIdx = simulator_.episodeIndex();
|
||||
const auto& wells = simulator_.vanguard().schedule().getWells(episodeIdx);
|
||||
for (const auto& well : wells) {
|
||||
|
||||
if (well.getStatus() == Well::Status::SHUT)
|
||||
continue;
|
||||
|
||||
if (!simulator_.problem().wellModel().hasWell(well.name()))
|
||||
continue;
|
||||
|
||||
const auto& wellPtr = simulator_.problem().wellModel().getWell(well.name());
|
||||
const auto& wellPtrs = simulator_.problem().wellModel().localNonshutWells();
|
||||
for (const auto& wellPtr : wellPtrs) {
|
||||
const auto& well = wellPtr->wellEcl();
|
||||
|
||||
if (!well.isProducer()) //Injection rates already reported during assembly
|
||||
continue;
|
||||
|
||||
Scalar rateWellPos = 0.0;
|
||||
Scalar rateWellNeg = 0.0;
|
||||
std::array<int, 3> cartesianCoordinate;
|
||||
for (auto& connection : well.getConnections()) {
|
||||
|
||||
if (connection.state() == Connection::State::SHUT)
|
||||
continue;
|
||||
|
||||
cartesianCoordinate[0] = connection.getI();
|
||||
cartesianCoordinate[1] = connection.getJ();
|
||||
cartesianCoordinate[2] = connection.getK();
|
||||
const size_t cartIdx = simulator_.vanguard().cartesianIndex(cartesianCoordinate);
|
||||
const int I = this->cartToGlobal_[cartIdx];
|
||||
for (auto& perfData : wellPtr->perforationData()) {
|
||||
const int I = perfData.cell_index;
|
||||
Scalar rate = wellPtr->volumetricSurfaceRateForConnection(I, tr.phaseIdx_);
|
||||
if (rate < 0) {
|
||||
rateWellNeg += rate;
|
||||
@ -490,7 +456,7 @@ protected:
|
||||
// Since oil or gas tracers appears in dual compositions when VAPOIL respectively DISGAS
|
||||
// is active, the template argument is intended to support future extension to these
|
||||
// scenarios by supplying an extended vector type.
|
||||
|
||||
|
||||
template <typename TV>
|
||||
struct TracerBatch {
|
||||
std::vector<int> idx_;
|
||||
|
@ -292,6 +292,12 @@ namespace Opm {
|
||||
|
||||
void initGliftEclWellMap(GLiftEclWells &ecl_well_map);
|
||||
|
||||
/// \brief Get list of local nonshut wells
|
||||
const std::vector<WellInterfacePtr>& localNonshutWells()
|
||||
{
|
||||
return well_container_;
|
||||
}
|
||||
|
||||
protected:
|
||||
Simulator& ebosSimulator_;
|
||||
|
||||
|
@ -98,6 +98,11 @@ WellInterfaceGeneric::WellInterfaceGeneric(const Well& well,
|
||||
wsolvent_ = 0.0;
|
||||
}
|
||||
|
||||
const std::vector<PerforationData>& WellInterfaceGeneric::perforationData() const
|
||||
{
|
||||
return *perf_data_;
|
||||
}
|
||||
|
||||
const std::string& WellInterfaceGeneric::name() const
|
||||
{
|
||||
return well_ecl_.name();
|
||||
|
@ -60,6 +60,9 @@ public:
|
||||
const int index_of_well,
|
||||
const std::vector<PerforationData>& perf_data);
|
||||
|
||||
/// \brief Get the perforations of the well
|
||||
const std::vector<PerforationData>& perforationData() const;
|
||||
|
||||
/// Well name.
|
||||
const std::string& name() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user