mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ParallelWBPCalculation: template Scalar type
This commit is contained in:
parent
66a08b9c1a
commit
27d99f78ec
@ -488,7 +488,7 @@ class WellContributions;
|
|||||||
data::WellBlockAveragePressures
|
data::WellBlockAveragePressures
|
||||||
computeWellBlockAveragePressures() const;
|
computeWellBlockAveragePressures() const;
|
||||||
|
|
||||||
ParallelWBPCalculation::EvaluatorFactory
|
typename ParallelWBPCalculation<Scalar>::EvaluatorFactory
|
||||||
makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const;
|
makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const;
|
||||||
|
|
||||||
void registerOpenWellsForWBPCalculation();
|
void registerOpenWellsForWBPCalculation();
|
||||||
|
@ -550,7 +550,7 @@ protected:
|
|||||||
std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>> local_parallel_well_info_;
|
std::vector<std::reference_wrapper<ParallelWellInfo<Scalar>>> local_parallel_well_info_;
|
||||||
|
|
||||||
std::vector<WellProdIndexCalculator> prod_index_calc_;
|
std::vector<WellProdIndexCalculator> prod_index_calc_;
|
||||||
mutable ParallelWBPCalculation wbpCalculationService_;
|
mutable ParallelWBPCalculation<Scalar> wbpCalculationService_;
|
||||||
|
|
||||||
std::vector<int> pvt_region_idx_;
|
std::vector<int> pvt_region_idx_;
|
||||||
|
|
||||||
|
@ -2075,14 +2075,14 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
template <typename TypeTag>
|
template <typename TypeTag>
|
||||||
ParallelWBPCalculation::EvaluatorFactory
|
typename ParallelWBPCalculation<typename BlackoilWellModel<TypeTag>::Scalar>::EvaluatorFactory
|
||||||
BlackoilWellModel<TypeTag>::
|
BlackoilWellModel<TypeTag>::
|
||||||
makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const
|
makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const
|
||||||
{
|
{
|
||||||
using Span = typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;
|
using Span = typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;
|
||||||
using Item = typename Span::Item;
|
using Item = typename Span::Item;
|
||||||
|
|
||||||
return [wellIdx, this]() -> ParallelWBPCalculation::Evaluator
|
return [wellIdx, this]() -> typename ParallelWBPCalculation<Scalar>::Evaluator
|
||||||
{
|
{
|
||||||
if (! this->wbpCalcMap_[wellIdx].openWellIdx_.has_value()) {
|
if (! this->wbpCalcMap_[wellIdx].openWellIdx_.has_value()) {
|
||||||
// Well is stopped/shut. Return evaluator for stopped wells.
|
// Well is stopped/shut. Return evaluator for stopped wells.
|
||||||
|
@ -47,13 +47,14 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::
|
template<class Scalar>
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::
|
||||||
LocalConnSet::LocalConnSet(const std::vector<int>& localConnIdx)
|
LocalConnSet::LocalConnSet(const std::vector<int>& localConnIdx)
|
||||||
: localConnIdx_ { localConnIdx }
|
: localConnIdx_ { localConnIdx }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
int
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::
|
int Opm::ParallelWBPCalculation<Scalar>::
|
||||||
LocalConnSet::localIndex(const std::size_t connIdx) const
|
LocalConnSet::localIndex(const std::size_t connIdx) const
|
||||||
{
|
{
|
||||||
return (connIdx >= this->localConnIdx_.size())
|
return (connIdx >= this->localConnIdx_.size())
|
||||||
@ -63,40 +64,45 @@ LocalConnSet::localIndex(const std::size_t connIdx) const
|
|||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::SourceData::SourceData(const Parallel::Communication& comm)
|
template<class Scalar>
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
|
SourceData(const Parallel::Communication& comm)
|
||||||
: comm_ { comm }
|
: comm_ { comm }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::SourceData&
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::SourceData::
|
typename Opm::ParallelWBPCalculation<Scalar>::SourceData&
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
localIndex(GlobalToLocal localIdx)
|
localIndex(GlobalToLocal localIdx)
|
||||||
{
|
{
|
||||||
this->localIdx_ = std::move(localIdx);
|
this->localIdx_ = std::move(localIdx);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::SourceData&
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::SourceData::
|
typename Opm::ParallelWBPCalculation<Scalar>::SourceData&
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
evaluator(Evaluator eval)
|
evaluator(Evaluator eval)
|
||||||
{
|
{
|
||||||
this->eval_ = std::move(eval);
|
this->eval_ = std::move(eval);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::SourceData&
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::SourceData::
|
typename Opm::ParallelWBPCalculation<Scalar>::SourceData&
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
evaluatorFactory(EvaluatorFactory evalFactory)
|
evaluatorFactory(EvaluatorFactory evalFactory)
|
||||||
{
|
{
|
||||||
this->evalFactory_ = std::move(evalFactory);
|
this->evalFactory_ = std::move(evalFactory);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::SourceData::
|
void Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
buildStructure(const std::vector<std::size_t>& sourceLocations)
|
buildStructure(const std::vector<std::size_t>& sourceLocations)
|
||||||
{
|
{
|
||||||
if (this->srcData_ == nullptr) {
|
if (this->srcData_ == nullptr) {
|
||||||
this->srcData_ = std::make_unique<ParallelPAvgDynamicSourceData<double>>
|
this->srcData_ = std::make_unique<ParallelPAvgDynamicSourceData<Scalar>>
|
||||||
(this->comm_, sourceLocations, this->localIdx_);
|
(this->comm_, sourceLocations, this->localIdx_);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -104,7 +110,9 @@ buildStructure(const std::vector<std::size_t>& sourceLocations)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::SourceData::collectDynamicValues()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
|
collectDynamicValues()
|
||||||
{
|
{
|
||||||
if (this->srcData_ == nullptr) {
|
if (this->srcData_ == nullptr) {
|
||||||
throw std::logic_error {
|
throw std::logic_error {
|
||||||
@ -132,8 +140,9 @@ void Opm::ParallelWBPCalculation::SourceData::collectDynamicValues()
|
|||||||
this->srcData_->synchroniseSources();
|
this->srcData_->synchroniseSources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
std::vector<int>
|
std::vector<int>
|
||||||
Opm::ParallelWBPCalculation::SourceData::
|
Opm::ParallelWBPCalculation<Scalar>::SourceData::
|
||||||
getLocalIndex(const std::vector<std::size_t>& globalIndex) const
|
getLocalIndex(const std::vector<std::size_t>& globalIndex) const
|
||||||
{
|
{
|
||||||
auto localIdx = std::vector<int>(globalIndex.size());
|
auto localIdx = std::vector<int>(globalIndex.size());
|
||||||
@ -149,37 +158,43 @@ getLocalIndex(const std::vector<std::size_t>& globalIndex) const
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::ParallelWBPCalculation(const GridDims& cellIndexMap,
|
template<class Scalar>
|
||||||
const Parallel::Communication& gridComm)
|
Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
ParallelWBPCalculation(const GridDims& cellIndexMap,
|
||||||
|
const Parallel::Communication& gridComm)
|
||||||
: cellIndexMap_{ cellIndexMap }
|
: cellIndexMap_{ cellIndexMap }
|
||||||
, reservoirSrc_{ gridComm }
|
, reservoirSrc_{ gridComm }
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation&
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::localCellIndex(GlobalToLocal localCellIdx)
|
Opm::ParallelWBPCalculation<Scalar>&
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
localCellIndex(GlobalToLocal localCellIdx)
|
||||||
{
|
{
|
||||||
this->reservoirSrc_.localIndex(std::move(localCellIdx));
|
this->reservoirSrc_.localIndex(std::move(localCellIdx));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation&
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::evalCellSource(Evaluator evalCellSrc)
|
Opm::ParallelWBPCalculation<Scalar>&
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
evalCellSource(Evaluator evalCellSrc)
|
||||||
{
|
{
|
||||||
this->reservoirSrc_.evaluator(std::move(evalCellSrc));
|
this->reservoirSrc_.evaluator(std::move(evalCellSrc));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::
|
std::size_t Opm::ParallelWBPCalculation<Scalar>::
|
||||||
createCalculator(const Well& well,
|
createCalculator(const Well& well,
|
||||||
const ParallelWellInfo<double>& parallelWellInfo,
|
const ParallelWellInfo<Scalar>& parallelWellInfo,
|
||||||
const std::vector<int>& localConnIdx,
|
const std::vector<int>& localConnIdx,
|
||||||
EvaluatorFactory makeWellSourceEvaluator)
|
EvaluatorFactory makeWellSourceEvaluator)
|
||||||
{
|
{
|
||||||
assert (this->wellConnSrc_.size() == this->localConnSet_.size());
|
assert (this->wellConnSrc_.size() == this->localConnSet_.size());
|
||||||
|
|
||||||
const auto ix = this->calculators_
|
const auto ix = this->calculators_
|
||||||
.setCalculator(well.seqIndex(), std::make_unique<ParallelPAvgCalculator<double>>
|
.setCalculator(well.seqIndex(), std::make_unique<ParallelPAvgCalculator<Scalar>>
|
||||||
(parallelWellInfo.communication(),
|
(parallelWellInfo.communication(),
|
||||||
this->cellIndexMap_, well.getConnections()));
|
this->cellIndexMap_, well.getConnections()));
|
||||||
|
|
||||||
@ -204,7 +219,9 @@ createCalculator(const Well& well,
|
|||||||
return ix;
|
return ix;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::defineCommunication()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
defineCommunication()
|
||||||
{
|
{
|
||||||
assert (this->calculators_.numCalculators() == this->wellConnSrc_.size());
|
assert (this->calculators_.numCalculators() == this->wellConnSrc_.size());
|
||||||
|
|
||||||
@ -218,7 +235,9 @@ void Opm::ParallelWBPCalculation::defineCommunication()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::collectDynamicValues()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
collectDynamicValues()
|
||||||
{
|
{
|
||||||
this->reservoirSrc_.collectDynamicValues();
|
this->reservoirSrc_.collectDynamicValues();
|
||||||
|
|
||||||
@ -227,25 +246,29 @@ void Opm::ParallelWBPCalculation::collectDynamicValues()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
inferBlockAveragePressures(const std::size_t calcIndex,
|
inferBlockAveragePressures(const std::size_t calcIndex,
|
||||||
const PAvg& controls,
|
const PAvg& controls,
|
||||||
const double gravity,
|
const Scalar gravity,
|
||||||
const double refDepth)
|
const Scalar refDepth)
|
||||||
{
|
{
|
||||||
this->calculators_[calcIndex]
|
this->calculators_[calcIndex]
|
||||||
.inferBlockAveragePressures(this->makeEvaluationSources(calcIndex),
|
.inferBlockAveragePressures(this->makeEvaluationSources(calcIndex),
|
||||||
controls, gravity, refDepth);
|
controls, gravity, refDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Opm::PAvgCalculator<double>::Result&
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::averagePressures(const std::size_t calcIndex) const
|
const typename Opm::PAvgCalculator<Scalar>::Result&
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
averagePressures(const std::size_t calcIndex) const
|
||||||
{
|
{
|
||||||
return this->calculators_[calcIndex].averagePressures();
|
return this->calculators_[calcIndex].averagePressures();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::pruneInactiveWBPCells()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
pruneInactiveWBPCells()
|
||||||
{
|
{
|
||||||
if (this->reservoirSrc_.comm().size() == 1) {
|
if (this->reservoirSrc_.comm().size() == 1) {
|
||||||
this->pruneInactiveWBPCellsSerial();
|
this->pruneInactiveWBPCellsSerial();
|
||||||
@ -255,7 +278,9 @@ void Opm::ParallelWBPCalculation::pruneInactiveWBPCells()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::pruneInactiveWBPCellsSerial()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
pruneInactiveWBPCellsSerial()
|
||||||
{
|
{
|
||||||
this->calculators_.pruneInactiveWBPCells
|
this->calculators_.pruneInactiveWBPCells
|
||||||
([this](const std::vector<std::size_t>& globalWBPCellIdx)
|
([this](const std::vector<std::size_t>& globalWBPCellIdx)
|
||||||
@ -275,7 +300,9 @@ void Opm::ParallelWBPCalculation::pruneInactiveWBPCellsSerial()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::pruneInactiveWBPCellsParallel()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
pruneInactiveWBPCellsParallel()
|
||||||
{
|
{
|
||||||
this->calculators_.pruneInactiveWBPCells(
|
this->calculators_.pruneInactiveWBPCells(
|
||||||
[this](const std::vector<std::size_t>& globalWBPCellIdx)
|
[this](const std::vector<std::size_t>& globalWBPCellIdx)
|
||||||
@ -314,7 +341,9 @@ void Opm::ParallelWBPCalculation::pruneInactiveWBPCellsParallel()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::defineReservoirCommunication()
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
defineReservoirCommunication()
|
||||||
{
|
{
|
||||||
auto sourceCells = std::vector<std::size_t>{};
|
auto sourceCells = std::vector<std::size_t>{};
|
||||||
|
|
||||||
@ -327,16 +356,22 @@ void Opm::ParallelWBPCalculation::defineReservoirCommunication()
|
|||||||
this->reservoirSrc_.buildStructure({sourceCells.begin(), u});
|
this->reservoirSrc_.buildStructure({sourceCells.begin(), u});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Opm::ParallelWBPCalculation::defineWellCommunication(const std::size_t well)
|
template<class Scalar>
|
||||||
|
void Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
defineWellCommunication(const std::size_t well)
|
||||||
{
|
{
|
||||||
this->wellConnSrc_[well]
|
this->wellConnSrc_[well]
|
||||||
.buildStructure(this->calculators_[well].allWellConnections());
|
.buildStructure(this->calculators_[well].allWellConnections());
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::PAvgCalculator<double>::Sources
|
template<class Scalar>
|
||||||
Opm::ParallelWBPCalculation::makeEvaluationSources(const WellID well) const
|
typename Opm::PAvgCalculator<Scalar>::Sources
|
||||||
|
Opm::ParallelWBPCalculation<Scalar>::
|
||||||
|
makeEvaluationSources(const WellID well) const
|
||||||
{
|
{
|
||||||
return PAvgCalculator<double>::Sources{}
|
return typename PAvgCalculator<Scalar>::Sources{}
|
||||||
.wellBlocks(this->reservoirSrc_)
|
.wellBlocks(this->reservoirSrc_)
|
||||||
.wellConns (this->wellConnSrc_[well]);
|
.wellConns (this->wellConnSrc_[well]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template class Opm::ParallelWBPCalculation<double>;
|
||||||
|
@ -46,15 +46,16 @@ namespace Opm {
|
|||||||
/// Parallel facility for managing the on-rank collection and global
|
/// Parallel facility for managing the on-rank collection and global
|
||||||
/// distribution of WBPn source values as well as local calculation and
|
/// distribution of WBPn source values as well as local calculation and
|
||||||
/// distributed reduction of the inferred WBPn report values.
|
/// distributed reduction of the inferred WBPn report values.
|
||||||
|
template<class Scalar>
|
||||||
class ParallelWBPCalculation
|
class ParallelWBPCalculation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Callback for inferring the source locations which are active on the
|
/// Callback for inferring the source locations which are active on the
|
||||||
/// current MPI rank.
|
/// current MPI rank.
|
||||||
using GlobalToLocal = ParallelPAvgDynamicSourceData<double>::GlobalToLocal;
|
using GlobalToLocal = typename ParallelPAvgDynamicSourceData<Scalar>::GlobalToLocal;
|
||||||
|
|
||||||
/// Callback for evaluating WBPn source terms on the current MPI rank.
|
/// Callback for evaluating WBPn source terms on the current MPI rank.
|
||||||
using Evaluator = ParallelPAvgDynamicSourceData<double>::Evaluator;
|
using Evaluator = typename ParallelPAvgDynamicSourceData<Scalar>::Evaluator;
|
||||||
|
|
||||||
/// Callback for constructing a source term evaluation function on the
|
/// Callback for constructing a source term evaluation function on the
|
||||||
/// current MPI rank. Needed for deferred construction of per-well
|
/// current MPI rank. Needed for deferred construction of per-well
|
||||||
@ -112,7 +113,7 @@ public:
|
|||||||
/// well.
|
/// well.
|
||||||
std::size_t
|
std::size_t
|
||||||
createCalculator(const Well& well,
|
createCalculator(const Well& well,
|
||||||
const ParallelWellInfo<double>& parallelWellInfo,
|
const ParallelWellInfo<Scalar>& parallelWellInfo,
|
||||||
const std::vector<int>& localConnIdx,
|
const std::vector<int>& localConnIdx,
|
||||||
EvaluatorFactory makeWellSourceEvaluator);
|
EvaluatorFactory makeWellSourceEvaluator);
|
||||||
|
|
||||||
@ -152,8 +153,8 @@ public:
|
|||||||
/// Well::getWPaveRefDepth() \endcode.
|
/// Well::getWPaveRefDepth() \endcode.
|
||||||
void inferBlockAveragePressures(const std::size_t calcIndex,
|
void inferBlockAveragePressures(const std::size_t calcIndex,
|
||||||
const PAvg& controls,
|
const PAvg& controls,
|
||||||
const double gravity,
|
const Scalar gravity,
|
||||||
const double refDepth);
|
const Scalar refDepth);
|
||||||
|
|
||||||
/// Retrieve results from most recent WBPn value calculation for
|
/// Retrieve results from most recent WBPn value calculation for
|
||||||
/// specified well.
|
/// specified well.
|
||||||
@ -163,7 +164,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// \return Result set from most recent call to member function \c
|
/// \return Result set from most recent call to member function \c
|
||||||
/// inferBlockAveragePressures() for \c calcIndex.
|
/// inferBlockAveragePressures() for \c calcIndex.
|
||||||
const PAvgCalculator<double>::Result&
|
const typename PAvgCalculator<Scalar>::Result&
|
||||||
averagePressures(const std::size_t calcIndex) const;
|
averagePressures(const std::size_t calcIndex) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -213,7 +214,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// Enables transparent usage of this object as an argument to \code
|
/// Enables transparent usage of this object as an argument to \code
|
||||||
/// PAvgCalculator::inferBlockAveragePressures() \endcode.
|
/// PAvgCalculator::inferBlockAveragePressures() \endcode.
|
||||||
operator const ParallelPAvgDynamicSourceData<double>&() const
|
operator const ParallelPAvgDynamicSourceData<Scalar>&() const
|
||||||
{
|
{
|
||||||
return *this->srcData_;
|
return *this->srcData_;
|
||||||
}
|
}
|
||||||
@ -294,7 +295,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// Type of wrapped object.
|
/// Type of wrapped object.
|
||||||
using DataPtr = std::unique_ptr<ParallelPAvgDynamicSourceData<double>>;
|
using DataPtr = std::unique_ptr<ParallelPAvgDynamicSourceData<Scalar>>;
|
||||||
|
|
||||||
/// MPI communicator for this source data object.
|
/// MPI communicator for this source data object.
|
||||||
std::reference_wrapper<const Parallel::Communication> comm_;
|
std::reference_wrapper<const Parallel::Communication> comm_;
|
||||||
@ -316,7 +317,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Calculation object IDs.
|
/// Calculation object IDs.
|
||||||
using WellID = std::vector<SourceData>::size_type;
|
using WellID = typename std::vector<SourceData>::size_type;
|
||||||
|
|
||||||
/// Cell index triple map ((I,J,K) <-> global).
|
/// Cell index triple map ((I,J,K) <-> global).
|
||||||
std::reference_wrapper<const GridDims> cellIndexMap_;
|
std::reference_wrapper<const GridDims> cellIndexMap_;
|
||||||
@ -326,7 +327,7 @@ private:
|
|||||||
|
|
||||||
/// Collection of WBPn calculation objects. One object for each well on
|
/// Collection of WBPn calculation objects. One object for each well on
|
||||||
/// rank.
|
/// rank.
|
||||||
PAvgCalculatorCollection<double> calculators_{};
|
PAvgCalculatorCollection<Scalar> calculators_{};
|
||||||
|
|
||||||
/// Source term objects for each well on rank.
|
/// Source term objects for each well on rank.
|
||||||
std::vector<SourceData> wellConnSrc_{};
|
std::vector<SourceData> wellConnSrc_{};
|
||||||
@ -360,7 +361,8 @@ private:
|
|||||||
/// terms.
|
/// terms.
|
||||||
///
|
///
|
||||||
/// \return WBPn source terms aggregated for \p well.
|
/// \return WBPn source terms aggregated for \p well.
|
||||||
PAvgCalculator<double>::Sources makeEvaluationSources(const WellID well) const;
|
typename PAvgCalculator<Scalar>::Sources
|
||||||
|
makeEvaluationSources(const WellID well) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -233,7 +233,7 @@ namespace {
|
|||||||
return localIdx;
|
return localIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::EvaluatorFactory connSource()
|
Opm::ParallelWBPCalculation<double>::EvaluatorFactory connSource()
|
||||||
{
|
{
|
||||||
return []() {
|
return []() {
|
||||||
auto rho = std::vector { 0.1, 0.12, 0.14, };
|
auto rho = std::vector { 0.1, 0.12, 0.14, };
|
||||||
@ -373,7 +373,7 @@ namespace {
|
|||||||
return localIdx;
|
return localIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::EvaluatorFactory connSource()
|
Opm::ParallelWBPCalculation<double>::EvaluatorFactory connSource()
|
||||||
{
|
{
|
||||||
return []() {
|
return []() {
|
||||||
auto rho = std::vector { 0.16, 0.18, 0.2, };
|
auto rho = std::vector { 0.16, 0.18, 0.2, };
|
||||||
@ -483,22 +483,22 @@ namespace {
|
|||||||
return pwi;
|
return pwi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCallbacksTop(Opm::ParallelWBPCalculation& wbpCalcService)
|
void setCallbacksTop(Opm::ParallelWBPCalculation<double>& wbpCalcService)
|
||||||
{
|
{
|
||||||
wbpCalcService
|
wbpCalcService
|
||||||
.localCellIndex(&Rank::Top::globalToLocal)
|
.localCellIndex(&Rank::Top::globalToLocal)
|
||||||
.evalCellSource(&Rank::Top::cellSource);
|
.evalCellSource(&Rank::Top::cellSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCallbacksBottom(Opm::ParallelWBPCalculation& wbpCalcService)
|
void setCallbacksBottom(Opm::ParallelWBPCalculation<double>& wbpCalcService)
|
||||||
{
|
{
|
||||||
wbpCalcService
|
wbpCalcService
|
||||||
.localCellIndex(&Rank::Bottom::globalToLocal)
|
.localCellIndex(&Rank::Bottom::globalToLocal)
|
||||||
.evalCellSource(&Rank::Bottom::cellSource);
|
.evalCellSource(&Rank::Bottom::cellSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCallbacks(const int rank,
|
void setCallbacks(const int rank,
|
||||||
Opm::ParallelWBPCalculation& wbpCalcService)
|
Opm::ParallelWBPCalculation<double>& wbpCalcService)
|
||||||
{
|
{
|
||||||
if (rank == 0) {
|
if (rank == 0) {
|
||||||
setCallbacksTop(wbpCalcService);
|
setCallbacksTop(wbpCalcService);
|
||||||
@ -508,7 +508,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Opm::ParallelWBPCalculation::EvaluatorFactory connSource(const int rank)
|
Opm::ParallelWBPCalculation<double>::EvaluatorFactory connSource(const int rank)
|
||||||
{
|
{
|
||||||
if (rank == 0) {
|
if (rank == 0) {
|
||||||
return Rank::Top::connSource();
|
return Rank::Top::connSource();
|
||||||
@ -551,7 +551,7 @@ namespace {
|
|||||||
|
|
||||||
Opm::Parallel::Communication comm;
|
Opm::Parallel::Communication comm;
|
||||||
Opm::GridDims cellIndexMap;
|
Opm::GridDims cellIndexMap;
|
||||||
Opm::ParallelWBPCalculation wbpCalcService;
|
Opm::ParallelWBPCalculation<double> wbpCalcService;
|
||||||
Opm::ParallelWellInfo<double> pwi;
|
Opm::ParallelWellInfo<double> pwi;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ BOOST_AUTO_TEST_CASE(Create)
|
|||||||
BOOST_REQUIRE_EQUAL(comm.size(), 2);
|
BOOST_REQUIRE_EQUAL(comm.size(), 2);
|
||||||
|
|
||||||
const Opm::GridDims dims{5, 5, 10};
|
const Opm::GridDims dims{5, 5, 10};
|
||||||
auto wbpCalcService = Opm::ParallelWBPCalculation {
|
auto wbpCalcService = Opm::ParallelWBPCalculation<double> {
|
||||||
dims, comm
|
dims, comm
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user