#3269 Compdat Export Performance : Load all data before loop

This commit is contained in:
Magne Sjaastad 2018-08-24 09:59:37 +02:00
parent b3a7dc943c
commit 5f52dae545
5 changed files with 78 additions and 11 deletions

View File

@ -142,15 +142,43 @@ std::vector<RigCompletionData>
// To handle several fractures in the same eclipse cell we need to keep track of the transmissibility
// to the well from each fracture intersecting the cell and sum these transmissibilities at the end.
// std::map <eclipseCellIndex ,map< fracture, trans> >
//std::map<size_t, std::map<const RimFracture*, double>> eclCellIdxToTransPrFractureMap;
// std::map<size_t, std::map<const RimFracture*, double>> eclCellIdxToTransPrFractureMap;
std::vector<std::vector<RigCompletionData>> sharedComplForFracture(fractures.size());
// Temporarily commented out due to sync problems. Needs more analysis
//#pragma omp parallel for
{
// Load the data required by computations to be able to use const access only inside OpenMP loop
std::vector<QString> resultNames = RigEclipseToStimPlanCellTransmissibilityCalculator::requiredResultNames();
if (!caseToApply->loadStaticResultsByName(resultNames))
{
QString msg;
msg += "Compdat Export : Required data missing. Required results ";
for (const auto& r : resultNames)
{
msg += " ";
msg += r;
}
RiaLogging::error(msg);
return fractureCompletions;
}
}
{
// Optional results
std::vector<QString> resultNames = RigEclipseToStimPlanCellTransmissibilityCalculator::optionalResultNames();
caseToApply->loadStaticResultsByName(resultNames);
}
// Temporarily commented out due to sync problems. Needs more analysis
//#pragma omp parallel for
for (int i = 0; i < (int)fractures.size(); i++)
{
RimFracture* fracture = fractures[i];
RimFracture* fracture = fractures[i];
RimFractureTemplate* fracTemplate = fracture->fractureTemplate();
if (!fracTemplate) continue;
@ -325,7 +353,7 @@ std::vector<RigCompletionData>
double trans = transCondenser.condensedTransmissibility(
externalCell, {true, RigTransmissibilityCondenser::CellAddress::WELL, 1});
//eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
// eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
RigCompletionData compDat(wellPathName,
RigCompletionDataGridCell(externalCell.m_globalCellIdx, caseToApply->mainGrid()),
@ -463,9 +491,9 @@ std::vector<RigCompletionData>
fractureDataReportItems->push_back(reportItem);
}
std::copy(
allCompletionsForOneFracture.begin(), allCompletionsForOneFracture.end(), std::back_inserter(sharedComplForFracture[i]));
std::copy(allCompletionsForOneFracture.begin(),
allCompletionsForOneFracture.end(),
std::back_inserter(sharedComplForFracture[i]));
if (outputStreamForIntermediateResultsText)
{

View File

@ -655,16 +655,24 @@ const RigCaseCellResultsData* RimEclipseCase::results(RiaDefines::PorosityModelT
/// Convenience function used to pre-load data before const access of data
/// Used when implementing calculations in a parallelized loop
//--------------------------------------------------------------------------------------------------
void RimEclipseCase::loadStaticResultsByName(const std::vector<QString>& resultNames)
bool RimEclipseCase::loadStaticResultsByName(const std::vector<QString>& resultNames)
{
bool foundDataForAllResults = true;
RigCaseCellResultsData* cellResultsData = this->results(RiaDefines::MATRIX_MODEL);
if(cellResultsData)
{
for (const auto& resultName : resultNames)
{
cellResultsData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, resultName);
size_t resultIdx = cellResultsData->findOrLoadScalarResult(RiaDefines::STATIC_NATIVE, resultName);
if (resultIdx == cvf::UNDEFINED_SIZE_T)
{
foundDataForAllResults = false;
}
}
}
return foundDataForAllResults;
}
//--------------------------------------------------------------------------------------------------

View File

@ -78,7 +78,7 @@ public:
RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel);
const RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel) const;
void loadStaticResultsByName(const std::vector<QString>& resultNames);
bool loadStaticResultsByName(const std::vector<QString>& resultNames);
RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel);
const RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel) const;

View File

@ -84,6 +84,34 @@ const RigFractureCell& RigEclipseToStimPlanCellTransmissibilityCalculator::fract
return m_stimPlanCell;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RigEclipseToStimPlanCellTransmissibilityCalculator::requiredResultNames()
{
std::vector<QString> resultNames;
resultNames.push_back("PERMX");
resultNames.push_back("PERMY");
resultNames.push_back("PERMZ");
resultNames.push_back("DX");
resultNames.push_back("DY");
resultNames.push_back("DZ");
return resultNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<QString> RigEclipseToStimPlanCellTransmissibilityCalculator::optionalResultNames()
{
std::vector<QString> resultNames;
resultNames.push_back("NTG");
return resultNames;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -50,6 +50,9 @@ public:
const std::vector<double>& contributingEclipseCellAreas() const;
const RigFractureCell& fractureCell() const;
static std::vector<QString> requiredResultNames();
static std::vector<QString> optionalResultNames();
private:
void calculateStimPlanCellsMatrixTransmissibility();
std::vector<size_t> getPotentiallyFracturedCellsForPolygon(const std::vector<cvf::Vec3d>& polygon) const;