From 6f3246690efa9c89d7f213615cc05f656fdb6caf Mon Sep 17 00:00:00 2001 From: lvjunjie Date: Wed, 10 Jun 2026 11:13:48 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=B0=83=E6=95=B4=E6=B1=82=E8=A7=A3=E5=89=8D?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=BD=91=E6=A0=BC=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E9=83=A8=E5=88=86=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=202.=E8=8E=B7=E5=8F=96=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=89=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0=E5=B0=B1=E9=83=BD=E7=94=A8?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nmCalculationDllPebiSolverTask.cpp | 10 ++- Src/nmNum/nmData/nmDataAnalyzeManager.cpp | 77 ++++++++++--------- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp b/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp index a88df79..a375443 100644 --- a/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp +++ b/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp @@ -129,9 +129,13 @@ bool nmCalculationDllPebiSolverTask::execPebiMode() HX_NWTM_MODEL_Fun HX_NWTM_MODEL = (HX_NWTM_MODEL_Fun)GetProcAddress(dll, "HX_NWTM_MODEL"); if(HX_NWTM_MODEL) { - if(pGridInstance->getGridOutput1().PEBI_cell.p.size() <= 0) { - // 先生成需要的输入参数p2 - pGridInstance->generateOutputPara(); + if(pGridInstance->getGridOutput1().PEBI_cell.p.size() <= 0 + || pDataInstance->getCalculationWells().isEmpty()) { + // 网格输出存在但井顺序为空时,重新生成p2并同步当前DataManager的计算井顺序 + if(!pGridInstance->generateOutputPara()) { + FreeLibrary(dll); + return false; + } } // 参数定义,使用默认参数 diff --git a/Src/nmNum/nmData/nmDataAnalyzeManager.cpp b/Src/nmNum/nmData/nmDataAnalyzeManager.cpp index 0de06d6..97ed17a 100644 --- a/Src/nmNum/nmData/nmDataAnalyzeManager.cpp +++ b/Src/nmNum/nmData/nmDataAnalyzeManager.cpp @@ -67,6 +67,7 @@ #include #include #include +#include namespace { // 清空指定目录下的所有旧文件和子目录,但保留目录本身 @@ -1635,94 +1636,100 @@ void nmDataAnalyzeManager::initPvtParaFromSubFit() bool bFetchedBo = false; bool bFetchedCo = false; bool bFetchedMiuo = false; + bool bFetchedBg = false; + bool bFetchedCg = false; + bool bFetchedMiug = false; bool bFetchedBw = false; bool bFetchedCw = false; bool bFetchedMiuw = false; - // PVT结果曲线直接按当前相态分支读取,缺失相态保留PEBI默认数据 + // PVT结果曲线直接按当前相态分支读取,任一必要曲线缺失则保留PEBI默认数据 switch(eType) { case WFT_Oil: - // 油体积系数 + // 单油相需要体积系数、压缩系数和粘度全部可获取 bFetchedBo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil, "Bo", vecX, vecBo); + bFetchedCo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil, "Co", vecX, vecCo); + bFetchedMiuo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil, "Miuo", vecX, vecMiuo); + if(!(bFetchedBo && bFetchedCo && bFetchedMiuo)) { + return; + } + + // 油体积系数 m_pebiPvtPara->setBo(vecBo); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 油压缩系数 - bFetchedCo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil, "Co", vecX, vecCo); m_pebiPvtPara->setCo(vecCo); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 油粘度 - bFetchedMiuo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil, "Miuo", vecX, vecMiuo); m_pebiPvtPara->setMiuo(vecMiuo); setPebiPressureIfEmpty(m_pebiPvtPara, vecX); - setSolverModelType( - bFetchedBo - && bFetchedCo - && bFetchedMiuo - ? SMT_Oil_VariablePvt - : SMT_Oil_ConstPvt); + setSolverModelType(SMT_Oil_VariablePvt); break; case WFT_Gas: setSolverModelType(SMT_Gas_VariablePvt); + // 气相缺少任一PVT曲线时提醒用户补齐参数勾选 + bFetchedBg = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Gas, "Bg", vecX, vecBg); + bFetchedCg = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Gas, "Cg", vecX, vecCg); + bFetchedMiug = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Gas, "Miug", vecX, vecMiug); + if(!(bFetchedBg && bFetchedCg && bFetchedMiug)) { + QMessageBox::warning(nullptr, tr("Warning"), tr("Please select all gas PVT parameters.")); + return; + } + // 气体积系数 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Gas, "Bg", vecX, vecBg); m_pebiPvtPara->setBg(vecBg); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 气压缩系数 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Gas, "Cg", vecX, vecCg); m_pebiPvtPara->setCg(vecCg); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 气粘度 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Gas, "Miug", vecX, vecMiug); m_pebiPvtPara->setMiug(vecMiug); setPebiPressureIfEmpty(m_pebiPvtPara, vecX); break; case WFT_Water: - // 水体积系数 + // 单水相需要体积系数、压缩系数和粘度全部可获取 bFetchedBw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Water, "Bw", vecX, vecBw); + bFetchedCw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Water, "Cw", vecX, vecCw); + bFetchedMiuw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Water, "Miuw", vecX, vecMiuw); + if(!(bFetchedBw && bFetchedCw && bFetchedMiuw)) { + setSolverModelType(SMT_Water_ConstPvt); + return; + } + + // 水体积系数 m_pebiPvtPara->setBw(vecBw); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 水压缩系数 - bFetchedCw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Water, "Cw", vecX, vecCw); m_pebiPvtPara->setCw(vecCw); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 水粘度 - bFetchedMiuw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Water, "Miuw", vecX, vecMiuw); m_pebiPvtPara->setMiuw(vecMiuw); setPebiPressureIfEmpty(m_pebiPvtPara, vecX); - setSolverModelType( - bFetchedBw - && bFetchedCw - && bFetchedMiuw - ? SMT_Water_VariablePvt - : SMT_Water_ConstPvt); + setSolverModelType(SMT_Water_VariablePvt); break; case WFT_Oil_Water: { setSolverModelType(SMT_Oil_Water_TwoPhase); + // 油水两相需要油、水两相体积系数和粘度全部可获取 + bFetchedBo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Bo", vecX, vecBo); + bFetchedMiuo = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Miuo", vecX, vecMiuo); + bFetchedBw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Bw", vecX, vecBw); + bFetchedMiuw = pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Miuw", vecX, vecMiuw); + if(!(bFetchedBo && bFetchedMiuo && bFetchedBw && bFetchedMiuw)) { + return; + } + // 油体积系数 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Bo", vecX, vecBo); m_pebiPvtPara->setBo(vecBo); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 油粘度 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Miuo", vecX, vecMiuo); m_pebiPvtPara->setMiuo(vecMiuo); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 水体积系数 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Bw", vecX, vecBw); m_pebiPvtPara->setBw(vecBw); - setPebiPressureIfEmpty(m_pebiPvtPara, vecX); // 水粘度 - pContextProvider->getPvtRstOf(pSubWndFitting, WellFluidType::WFT_Oil_Water, "Miuw", vecX, vecMiuw); m_pebiPvtPara->setMiuw(vecMiuw); setPebiPressureIfEmpty(m_pebiPvtPara, vecX);