|
|
|
@ -30,6 +30,114 @@
|
|
|
|
#include <vtkType.h>
|
|
|
|
#include <vtkType.h>
|
|
|
|
#include <vtkUnsignedCharArray.h>
|
|
|
|
#include <vtkUnsignedCharArray.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int CONST_PVT_POINT_COUNT = 200;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<double> buildConstantPvtVector(double value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return std::vector<double>(CONST_PVT_POINT_COUNT, value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<double> buildConstantPvtPressure()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::vector<double> pressure(CONST_PVT_POINT_COUNT, 0.0);
|
|
|
|
|
|
|
|
for(int i = 0; i < CONST_PVT_POINT_COUNT; ++i) {
|
|
|
|
|
|
|
|
pressure[i] = i + 1.0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return pressure;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString solverModelFileTag(NM_SOLVER_MODEL_TYPE modelType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch(modelType) {
|
|
|
|
|
|
|
|
case SMT_Oil_ConstPvt:
|
|
|
|
|
|
|
|
return "T1_oil_const_pvt";
|
|
|
|
|
|
|
|
case SMT_Oil_VariablePvt:
|
|
|
|
|
|
|
|
return "T2_oil_variable_pvt";
|
|
|
|
|
|
|
|
case SMT_Water_ConstPvt:
|
|
|
|
|
|
|
|
return "T3_water_const_pvt";
|
|
|
|
|
|
|
|
case SMT_Water_VariablePvt:
|
|
|
|
|
|
|
|
return "T4_water_variable_pvt";
|
|
|
|
|
|
|
|
case SMT_Gas_VariablePvt:
|
|
|
|
|
|
|
|
return "T5_gas_variable_pvt";
|
|
|
|
|
|
|
|
case SMT_Oil_Water_TwoPhase:
|
|
|
|
|
|
|
|
return "T8_oil_water_two_phase";
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return QString("T%1_unsupported").arg(static_cast<int>(modelType));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void fillScenePvtByModel(nmDataBinaryTools::NM_PEBI_SCENE& scene,
|
|
|
|
|
|
|
|
NM_SOLVER_MODEL_TYPE modelType,
|
|
|
|
|
|
|
|
nmDataPvtParaForPebi* pvt,
|
|
|
|
|
|
|
|
nmDataReservoir* reservoir)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch(modelType) {
|
|
|
|
|
|
|
|
case SMT_Oil_ConstPvt:
|
|
|
|
|
|
|
|
scene.PVT.p = buildConstantPvtPressure();
|
|
|
|
|
|
|
|
if(reservoir != nullptr) {
|
|
|
|
|
|
|
|
scene.PVT.Bo = buildConstantPvtVector(reservoir->getBo().getValue().toDouble());
|
|
|
|
|
|
|
|
scene.PVT.miuo = buildConstantPvtVector(reservoir->getMiuo().getValue().toDouble());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SMT_Oil_VariablePvt:
|
|
|
|
|
|
|
|
if(pvt != nullptr) {
|
|
|
|
|
|
|
|
scene.PVT.p = pvt->getPressure().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bo = pvt->getBo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Co = pvt->getCo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miuo = pvt->getMiuo().toStdVector();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SMT_Water_ConstPvt:
|
|
|
|
|
|
|
|
scene.PVT.p = buildConstantPvtPressure();
|
|
|
|
|
|
|
|
if(reservoir != nullptr) {
|
|
|
|
|
|
|
|
scene.PVT.Bw = buildConstantPvtVector(reservoir->getBw().getValue().toDouble());
|
|
|
|
|
|
|
|
scene.PVT.miuw = buildConstantPvtVector(reservoir->getMiuw().getValue().toDouble());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SMT_Water_VariablePvt:
|
|
|
|
|
|
|
|
if(pvt != nullptr) {
|
|
|
|
|
|
|
|
scene.PVT.p = pvt->getPressure().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bw = pvt->getBw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Cw = pvt->getCw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miuw = pvt->getMiuw().toStdVector();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SMT_Gas_VariablePvt:
|
|
|
|
|
|
|
|
case SMT_Gas_PseudoPressure:
|
|
|
|
|
|
|
|
if(pvt != nullptr) {
|
|
|
|
|
|
|
|
scene.PVT.p = pvt->getPressure().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bg = pvt->getBg().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Cg = pvt->getCg().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miug = pvt->getMiug().toStdVector();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case SMT_Oil_Water_TwoPhase:
|
|
|
|
|
|
|
|
if(pvt != nullptr) {
|
|
|
|
|
|
|
|
scene.PVT.p = pvt->getPressure().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bo = pvt->getBo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miuo = pvt->getMiuo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bw = pvt->getBw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miuw = pvt->getMiuw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.So = pvt->getSo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Kro = pvt->getKro().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Krw = pvt->getKrw().toStdVector();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
#include <windows.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#define DEBUG_OUT(msg) OutputDebugStringA(QString("[Mesh] %1\n").arg(msg).toLocal8Bit().data())
|
|
|
|
#define DEBUG_OUT(msg) OutputDebugStringA(QString("[Mesh] %1\n").arg(msg).toLocal8Bit().data())
|
|
|
|
@ -814,18 +922,10 @@ bool nmCalculationPebiGrid::generateOutputPara()
|
|
|
|
|
|
|
|
|
|
|
|
// ===== 3. 求解器参数 =====
|
|
|
|
// ===== 3. 求解器参数 =====
|
|
|
|
|
|
|
|
|
|
|
|
// 3.1 求解器类型
|
|
|
|
// 3.1 求解器类型:与真实求解器使用同一个模型类型,不再根据相态推断。
|
|
|
|
nmDataReservoir* pReservoirData = dm->getReservoirData();
|
|
|
|
nmDataReservoir* pReservoirData = dm->getReservoirData();
|
|
|
|
|
|
|
|
NM_SOLVER_MODEL_TYPE solverModelType = dm->getSolverModelType();
|
|
|
|
if(pReservoirData) {
|
|
|
|
scene.solverType = static_cast<int>(solverModelType);
|
|
|
|
if(pReservoirData->getPhaseType() == PHASE_Oil) {
|
|
|
|
|
|
|
|
scene.solverType = 2; // 油单相变化PVT
|
|
|
|
|
|
|
|
} else if(pReservoirData->getPhaseType() == PHASE_Gas) {
|
|
|
|
|
|
|
|
scene.solverType = 5; // 气单相变化PVT
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
scene.solverType = 1; // 默认油单相
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3.2 Rate流量数据
|
|
|
|
// 3.2 Rate流量数据
|
|
|
|
scene.Rate.t.resize(order.size());
|
|
|
|
scene.Rate.t.resize(order.size());
|
|
|
|
@ -925,42 +1025,9 @@ bool nmCalculationPebiGrid::generateOutputPara()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 3.5 PVT数据
|
|
|
|
// 3.5 PVT数据:常数PVT和变化PVT采用与真实求解器相同的填充方式。
|
|
|
|
nmDataPvtParaForPebi* pvt = dm->getPebiPvtPara();
|
|
|
|
nmDataPvtParaForPebi* pvt = dm->getPebiPvtPara();
|
|
|
|
|
|
|
|
fillScenePvtByModel(scene, solverModelType, pvt, pReservoirData);
|
|
|
|
if(pvt) {
|
|
|
|
|
|
|
|
scene.PVT.p = pvt->getPressure().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Rso = pvt->getRso().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.pb = pvt->getPb().getValue().toDouble();
|
|
|
|
|
|
|
|
scene.PVT.Bo = pvt->getBo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Co = pvt->getCo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miuo = pvt->getMiuo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.rouo = pvt->getRouo().toStdVector();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scene.PVT.Rv = pvt->getRv().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bg = pvt->getBg().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Cg = pvt->getCg().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miug = pvt->getMiug().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.roug = pvt->getRoug().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Z = pvt->getZ().toStdVector();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scene.PVT.Rsw = pvt->getRsw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Bw = pvt->getBw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Cw = pvt->getCw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.miuw = pvt->getMiuw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.rouw = pvt->getRouw().toStdVector();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scene.PVT.V = pvt->getV().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.k_kinitial = pvt->getKKinitial().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Cf_Cfinitial = pvt->getCfCfinitial().toStdVector();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scene.PVT.So = pvt->getSo().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Kro = pvt->getKro().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Sg = pvt->getSg().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Krg = pvt->getKrg().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Sw = pvt->getSw().toStdVector();
|
|
|
|
|
|
|
|
scene.PVT.Krw = pvt->getKrw().toStdVector();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3.6 Base储层参数
|
|
|
|
// 3.6 Base储层参数
|
|
|
|
if(pReservoirData) {
|
|
|
|
if(pReservoirData) {
|
|
|
|
@ -996,16 +1063,27 @@ bool nmCalculationPebiGrid::generateOutputPara()
|
|
|
|
dataDir.mkpath("."); // 确保 Data 目录存在
|
|
|
|
dataDir.mkpath("."); // 确保 Data 目录存在
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString outPath = dataDir.filePath("scene.bin");
|
|
|
|
QString typedFileName = QString("scene_%1.bin").arg(solverModelFileTag(solverModelType));
|
|
|
|
bool ok = nmDataBinaryTools::savePebiSceneBin(outPath, scene);
|
|
|
|
QString typedOutPath = dataDir.filePath(typedFileName);
|
|
|
|
|
|
|
|
bool ok = nmDataBinaryTools::savePebiSceneBin(typedOutPath, scene);
|
|
|
|
|
|
|
|
|
|
|
|
if(!ok) {
|
|
|
|
if(!ok) {
|
|
|
|
zxLogInstance::getInstance()->writeLogF("savePebiSceneBin failed: " + nmDataBinaryTools::getLastError());
|
|
|
|
zxLogInstance::getInstance()->writeLogF("savePebiSceneBin failed: " + nmDataBinaryTools::getLastError());
|
|
|
|
FreeLibrary(dll);
|
|
|
|
FreeLibrary(dll);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
zxLogInstance::getInstance()->writeLogF("scene.bin exported: " + outPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 保留固定文件名作为当前场景入口,兼容现有Training和Python数据生成流程。
|
|
|
|
|
|
|
|
QString latestOutPath = dataDir.filePath("scene.bin");
|
|
|
|
|
|
|
|
ok = nmDataBinaryTools::savePebiSceneBin(latestOutPath, scene);
|
|
|
|
|
|
|
|
if(!ok) {
|
|
|
|
|
|
|
|
zxLogInstance::getInstance()->writeLogF("savePebiSceneBin failed: " + nmDataBinaryTools::getLastError());
|
|
|
|
|
|
|
|
FreeLibrary(dll);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
zxLogInstance::getInstance()->writeLogF("scene exported: " + typedOutPath);
|
|
|
|
|
|
|
|
zxLogInstance::getInstance()->writeLogF("latest scene exported: " + latestOutPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ===== 导出所有井:loglog + rate + pressure 到 temp 目录 =====
|
|
|
|
// ===== 导出所有井:loglog + rate + pressure 到 temp 目录 =====
|
|
|
|
|