mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3269 Compdat Export Performance : Load all data before loop
This commit is contained in:
@@ -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 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.
|
// to the well from each fracture intersecting the cell and sum these transmissibilities at the end.
|
||||||
// std::map <eclipseCellIndex ,map< fracture, trans> >
|
// 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());
|
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++)
|
for (int i = 0; i < (int)fractures.size(); i++)
|
||||||
{
|
{
|
||||||
RimFracture* fracture = fractures[i];
|
RimFracture* fracture = fractures[i];
|
||||||
RimFractureTemplate* fracTemplate = fracture->fractureTemplate();
|
RimFractureTemplate* fracTemplate = fracture->fractureTemplate();
|
||||||
|
|
||||||
if (!fracTemplate) continue;
|
if (!fracTemplate) continue;
|
||||||
@@ -325,7 +353,7 @@ std::vector<RigCompletionData>
|
|||||||
double trans = transCondenser.condensedTransmissibility(
|
double trans = transCondenser.condensedTransmissibility(
|
||||||
externalCell, {true, RigTransmissibilityCondenser::CellAddress::WELL, 1});
|
externalCell, {true, RigTransmissibilityCondenser::CellAddress::WELL, 1});
|
||||||
|
|
||||||
//eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
|
// eclCellIdxToTransPrFractureMap[externalCell.m_globalCellIdx][fracture] = trans;
|
||||||
|
|
||||||
RigCompletionData compDat(wellPathName,
|
RigCompletionData compDat(wellPathName,
|
||||||
RigCompletionDataGridCell(externalCell.m_globalCellIdx, caseToApply->mainGrid()),
|
RigCompletionDataGridCell(externalCell.m_globalCellIdx, caseToApply->mainGrid()),
|
||||||
@@ -463,9 +491,9 @@ std::vector<RigCompletionData>
|
|||||||
fractureDataReportItems->push_back(reportItem);
|
fractureDataReportItems->push_back(reportItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy(
|
std::copy(allCompletionsForOneFracture.begin(),
|
||||||
allCompletionsForOneFracture.begin(), allCompletionsForOneFracture.end(), std::back_inserter(sharedComplForFracture[i]));
|
allCompletionsForOneFracture.end(),
|
||||||
|
std::back_inserter(sharedComplForFracture[i]));
|
||||||
|
|
||||||
if (outputStreamForIntermediateResultsText)
|
if (outputStreamForIntermediateResultsText)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -655,16 +655,24 @@ const RigCaseCellResultsData* RimEclipseCase::results(RiaDefines::PorosityModelT
|
|||||||
/// Convenience function used to pre-load data before const access of data
|
/// Convenience function used to pre-load data before const access of data
|
||||||
/// Used when implementing calculations in a parallelized loop
|
/// 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);
|
RigCaseCellResultsData* cellResultsData = this->results(RiaDefines::MATRIX_MODEL);
|
||||||
if(cellResultsData)
|
if(cellResultsData)
|
||||||
{
|
{
|
||||||
for (const auto& resultName : resultNames)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
|
|
||||||
RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel);
|
RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel);
|
||||||
const RigCaseCellResultsData* results(RiaDefines::PorosityModelType porosityModel) const;
|
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);
|
RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel);
|
||||||
const RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel) const;
|
const RimReservoirCellResultsStorage* resultsStorage(RiaDefines::PorosityModelType porosityModel) const;
|
||||||
|
|||||||
@@ -84,6 +84,34 @@ const RigFractureCell& RigEclipseToStimPlanCellTransmissibilityCalculator::fract
|
|||||||
return m_stimPlanCell;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ public:
|
|||||||
const std::vector<double>& contributingEclipseCellAreas() const;
|
const std::vector<double>& contributingEclipseCellAreas() const;
|
||||||
const RigFractureCell& fractureCell() const;
|
const RigFractureCell& fractureCell() const;
|
||||||
|
|
||||||
|
static std::vector<QString> requiredResultNames();
|
||||||
|
static std::vector<QString> optionalResultNames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void calculateStimPlanCellsMatrixTransmissibility();
|
void calculateStimPlanCellsMatrixTransmissibility();
|
||||||
std::vector<size_t> getPotentiallyFracturedCellsForPolygon(const std::vector<cvf::Vec3d>& polygon) const;
|
std::vector<size_t> getPotentiallyFracturedCellsForPolygon(const std::vector<cvf::Vec3d>& polygon) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user