fixed: output of thresholdpressure to restart file in parallel

This commit is contained in:
Arne Morten Kvarving 2023-03-02 11:40:40 +01:00
parent 44b23af154
commit 153c4f486a
3 changed files with 34 additions and 2 deletions

View File

@ -220,6 +220,34 @@ configureThpresft_()
}
}
template<class Grid, class GridView, class ElementMapper, class Scalar>
std::vector<Scalar>
EclGenericThresholdPressure<Grid,GridView,ElementMapper,Scalar>::
getRestartVector() const
{
if (!enableThresholdPressure_)
return {};
std::vector<Scalar> result(numEquilRegions_ * numEquilRegions_, 0.0);
const auto& simConfig = eclState_.getSimulationConfig();
const auto& thpres = simConfig.getThresholdPressure();
std::size_t idx = 0;
for (unsigned j = 1; j <= numEquilRegions_; ++j) {
for (unsigned i = 1; i <= numEquilRegions_; ++i, ++idx) {
if (thpres.hasRegionBarrier(i, j)) {
if (thpres.hasThresholdPressure(i, j)) {
result[idx] = thpres.getThresholdPressure(i, j);
} else {
result[idx] = this->thpresDefault_[idx];
}
}
}
}
return result;
}
#if HAVE_DUNE_FEM
template class EclGenericThresholdPressure<Dune::CpGrid,
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,

View File

@ -72,6 +72,10 @@ public:
void setFromRestart(const std::vector<Scalar>& values)
{ thpres_ = values; }
//! \brief Returns a fully expanded vector for restart file writing.
//! \details Returns the union of explicitly configured entries and defaulted values.
std::vector<Scalar> getRestartVector() const;
protected:
/*!
* \brief Actually compute the threshold pressures over a face as a pre-compute step.
@ -90,7 +94,7 @@ protected:
const EclipseState& eclState_;
std::vector<Scalar> thpresDefault_;
std::vector<Scalar> thpres_;
unsigned numEquilRegions_;
unsigned numEquilRegions_{};
std::vector<unsigned char> elemEquilRegion_;
// threshold pressure accross faults. EXPERIMENTAL!

View File

@ -377,7 +377,7 @@ public:
this->actionState(),
this->udqState(),
this->summaryState(),
simulator_.problem().thresholdPressure().data(),
simulator_.problem().thresholdPressure().getRestartVector(),
curTime, nextStepSize,
EWOMS_GET_PARAM(TypeTag, bool, EclOutputDoublePrecision),
isFlowsn,