mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 18:50:19 -06:00
[Refactor] Adapt to PINCH NNC separated from the normal ones.
This is also a preparation for correct MULTZ processing.
This commit is contained in:
parent
a56526607c
commit
4b3808fa93
@ -440,7 +440,9 @@ void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Eclips
|
||||
// when there is numerical aquifers, new NNC are generated during
|
||||
// grid processing we need to pass the NNC from root process to
|
||||
// other processes
|
||||
if ((has_numerical_aquifer || !pinchedNncData.empty()) && mpiSize > 1) {
|
||||
if ( mpiSize > 1)
|
||||
{
|
||||
if (has_numerical_aquifer) {
|
||||
auto nnc_input = eclState.getInputNNC();
|
||||
Parallel::MpiSerializer ser(grid_->comm());
|
||||
ser.broadcast(nnc_input);
|
||||
@ -448,6 +450,19 @@ void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Eclips
|
||||
eclState.setInputNNC(nnc_input);
|
||||
}
|
||||
}
|
||||
bool hasPinchNnc = eclState.hasPinchNNC();
|
||||
grid_->comm().broadcast(&hasPinchNnc, 1, 0);
|
||||
|
||||
if(hasPinchNnc)
|
||||
{
|
||||
auto pinch_nnc = eclState.getPinchNNC();
|
||||
Parallel::MpiSerializer ser(grid_->comm());
|
||||
ser.broadcast(pinch_nnc);
|
||||
if (mpiRank > 0) {
|
||||
eclState.setPinchNNC(std::move(pinch_nnc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -220,12 +220,15 @@ protected:
|
||||
*
|
||||
* \param cartesianToCompressed Vector containing the compressed index (or -1 for inactive
|
||||
* cells) as the element at the cartesian index.
|
||||
* \param pinchOption4ALL Whether option 4 of PINCH is set to ALL. In this cases transmissibilities
|
||||
* from the NNCs created by PINCH will overwrite.
|
||||
* \return Nothing.
|
||||
*/
|
||||
void applyNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompressed,
|
||||
bool pinchOption4ALL);
|
||||
void applyNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompressed);
|
||||
|
||||
/// \brief Applies the previous calculate transmissibilities to the NNCs created via PINCH
|
||||
///
|
||||
/// \param cartesianToCompressed Vector containing the compressed index (or -1 for inactive
|
||||
/// cells) as the element at the cartesian index.
|
||||
void applyPinchNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompressed);
|
||||
|
||||
/// \brief Multiplies the grid transmissibilities according to EDITNNC.
|
||||
void applyEditNncToGridTrans_(const std::unordered_map<std::size_t,int>& globalToLocal);
|
||||
|
@ -549,7 +549,8 @@ update(bool global, const TransUpdateQuantities update_quantities,
|
||||
// be seen in a parallel. Unfortunately, when we do not use transmissibilities
|
||||
// we will only see warnings for the partition of process 0 and also false positives.
|
||||
this->applyEditNncToGridTrans_(globalToLocal);
|
||||
this->applyNncToGridTrans_(globalToLocal, pinchOption4ALL);
|
||||
this->applyPinchNncToGridTrans_(globalToLocal);
|
||||
this->applyNncToGridTrans_(globalToLocal);
|
||||
this->applyEditNncrToGridTrans_(globalToLocal);
|
||||
if (applyNncMultregT) {
|
||||
this->applyNncMultreg_(globalToLocal);
|
||||
@ -1023,12 +1024,54 @@ computeFaceProperties(const Intersection& intersection,
|
||||
}
|
||||
}
|
||||
}
|
||||
template<class Grid, class GridView, class ElementMapper, class CartesianIndexMapper, class Scalar>
|
||||
void
|
||||
Transmissibility<Grid,GridView,ElementMapper,CartesianIndexMapper,Scalar>::
|
||||
applyPinchNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompressed)
|
||||
{
|
||||
// First scale NNCs with EDITNNC.
|
||||
const auto& nnc_input = eclState_.getPinchNNC();
|
||||
|
||||
for (const auto& nncEntry : nnc_input) {
|
||||
auto c1 = nncEntry.cell1;
|
||||
auto c2 = nncEntry.cell2;
|
||||
auto lowIt = cartesianToCompressed.find(c1);
|
||||
auto highIt = cartesianToCompressed.find(c2);
|
||||
int low = (lowIt == cartesianToCompressed.end())? -1 : lowIt->second;
|
||||
int high = (highIt == cartesianToCompressed.end())? -1 : highIt->second;
|
||||
|
||||
if (low > high)
|
||||
std::swap(low, high);
|
||||
|
||||
if (low == -1 && high == -1)
|
||||
// Silently discard as it is not between active cells
|
||||
continue;
|
||||
|
||||
if (low == -1 || high == -1) {
|
||||
// \todo Check why we end up here for some models in parallel
|
||||
// Discard the NNC if it is between active cell and inactive cell
|
||||
std::ostringstream sstr;
|
||||
sstr << "PINCH NNC between active and inactive cells ("
|
||||
<< low << " -> " << high << ") with globalcell is (" << c1 << "->" << c2 <<")";
|
||||
OpmLog::warning(sstr.str());
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
auto candidate = trans_.find(details::isId(low, high));
|
||||
if (candidate != trans_.end()) {
|
||||
// the correctly calculated transmissibility is stored in
|
||||
// the NNC. Overwrite previous value with it.
|
||||
candidate->second = nncEntry.trans;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Grid, class GridView, class ElementMapper, class CartesianIndexMapper, class Scalar>
|
||||
void
|
||||
Transmissibility<Grid,GridView,ElementMapper,CartesianIndexMapper,Scalar>::
|
||||
applyNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompressed,
|
||||
bool pinchOption4ALL)
|
||||
applyNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompressed)
|
||||
{
|
||||
// First scale NNCs with EDITNNC.
|
||||
const auto& nnc_input = eclState_.getInputNNC().input();
|
||||
@ -1060,19 +1103,10 @@ applyNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompr
|
||||
{
|
||||
auto candidate = trans_.find(details::isId(low, high));
|
||||
if (candidate != trans_.end()) {
|
||||
if (!pinchOption4ALL || nncEntry.notFromPinch)
|
||||
// NNC is represented by the grid and might be a neighboring connection
|
||||
// In this case the transmissibilty is added to the value already
|
||||
// set or computed.
|
||||
candidate->second += nncEntry.trans;
|
||||
else
|
||||
// Overwrite transmissibility in this special case.
|
||||
// Note that the NNC is represented by a normal vertical intersectionin CpGrid
|
||||
// that has a normal and an area (but maybe two different centers?).
|
||||
//. Hence we have calculated a transmissibilty for it.
|
||||
// That one might be correct if the option is TOPBOT but should be overwitten if
|
||||
// it is ALL
|
||||
candidate->second = nncEntry.trans;
|
||||
}
|
||||
}
|
||||
// if (enableEnergy_) {
|
||||
|
Loading…
Reference in New Issue
Block a user