mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve robustness of well flow calculator
This commit is contained in:
parent
baf379701c
commit
911f260d0f
@ -465,7 +465,7 @@ RigWellAllocationOverTime RimWellAllocationOverTimePlot::createWellAllocationOve
|
||||
|
||||
const auto& [pipeBranchesCLCoords, pipeBranchesCellIds] = RigSimulationWellCenterLineCalculator::extractBranchData( simWellBranches );
|
||||
|
||||
if ( tracerFractionCellValues.size() )
|
||||
if ( !tracerFractionCellValues.empty() && !pipeBranchesCLCoords.empty() )
|
||||
{
|
||||
bool isProducer = ( simWellData->wellProductionType( i ) == RiaDefines::WellProductionType::PRODUCER ||
|
||||
simWellData->wellProductionType( i ) == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
|
||||
@ -480,12 +480,12 @@ RigWellAllocationOverTime RimWellAllocationOverTimePlot::createWellAllocationOve
|
||||
isProducer );
|
||||
timeStepAndCalculatorPairs.emplace( allTimeSteps[i], calculator );
|
||||
}
|
||||
else if ( pipeBranchesCLCoords.size() > 0 )
|
||||
else if ( !pipeBranchesCLCoords.empty() )
|
||||
{
|
||||
const auto calculator = RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold );
|
||||
// NOTE: Would like to prevent this check. Is added due to calculator.tracerNames() gives
|
||||
// "oil", "water" and "gas" as return value when calculator.totalTracerFractions().size() = 0
|
||||
if ( calculator.totalTracerFractions().size() > 0 )
|
||||
if ( !calculator.totalTracerFractions().empty() )
|
||||
{
|
||||
timeStepAndCalculatorPairs.emplace( allTimeSteps[i], calculator );
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
double smallContributionThreshold = 0.0;
|
||||
if ( m_groupSmallContributions() ) smallContributionThreshold = m_smallContributionsThreshold;
|
||||
|
||||
if ( tracerFractionCellValues.size() )
|
||||
if ( !tracerFractionCellValues.empty() && !pipeBranchesCLCoords.empty() )
|
||||
{
|
||||
bool isProducer = ( simWellData->wellProductionType( m_timeStep ) == RiaDefines::WellProductionType::PRODUCER ||
|
||||
simWellData->wellProductionType( m_timeStep ) == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
|
||||
@ -277,7 +277,7 @@ void RimWellAllocationPlot::updateFromWell()
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pipeBranchesCLCoords.size() > 0 )
|
||||
if ( !pipeBranchesCLCoords.empty() )
|
||||
{
|
||||
wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold ) );
|
||||
}
|
||||
|
@ -1224,7 +1224,8 @@ void RimWellConnectivityTable::createAndEmplaceTimeStepAndCalculatorPairInMap( s
|
||||
|
||||
std::map<QString, const std::vector<double>*> tracerFractionCellValues =
|
||||
RimWellAllocationTools::findOrCreateRelevantTracerCellFractions( simWellData, m_flowDiagSolution, timeStepIndex );
|
||||
if ( !tracerFractionCellValues.empty() )
|
||||
|
||||
if ( !tracerFractionCellValues.empty() && !pipeBranchesCLCoords.empty() )
|
||||
{
|
||||
bool isProducer = ( simWellData->wellProductionType( timeStepIndex ) == RiaDefines::WellProductionType::PRODUCER ||
|
||||
simWellData->wellProductionType( timeStepIndex ) == RiaDefines::WellProductionType::UNDEFINED_PRODUCTION_TYPE );
|
||||
|
@ -80,6 +80,8 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator( const std::vector<std::vecto
|
||||
, m_isProducer( isProducer )
|
||||
, m_useTotalWellPhaseRateOnly( false )
|
||||
{
|
||||
CVF_ASSERT( !pipeBranchesWellResultPoints.empty() );
|
||||
|
||||
m_connectionFlowPrBranch.resize( m_pipeBranchesWellResultPoints.size() );
|
||||
m_pseudoLengthFlowPrBranch.resize( m_pipeBranchesWellResultPoints.size() );
|
||||
|
||||
@ -108,6 +110,8 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator( const std::vector<std::vecto
|
||||
, m_isProducer( true )
|
||||
, m_useTotalWellPhaseRateOnly( false )
|
||||
{
|
||||
CVF_ASSERT( !pipeBranchesWellResultPoints.empty() );
|
||||
|
||||
m_connectionFlowPrBranch.resize( m_pipeBranchesWellResultPoints.size() );
|
||||
m_pseudoLengthFlowPrBranch.resize( m_pipeBranchesWellResultPoints.size() );
|
||||
|
||||
@ -141,6 +145,8 @@ RigAccWellFlowCalculator::RigAccWellFlowCalculator( const std::vector<cvf::Vec3d
|
||||
, m_isProducer( true )
|
||||
, m_useTotalWellPhaseRateOnly( totalFlowOnly )
|
||||
{
|
||||
CVF_ASSERT( !pipeBranchesWellResultPoints.empty() );
|
||||
|
||||
m_pipeBranchesCLCoords.push_back( pipeBranchCLCoords );
|
||||
m_pipeBranchesWellResultPoints.push_back( pipeBranchesWellResultPoints );
|
||||
m_pipeBranchesMeasuredDepths.push_back( pipeBranchMeasuredDepths );
|
||||
|
Loading…
Reference in New Issue
Block a user