ebos: make it work in parallel

This commit is contained in:
Andreas Lauser 2018-07-11 13:59:29 +02:00
parent 2c97fa302f
commit ed0542b53b
3 changed files with 35 additions and 15 deletions

View File

@ -47,13 +47,10 @@ BEGIN_PROPERTIES
NEW_TYPE_TAG(EclCpGridVanguard, INHERITS_FROM(EclBaseVanguard));
NEW_PROP_TAG(ExportGlobalTransmissibility);
// declare the properties
SET_TYPE_PROP(EclCpGridVanguard, Vanguard, Ewoms::EclCpGridVanguard<TypeTag>);
SET_TYPE_PROP(EclCpGridVanguard, Grid, Dune::CpGrid);
SET_TYPE_PROP(EclCpGridVanguard, EquilGrid, typename GET_PROP_TYPE(TypeTag, Grid));
SET_BOOL_PROP(EclCpGridVanguard, ExportGlobalTransmissibility, false);
END_PROPERTIES
@ -201,11 +198,6 @@ public:
delete cartesianIndexMapper_;
cartesianIndexMapper_ = nullptr;
if (!GET_PROP_VALUE(TypeTag, ExportGlobalTransmissibility)) {
delete globalTrans_;
globalTrans_ = nullptr;
}
}
#endif
@ -214,6 +206,17 @@ public:
this->updateGridView_();
}
/*!
* \brief Free the memory occupied by the global transmissibility object.
*
* After writing the initial solution, this array should not be necessary anymore.
*/
void releaseGlobalTransmissibilities()
{
delete globalTrans_;
globalTrans_ = nullptr;
}
/*!
* \brief Returns the object which maps a global element index of the simulation grid
* to the corresponding element index of the logically Cartesian index.

View File

@ -360,8 +360,15 @@ public:
for (; wellDofIt != wellDofEndIt; ++ wellDofIt) {
matrix[wellGlobalDofIdx][wellDofIt->first] = 0.0;
matrix[wellDofIt->first][wellGlobalDofIdx] = 0.0;
residual[wellGlobalDofIdx] = 0.0;
}
matrix[wellGlobalDofIdx][wellGlobalDofIdx] = diagBlock;
residual[wellGlobalDofIdx] = 0.0;
return;
}
else if (dofVariables_.empty()) {
// the well does not feature any perforations on the local process
matrix[wellGlobalDofIdx][wellGlobalDofIdx] = diagBlock;
residual[wellGlobalDofIdx] = 0.0;
return;
}
@ -701,11 +708,14 @@ public:
{
const auto& comm = simulator_.gridView().comm();
if (dofVariables_.size() == 0) {
int nTotal = dofVariables_.size();
nTotal = comm.sum(nTotal);
if (nTotal == 0) {
// well does not penetrate any active cell on any process. notify the
// user about this.
std::cout << "Well " << name() << " does not penetrate any active cell."
<< " Assuming it to be shut!\n";
setWellStatus(WellStatus::Shut);
return;
}
// determine the maximum depth of the well over all processes
@ -1038,9 +1048,14 @@ public:
auto& sol = const_cast<SolutionVector&>(simulator_.model().solution(/*timeIdx=*/0));
int wellGlobalDof = AuxModule::localToGlobalDof(/*localDofIdx=*/0);
// retrieve the bottom hole pressure from the global system of equations
actualBottomHolePressure_ = Toolbox::value(dofVariables_.begin()->second->pressure[0]);
actualBottomHolePressure_ = computeRateEquivalentBhp_();
if (!dofVariables_.empty()) {
// retrieve the bottom hole pressure from the global system of equations
actualBottomHolePressure_ = Toolbox::value(dofVariables_.begin()->second->pressure[0]);
actualBottomHolePressure_ = computeRateEquivalentBhp_();
}
else
// start with 300 bars if we don't have anything better
actualBottomHolePressure_ = 300 * 1e5;
sol[wellGlobalDof][0] = actualBottomHolePressure_;

View File

@ -558,8 +558,10 @@ public:
maxPolymerAdsorption_.resize(numElements, 0.0);
}
if (eclWriter_)
if (eclWriter_) {
eclWriter_->writeInit();
this->simulator().vanguard().releaseGlobalTransmissibilities();
}
}
void prefetch(const Element& elem) const