From a94bc0ac70ea4d0c81e519a49e9ff3ece3080c60 Mon Sep 17 00:00:00 2001 From: lh <2334563547@qq.com> Date: Fri, 12 Jun 2026 14:21:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ConstPvt=E6=A8=A1=E5=9E=8B=E8=A1=A5?= =?UTF-8?q?=E5=85=85=E5=8E=8B=E5=8A=9B=E6=A8=AA=E5=9D=90=E6=A0=87=E5=8D=A0?= =?UTF-8?q?=E4=BD=8D=E6=95=B0=E7=BB=84=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E9=95=BF=E5=BA=A6=E4=B8=8D=E5=8C=B9=E9=85=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nmCalculationDllPebiSolverTask.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp b/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp index 265193d..a3be736 100644 --- a/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp +++ b/Src/nmNum/nmCalculation/nmCalculationDllPebiSolverTask.cpp @@ -86,6 +86,16 @@ dVec1 expandConstPvt(double dValue, int nSize = 200) return dVec1(nSize, dValue); } +/// @brief 生成线性占位压力数组(常数PVT无曲线数据时使用) +/// @param nSize 数组大小,默认200 +/// @return [1, 2, ..., nSize] 的 dVec1 数组 +dVec1 generateDummyPressure(int nSize = 200) +{ + dVec1 vecP(nSize, 0); + for(int i = 0; i < nSize; ++i) { vecP[i] = (i + 1.0); } + return vecP; +} + /// @brief 根据求解器模型类型填充PVT输入数据 /// 常数PVT模型从 reservoir 读单值并扩展为200元素数组 /// 变化PVT模型从 pebiPvtPara 读曲线数组 @@ -98,14 +108,15 @@ void fillPvtInputByModel(HX_NWTM_MODEL_INPUT& input, nmDataPvtParaForPebi* pPvt, nmDataReservoir* pRes) { - // 压力横坐标始终从 pebiPvtPara 读取 + // 压力横坐标:变化PVT从曲线读取,常数PVT生成占位数组 if(pPvt != nullptr) { assignPvtVectorIfNotEmpty(input.PVT.p, pPvt->getPressure()); } switch(eModelType) { case SMT_Oil_ConstPvt: - // 油相常数PVT:单值扩展为200元素数组 + // 油相常数PVT:生成占位压力数组 + 单值扩展为200元素数组 + input.PVT.p = generateDummyPressure(); if(pRes != nullptr) { input.PVT.Bo = expandConstPvt(pRes->getBo().getValue().toDouble()); input.PVT.miuo = expandConstPvt(pRes->getMiuo().getValue().toDouble()); @@ -122,7 +133,8 @@ void fillPvtInputByModel(HX_NWTM_MODEL_INPUT& input, break; case SMT_Water_ConstPvt: - // 水相常数PVT:单值扩展为200元素数组 + // 水相常数PVT:生成占位压力数组 + 单值扩展为200元素数组 + input.PVT.p = generateDummyPressure(); if(pRes != nullptr) { input.PVT.Bw = expandConstPvt(pRes->getBw().getValue().toDouble()); input.PVT.miuw = expandConstPvt(pRes->getMiuw().getValue().toDouble());