Merge pull request #1638 from trinemykk/addtracer

add method for getting the surfacevolume well connection rate
This commit is contained in:
Atgeirr Flø Rasmussen 2018-12-07 10:38:21 +01:00 committed by GitHub
commit cb06770b54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 1 deletions

View File

@ -194,6 +194,10 @@ namespace Opm {
unsigned spaceIdx,
unsigned timeIdx) const;
using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag> >;
WellInterfacePtr well(const std::string& wellName) const;
void initFromRestartFile(const RestartValue& restartValues);
Opm::data::Wells wellData() const
@ -276,7 +280,6 @@ namespace Opm {
bool wells_active_;
using WellInterfacePtr = std::unique_ptr<WellInterface<TypeTag> >;
// a vector of all the wells.
std::vector<WellInterfacePtr > well_container_;

View File

@ -401,6 +401,22 @@ namespace Opm {
well->addCellRates(rate, elemIdx);
}
template<typename TypeTag>
typename BlackoilWellModel<TypeTag>::WellInterfacePtr
BlackoilWellModel<TypeTag>::
well(const std::string& wellName) const
{
for (const auto& well : well_container_) {
if (well->name() == wellName) {
return well;
}
}
OPM_THROW(std::invalid_argument, "The well with name " + wellName + " is not in the well Container");
return nullptr;
}
template<typename TypeTag>
void
BlackoilWellModel<TypeTag>::

View File

@ -199,6 +199,9 @@ namespace Opm
void addCellRates(RateVector& rates, int cellIdx) const;
Scalar volumetricSurfaceRateForConnection(int cellIdx, int phaseIdx) const;
template <class EvalWell>
Eval restrictEval(const EvalWell& in) const
{

View File

@ -1287,6 +1287,20 @@ namespace Opm
}
}
template<typename TypeTag>
typename WellInterface<TypeTag>::Scalar
WellInterface<TypeTag>::volumetricSurfaceRateForConnection(int cellIdx, int phaseIdx) const {
for (int perfIdx = 0; perfIdx < number_of_perforations_; ++perfIdx) {
if (cells()[perfIdx] == cellIdx) {
const unsigned activeCompIdx = Indices::canonicalToActiveComponentIndex(FluidSystem::solventComponentIndex(phaseIdx));
return connectionRates_[perfIdx][activeCompIdx].value();
}
}
OPM_THROW(std::invalid_argument, "The well with name " + name()
+ " does not perforate cell " + std::to_string(cellIdx));
return 0.0;
}