mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Extract addLgrs, invoke it after loadBalance
This commit is contained in:
parent
ca550d325d
commit
3e59fcb92a
@ -110,6 +110,17 @@ public:
|
||||
updateGridView_();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add LGRs to the grid, if any. Only supported for CpGrid - for now.
|
||||
*/
|
||||
void addLgrs()
|
||||
{
|
||||
if(&asImp_() != this) {
|
||||
asImp_().addLgrs();
|
||||
updateGridView_();
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
// this method should be called after the grid has been allocated
|
||||
void finalizeInit_()
|
||||
|
@ -183,6 +183,19 @@ public:
|
||||
checkParallelException("Could not distribute the vanguard data: ",
|
||||
exceptionThrown, what);
|
||||
|
||||
// Only relevant for CpGrid
|
||||
if (verbose_)
|
||||
std::cout << "Adding LGRs, if any\n" << std::flush;
|
||||
|
||||
try
|
||||
{ vanguard_->addLgrs(); }
|
||||
catch (const std::exception& e) {
|
||||
catchAction(e, verbose_);
|
||||
}
|
||||
checkParallelException("Adding LGRs to the simulation vanguard failed: ",
|
||||
exceptionThrown, what);
|
||||
|
||||
|
||||
if (verbose_)
|
||||
std::cout << "Allocating the model\n" << std::flush;
|
||||
try {
|
||||
|
@ -196,7 +196,12 @@ public:
|
||||
globalTrans_->update(false, TransmissibilityType::TransUpdateQuantities::Trans,
|
||||
[&](unsigned int i) { return gridEquilIdxToGridIdx(i);});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void addLgrs()
|
||||
{
|
||||
// do nothing: AluGrid with LGRs not supported yet!
|
||||
}
|
||||
|
||||
template<class DataHandle>
|
||||
|
@ -247,9 +247,23 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Add LGRs and update Leaf Grid View in the simulation grid.
|
||||
*/
|
||||
void addLgrs()
|
||||
{
|
||||
// Check if input file contains Lgrs.
|
||||
//
|
||||
// If there are lgrs, create the grid with them, and update the leaf grid view.
|
||||
if (const auto& lgrs = this->eclState().getLgrs(); lgrs.size() > 0) {
|
||||
OpmLog::info("\nAdding LGRs to the grid and updating its leaf grid view");
|
||||
this->addLgrsUpdateLeafView(lgrs, lgrs.size(), *this->grid_);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int gridEquilIdxToGridIdx(unsigned int elemIndex) const {
|
||||
return elemIndex;
|
||||
}
|
||||
return elemIndex;
|
||||
}
|
||||
|
||||
unsigned int gridIdxToEquilGridIdx(unsigned int elemIndex) const {
|
||||
return elemIndex;
|
||||
|
@ -481,15 +481,6 @@ void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Eclips
|
||||
|
||||
cartesianIndexMapper_ = std::make_unique<CartesianIndexMapper>(*grid_);
|
||||
|
||||
// --- Add LGRs and update Leaf Grid View ---
|
||||
// Check if input file contains Lgrs.
|
||||
//
|
||||
// If there are lgrs, create the grid with them, and update the leaf grid view.
|
||||
if (const auto& lgrs = eclState.getLgrs(); lgrs.size() > 0) {
|
||||
OpmLog::info("\nAdding LGRs to the grid and updating its leaf grid view");
|
||||
this->addLgrsUpdateLeafView(lgrs, lgrs.size(), *this->grid_);
|
||||
}
|
||||
|
||||
#if HAVE_MPI
|
||||
if (this->grid_->comm().size() > 1) {
|
||||
// Numerical aquifers generate new NNCs during grid processing. We
|
||||
@ -520,7 +511,7 @@ void GenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Eclips
|
||||
}
|
||||
#endif
|
||||
|
||||
// --- Copy grid with LGRs to equilGrid_ ---
|
||||
// --- Copy grid to equilGrid_ ---
|
||||
// We use separate grid objects: one for the calculation of the initial
|
||||
// condition via EQUIL and one for the actual simulation. The reason is
|
||||
// that the EQUIL code is allergic to distributed grids and the
|
||||
|
@ -164,6 +164,10 @@ public:
|
||||
{ /* do nothing: PolyhedralGrid is not parallel! */
|
||||
}
|
||||
|
||||
void addLgrs()
|
||||
{ /* do nothing: PolyhedralGrid with LGRs not supported yet! */
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the object which maps a global element index of the simulation grid
|
||||
* to the corresponding element index of the logically Cartesian index.
|
||||
|
Loading…
Reference in New Issue
Block a user