Move resetConnectionFactors()

This commit is contained in:
Joakim Hove 2021-05-20 10:59:07 +02:00
parent a891a44756
commit 40e8632f24
4 changed files with 51 additions and 51 deletions

View File

@ -69,44 +69,6 @@ void WellState::init(const std::vector<double>& cellPressures,
}
}
void WellState::resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& well_perf_data)
{
if (this->well_perf_data_[well_index].size() != well_perf_data.size()) {
throw std::invalid_argument {
"Size mismatch for perforation data in well "
+ std::to_string(well_index)
};
}
auto connID = std::size_t{0};
auto dst = this->well_perf_data_[well_index].begin();
for (const auto& src : well_perf_data) {
if (dst->cell_index != src.cell_index) {
throw std::invalid_argument {
"Cell index mismatch in connection "
+ std::to_string(connID)
+ " of well "
+ std::to_string(well_index)
};
}
if (dst->satnum_id != src.satnum_id) {
throw std::invalid_argument {
"Saturation function table mismatch in connection "
+ std::to_string(connID)
+ " of well "
+ std::to_string(well_index)
};
}
dst->connection_transmissibility_factor =
src.connection_transmissibility_factor;
++dst;
++connID;
}
}
const ParallelWellInfo&
WellState::parallelWellInfo(std::size_t well_index) const

View File

@ -68,17 +68,6 @@ public:
const std::vector<std::vector<PerforationData>>& well_perf_data,
const SummaryState& summary_state);
/// Special purpose method to support dynamically rescaling a well's
/// CTFs through WELPI.
///
/// \param[in] well_index Process-local linear index of single well.
/// Must be in the range 0..numWells()-1.
///
/// \param[in] well_perf_data New perforation data. Only
/// PerforationData::connection_transmissibility_factor actually
/// used (overwrites existing internal values).
void resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& well_perf_data);
/// One bhp pressure per well.
void update_bhp(std::size_t well_index, double value) { bhp_[well_index] = value; }

View File

@ -449,7 +449,6 @@ WellStateFullyImplicitBlackoil::report(const int* globalCellIdxMap,
}
}
const int nw = this->numWells();
std::vector<rt> phs(np);
if (pu.phase_used[Water]) {
phs.at( pu.phase_pos[Water] ) = rt::wat;
@ -1023,6 +1022,45 @@ void WellStateFullyImplicitBlackoil::updateWellsDefaultALQ( const std::vector<We
}
}
void WellStateFullyImplicitBlackoil::resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& well_perf_data)
{
if (this->well_perf_data_[well_index].size() != well_perf_data.size()) {
throw std::invalid_argument {
"Size mismatch for perforation data in well "
+ std::to_string(well_index)
};
}
auto connID = std::size_t{0};
auto dst = this->well_perf_data_[well_index].begin();
for (const auto& src : well_perf_data) {
if (dst->cell_index != src.cell_index) {
throw std::invalid_argument {
"Cell index mismatch in connection "
+ std::to_string(connID)
+ " of well "
+ std::to_string(well_index)
};
}
if (dst->satnum_id != src.satnum_id) {
throw std::invalid_argument {
"Saturation function table mismatch in connection "
+ std::to_string(connID)
+ " of well "
+ std::to_string(well_index)
};
}
dst->connection_transmissibility_factor =
src.connection_transmissibility_factor;
++dst;
++connID;
}
}
template void WellStateFullyImplicitBlackoil::updateGlobalIsGrup<ParallelWellInfo::Communication>(const ParallelWellInfo::Communication& comm);
template void WellStateFullyImplicitBlackoil::communicateGroupRates<ParallelWellInfo::Communication>(const ParallelWellInfo::Communication& comm);
} // namespace Opm

View File

@ -64,7 +64,6 @@ public:
using BaseType :: bhp;
using BaseType :: perfPress;
using BaseType :: numPhases;
using BaseType :: resetConnectionTransFactors;
using BaseType :: updateStatus;
explicit WellStateFullyImplicitBlackoil(const PhaseUsage& pu) :
@ -382,6 +381,18 @@ public:
bool wellIsOwned(const std::string& wellName) const;
/// Special purpose method to support dynamically rescaling a well's
/// CTFs through WELPI.
///
/// \param[in] well_index Process-local linear index of single well.
/// Must be in the range 0..numWells()-1.
///
/// \param[in] well_perf_data New perforation data. Only
/// PerforationData::connection_transmissibility_factor actually
/// used (overwrites existing internal values).
void resetConnectionTransFactors(const int well_index,
const std::vector<PerforationData>& well_perf_data);
private:
std::vector<double> perfphaserates_;
WellContainer<int> is_producer_; // Size equal to number of local wells.