adjust to PAvgDynamicSourceData templating

This commit is contained in:
Arne Morten Kvarving
2024-04-11 10:21:02 +02:00
parent 1d92aa952d
commit 59e6d4db08
5 changed files with 24 additions and 22 deletions

View File

@@ -89,13 +89,15 @@ namespace Opm {
this->alternative_well_rate_init_ =
Parameters::get<TypeTag, Properties::AlternativeWellRateInit>();
using SourceDataSpan =
typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;
this->wbpCalculationService_
.localCellIndex([this](const std::size_t globalIndex)
{ return this->compressedIndexForInterior(globalIndex); })
.evalCellSource([this](const int localCell,
PAvgDynamicSourceData::SourceDataSpan<Scalar> sourceTerms)
.evalCellSource([this](const int localCell,
SourceDataSpan sourceTerms)
{
using Item = typename PAvgDynamicSourceData::SourceDataSpan<Scalar>::Item;
using Item = typename SourceDataSpan::Item;
const auto* intQuants = this->simulator_.model()
.cachedIntensiveQuantities(localCell, /*timeIndex = */0);
@@ -2077,7 +2079,7 @@ namespace Opm {
BlackoilWellModel<TypeTag>::
makeWellSourceEvaluatorFactory(const std::vector<Well>::size_type wellIdx) const
{
using Span = PAvgDynamicSourceData::SourceDataSpan<Scalar>;
using Span = typename PAvgDynamicSourceData<Scalar>::template SourceDataSpan<Scalar>;
using Item = typename Span::Item;
return [wellIdx, this]() -> ParallelWBPCalculation::Evaluator

View File

@@ -105,7 +105,7 @@ finaliseConstruction(const std::vector<std::size_t>& sourceLocations,
this->defineCommunication();
}
Opm::PAvgDynamicSourceData::SourceDataSpan<double>
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double>
Opm::ParallelPAvgDynamicSourceData::localSourceTerm(const std::size_t localIx)
{
return this->sourceTerm(localIx, this->localSrc_);

View File

@@ -32,7 +32,7 @@ namespace Opm {
/// Dynamic source data for block-average pressure calculations.
/// Specialisation for parallel runs.
class ParallelPAvgDynamicSourceData : public PAvgDynamicSourceData
class ParallelPAvgDynamicSourceData : public PAvgDynamicSourceData<double>
{
public:
/// Translate globally unique, linearised Cartesian cell indices to

View File

@@ -214,9 +214,9 @@ namespace {
}
void cellSource(const int cell,
Opm::PAvgDynamicSourceData::SourceDataSpan<double> src)
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double> src)
{
using Item = Opm::PAvgDynamicSourceData::SourceDataSpan<double>::Item;
using Item = Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double>::Item;
src .set(Item::Pressure , pressure(cell))
.set(Item::PoreVol , porevol (cell))
@@ -239,10 +239,10 @@ namespace {
auto rho = std::vector { 0.1, 0.12, 0.14, };
return [rho = std::move(rho)]
(const int connIx,
Opm::PAvgDynamicSourceData::SourceDataSpan<double> src)
(const int connIx,
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double> src)
{
using Item = Opm::PAvgDynamicSourceData::SourceDataSpan<double>::Item;
using Item = Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double>::Item;
src .set(Item::Pressure , 1222.0)
.set(Item::PoreVol , 1.25)
@@ -353,10 +353,10 @@ namespace {
});
}
void cellSource(const int cell,
Opm::PAvgDynamicSourceData::SourceDataSpan<double> src)
void cellSource(const int cell,
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double> src)
{
using Item = Opm::PAvgDynamicSourceData::SourceDataSpan<double>::Item;
using Item = Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double>::Item;
src .set(Item::Pressure , pressure(cell))
.set(Item::PoreVol , porevol (cell))
@@ -379,10 +379,10 @@ namespace {
auto rho = std::vector { 0.16, 0.18, 0.2, };
return [rho = std::move(rho)]
(const int connIx,
Opm::PAvgDynamicSourceData::SourceDataSpan<double> src)
(const int connIx,
Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double> src)
{
using Item = Opm::PAvgDynamicSourceData::SourceDataSpan<double>::Item;
using Item = Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double>::Item;
src .set(Item::Pressure , 1222.0)
.set(Item::PoreVol , 1.25)

View File

@@ -108,7 +108,7 @@ private:
class CalculateSourceTerm
{
public:
using SrcTerm = Opm::PAvgDynamicSourceData::SourceDataSpan<double>;
using SrcTerm = Opm::PAvgDynamicSourceData<double>::SourceDataSpan<double>;
explicit CalculateSourceTerm(const std::size_t rank)
: rank_ { rank }
@@ -129,11 +129,11 @@ private:
};
std::size_t
sourceTermsAreCorrect(const std::size_t comm_size,
const std::size_t num_src,
const Opm::PAvgDynamicSourceData& source_data)
sourceTermsAreCorrect(const std::size_t comm_size,
const std::size_t num_src,
const Opm::PAvgDynamicSourceData<double>& source_data)
{
using Item = Opm::PAvgDynamicSourceData::SourceDataSpan<const double>::Item;
using Item = Opm::PAvgDynamicSourceData<double>::SourceDataSpan<const double>::Item;
auto num_correct = 0*num_src;