mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: log ThresholdPressures to PRT file
This commit is contained in:
parent
e2ce26c031
commit
11bda0de07
@ -46,6 +46,8 @@
|
||||
#include <ebos/femcpgridcompat.hh>
|
||||
#endif // HAVE_DUNE_FEM
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
@ -248,6 +250,53 @@ getRestartVector() const
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class Grid, class GridView, class ElementMapper, class Scalar>
|
||||
void
|
||||
EclGenericThresholdPressure<Grid,GridView,ElementMapper,Scalar>::
|
||||
logPressures()
|
||||
{
|
||||
if (!enableThresholdPressure_)
|
||||
return;
|
||||
|
||||
auto lineFormat = [this](unsigned i, unsigned j, double val)
|
||||
{
|
||||
const auto& units = eclState_.getUnits();
|
||||
return fmt::format("{:4}{:>6}{:23}{:>6}{:24}{:>11.07}{:7}{}\n",
|
||||
" ", i,
|
||||
" ", j,
|
||||
" ", units.from_si(UnitSystem::measure::pressure, val),
|
||||
" ", units.name(UnitSystem::measure::pressure));
|
||||
};
|
||||
auto lineFormatS = [](auto s1, auto s2, auto s3)
|
||||
{
|
||||
return fmt::format("{:4}{:^16}{:13}{:^9}{:21}{:^18}\n",
|
||||
" ", s1, " ", s2, " ", s3);
|
||||
};
|
||||
|
||||
std::string str = "\nLIST OF ALL NON-ZERO THRESHOLD PRESSURES\n"
|
||||
"----------------------------------------\n"
|
||||
"\n";
|
||||
str += lineFormatS("FLOW FROM REGION", "TO REGION", "THRESHOLD PRESSURE");
|
||||
str += lineFormatS(std::string(16, '-'), std::string(9, '-'), std::string(18, '-'));
|
||||
const auto& simConfig = eclState_.getSimulationConfig();
|
||||
const auto& thpres = simConfig.getThresholdPressure();
|
||||
|
||||
for (unsigned i = 1; i <= numEquilRegions_; ++i) {
|
||||
for (unsigned j = (thpres.irreversible() ? 1 : i); j <= numEquilRegions_; ++j) {
|
||||
if (thpres.hasRegionBarrier(i, j)) {
|
||||
if (thpres.hasThresholdPressure(i, j)) {
|
||||
str += lineFormat(i, j, thpres.getThresholdPressure(j, i));
|
||||
} else {
|
||||
std::size_t idx = (j - 1) * numEquilRegions_ + (i - 1);
|
||||
str += lineFormat(i, j, this->thpresDefault_[idx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
str += lineFormatS(std::string(16, '-'), std::string(9, '-'), std::string(18, '-'));
|
||||
OpmLog::note(str);
|
||||
}
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
template class EclGenericThresholdPressure<Dune::CpGrid,
|
||||
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>,
|
||||
|
@ -88,6 +88,8 @@ protected:
|
||||
|
||||
void configureThpresft_();
|
||||
|
||||
void logPressures();
|
||||
|
||||
const CartesianIndexMapper& cartMapper_;
|
||||
const GridView& gridView_;
|
||||
const ElementMapper& elementMapper_;
|
||||
|
@ -154,6 +154,8 @@ private:
|
||||
// runs. (i.e. take the maximum of all processes)
|
||||
for (unsigned i = 0; i < this->thpresDefault_.size(); ++i)
|
||||
this->thpresDefault_[i] = gridView.comm().max(this->thpresDefault_[i]);
|
||||
|
||||
this->logPressures();
|
||||
}
|
||||
|
||||
const Simulator& simulator_;
|
||||
|
Loading…
Reference in New Issue
Block a user