调整自动拟合参数并移除初始压力

feature/Model-20260625
lvjunjie 18 hours ago
parent 9ba0df411d
commit baa38e99e3

@ -293,14 +293,13 @@ private:
//
// 参数索引约定:
// 0 k 渗透率1 skin 表皮系数2 wellboreC 井筒储集;
// 3 phi 孔隙度4 initialPressure 初始压力5 h 储层厚度;
// 6 Ct 综合压缩系数7 Cf 岩石压缩系数;
// 8 Swi 初始含水饱和度。
// 3 phi 孔隙度4 h 储层厚度5 Ct 综合压缩系数;
// 6 Cf 岩石压缩系数7 Swi 初始含水饱和度。
// m_enabledParamIndices 保存被用户勾选的参数索引,粒子的 position 维度与它一致。
QVector<bool> m_parameterSelected; // 完整 9 个参数是否被用户勾选参与拟合。
QVector<double> m_parameterLower; // 完整 9 个参数的搜索下界。
QVector<double> m_parameterUpper; // 完整 9 个参数的搜索上界。
QVector<int> m_enabledParamIndices; // 被勾选参数在完整 9 维体系中的索引。
QVector<bool> m_parameterSelected; // 完整 8 个参数是否被用户勾选参与拟合。
QVector<double> m_parameterLower; // 完整 8 个参数的搜索下界。
QVector<double> m_parameterUpper; // 完整 8 个参数的搜索上界。
QVector<int> m_enabledParamIndices; // 被勾选参数在完整 8 维体系中的索引。
QVector<QVector<double> > m_targetLogLogData; // 目标井 history log-log 曲线time/pressure/derivative。
QString m_targetWellName; // 目标井名称;读写井参数和读取模拟曲线都依赖它。

@ -47,13 +47,6 @@ public:
nmDataAttribute& getPorosityMin();
void setPorosityMin(const nmDataAttribute& porosityMin);
// Getter and Setter for initialPressureMax
nmDataAttribute& getInitialPressureMax();
void setInitialPressureMax(const nmDataAttribute& initialPressureMax);
// Getter and Setter for initialPressureMin
nmDataAttribute& getInitialPressureMin();
void setInitialPressureMin(const nmDataAttribute& initialPressureMin);
// Getter and Setter for thicknessMax
nmDataAttribute& getThicknessMax();
void setThicknessMax(const nmDataAttribute& thicknessMax);
@ -109,9 +102,6 @@ public:
bool getPorositySelected() const;
void setPorositySelected(bool selected);
bool getInitialPressureSelected() const;
void setInitialPressureSelected(bool selected);
bool getThicknessSelected() const;
void setThicknessSelected(bool selected);
@ -130,7 +120,6 @@ private:
nmDataAttribute m_skinMax;
nmDataAttribute m_wellboreStorageMax;
nmDataAttribute m_porosityMax;
nmDataAttribute m_initialPressureMax;
nmDataAttribute m_thicknessMax;
nmDataAttribute m_ctMax;
nmDataAttribute m_cfMax;
@ -141,7 +130,6 @@ private:
nmDataAttribute m_skinMin;
nmDataAttribute m_wellboreStorageMin;
nmDataAttribute m_porosityMin;
nmDataAttribute m_initialPressureMin;
nmDataAttribute m_thicknessMin;
nmDataAttribute m_ctMin;
nmDataAttribute m_cfMin;
@ -158,7 +146,6 @@ private:
bool m_skinSelected; // 是否选择表皮系数进行拟合
bool m_wellboreStorageSelected; // 是否选择井筒储集系数进行拟合
bool m_porositySelected; // 是否选择孔隙度进行拟合
bool m_initialPressureSelected; // 是否选择初始压力进行拟合
bool m_thicknessSelected; // 是否选择储层厚度进行拟合
bool m_ctSelected; // 是否选择综合压缩系数进行拟合
bool m_cfSelected; // 是否选择岩石压缩系数进行拟合

@ -88,7 +88,6 @@ private:
QCheckBox* m_sCheckBox; // 表皮系数
QCheckBox* m_cCheckBox; // 井筒储集系数
QCheckBox* m_phiCheckBox; // 孔隙度
QCheckBox* m_piCheckBox; // 初始压力
QCheckBox* m_hCheckBox; // 储层厚度
QCheckBox* m_ctCheckBox; // 综合压缩系数
QCheckBox* m_cfCheckBox; // 岩石压缩系数

@ -773,20 +773,19 @@ void nmCalculationAutoFitGA::loadParameterBounds()
nmDataAutomaticFitting fittingData = dataManager->getAutomaticFittingDataCopy();
// 获取参数选择状态
m_parameterSelected.resize(9);
m_parameterSelected.resize(8);
m_parameterSelected[0] = fittingData.getPermeabilitySelected();
m_parameterSelected[1] = fittingData.getSkinSelected();
m_parameterSelected[2] = fittingData.getWellboreStorageSelected();
m_parameterSelected[3] = fittingData.getPorositySelected();
m_parameterSelected[4] = fittingData.getInitialPressureSelected();
m_parameterSelected[5] = fittingData.getThicknessSelected();
m_parameterSelected[6] = fittingData.getCtSelected();
m_parameterSelected[7] = fittingData.getCfSelected();
m_parameterSelected[8] = fittingData.getSwiSelected();
m_parameterSelected[4] = fittingData.getThicknessSelected();
m_parameterSelected[5] = fittingData.getCtSelected();
m_parameterSelected[6] = fittingData.getCfSelected();
m_parameterSelected[7] = fittingData.getSwiSelected();
// 获取参数边界
m_parameterLower.resize(9);
m_parameterUpper.resize(9);
m_parameterLower.resize(8);
m_parameterUpper.resize(8);
m_parameterLower[0] = fittingData.getPermeabilityMin().getValue().toDouble();
m_parameterUpper[0] = fittingData.getPermeabilityMax().getValue().toDouble();
@ -800,20 +799,17 @@ void nmCalculationAutoFitGA::loadParameterBounds()
m_parameterLower[3] = fittingData.getPorosityMin().getValue().toDouble();
m_parameterUpper[3] = fittingData.getPorosityMax().getValue().toDouble();
m_parameterLower[4] = fittingData.getInitialPressureMin().getValue().toDouble();
m_parameterUpper[4] = fittingData.getInitialPressureMax().getValue().toDouble();
m_parameterLower[4] = fittingData.getThicknessMin().getValue().toDouble();
m_parameterUpper[4] = fittingData.getThicknessMax().getValue().toDouble();
m_parameterLower[5] = fittingData.getThicknessMin().getValue().toDouble();
m_parameterUpper[5] = fittingData.getThicknessMax().getValue().toDouble();
m_parameterLower[5] = fittingData.getCtMin().getValue().toDouble();
m_parameterUpper[5] = fittingData.getCtMax().getValue().toDouble();
m_parameterLower[6] = fittingData.getCtMin().getValue().toDouble();
m_parameterUpper[6] = fittingData.getCtMax().getValue().toDouble();
m_parameterLower[6] = fittingData.getCfMin().getValue().toDouble();
m_parameterUpper[6] = fittingData.getCfMax().getValue().toDouble();
m_parameterLower[7] = fittingData.getCfMin().getValue().toDouble();
m_parameterUpper[7] = fittingData.getCfMax().getValue().toDouble();
m_parameterLower[8] = fittingData.getSwiMin().getValue().toDouble();
m_parameterUpper[8] = fittingData.getSwiMax().getValue().toDouble();
m_parameterLower[7] = fittingData.getSwiMin().getValue().toDouble();
m_parameterUpper[7] = fittingData.getSwiMax().getValue().toDouble();
// 更新启用参数索引
m_enabledParamIndices.clear();
@ -863,23 +859,19 @@ void nmCalculationAutoFitGA::extractUserInitialValues()
initialValue = reservoirData.getPorosity().getValue().toDouble();
break;
case 4: // 初始压力
initialValue = reservoirData.getInitialPressure().getValue().toDouble();
break;
case 5: // 储层厚度
case 4: // 储层厚度
initialValue = reservoirData.getThickness().getValue().toDouble();
break;
case 6: // 综合压缩系数
case 5: // 综合压缩系数
initialValue = reservoirData.getCt().getValue().toDouble();
break;
case 7: // 岩石压缩系数
case 6: // 岩石压缩系数
initialValue = reservoirData.getCf().getValue().toDouble();
break;
case 8: // 初始含水饱和度
case 7: // 初始含水饱和度
initialValue = reservoirData.getSwi().getValue().toDouble();
break;
}
@ -1882,7 +1874,7 @@ bool nmCalculationAutoFitGA::validateParameters(const QVector<double>& parameter
break;
case 6: // 综合压缩系数:必须大于零
case 5: // 综合压缩系数:必须大于零
if(value <= 1e-8) {
DEBUG_OUT(QString("Rejecting near-zero total compressibility: %1").arg(value));
return false;
@ -1988,7 +1980,7 @@ void nmCalculationAutoFitGA::updateReservoirParameters(const QVector<double>& pa
nmDataReservoir reservoirData = dataManager->getReservoirDataCopy();
int paramIndex = 0;
for(int i = 0; i < m_parameterSelected.size() && i < 9; ++i) {
for(int i = 0; i < m_parameterSelected.size(); ++i) {
if(m_parameterSelected[i] && paramIndex < parameters.size()) {
double value = parameters[paramIndex];
@ -1999,19 +1991,16 @@ void nmCalculationAutoFitGA::updateReservoirParameters(const QVector<double>& pa
case 3: // 孔隙度
reservoirData.getPorosity().setValue(value);
break;
case 4: // 初始压力
reservoirData.getInitialPressure().setValue(value);
break;
case 5: // 储层厚度
case 4: // 储层厚度
reservoirData.getThickness().setValue(value);
break;
case 6: // 综合压缩系数
case 5: // 综合压缩系数
reservoirData.getCt().setValue(value);
break;
case 7: // 岩石压缩系数
case 6: // 岩石压缩系数
reservoirData.getCf().setValue(value);
break;
case 8: // 初始含水饱和度
case 7: // 初始含水饱和度
reservoirData.getSwi().setValue(value);
break;
}
@ -2035,7 +2024,7 @@ void nmCalculationAutoFitGA::updateWellParameters(const QVector<double>& paramet
//nmDataWellBase* pWell = wells[0]; // 使用第一口井
int paramIndex = 0;
for(int i = 0; i < m_parameterSelected.size() && i < 9; ++i) {
for(int i = 0; i < m_parameterSelected.size(); ++i) {
if(m_parameterSelected[i] && paramIndex < parameters.size()) {
double value = parameters[paramIndex];

@ -421,13 +421,12 @@ static QString findExecutableInPath(const QString& executableName)
static QStringList traceParameterNames()
{
// trace 和 trace meta 使用的完整参数名顺序。
// 这个顺序必须与 buildTraceParameterVector() 和 m_parameterSelected 的 0-8 索引一致。
// 这个顺序必须与 buildTraceParameterVector() 和 m_parameterSelected 的 0-7 索引一致。
QStringList names;
names << "k"
<< "skin"
<< "wellboreC"
<< "phi"
<< "initialPressure"
<< "h"
<< "Ct"
<< "Cf"
@ -1128,10 +1127,10 @@ void nmCalculationAutoFitPSO::writeTraceMetaFile()
QVector<double> nmCalculationAutoFitPSO::buildTraceParameterVector(const QVector<double>& selectedParameters) const
{
// 将粒子内部使用的“启用参数向量”还原成完整 9 维参数向量。
// 将粒子内部使用的“启用参数向量”还原成完整 8 维参数向量。
// 未启用的参数从当前 DataManager 读取,启用的参数用 selectedParameters 覆盖。
// trace CSV、候选 CSV、代理训练域检查都需要这个完整向量。
QVector<double> fullParams(9, 0.0);
QVector<double> fullParams(8, 0.0);
nmDataAnalyzeManager* dataManager = nmDataAnalyzeManager::getCurrentInstance();
@ -1139,11 +1138,10 @@ QVector<double> nmCalculationAutoFitPSO::buildTraceParameterVector(const QVector
nmDataReservoir reservoirData = dataManager->getReservoirDataCopy();
fullParams[0] = reservoirData.getPermeability().getValue().toDouble();
fullParams[3] = reservoirData.getPorosity().getValue().toDouble();
fullParams[4] = reservoirData.getInitialPressure().getValue().toDouble();
fullParams[5] = reservoirData.getThickness().getValue().toDouble();
fullParams[6] = reservoirData.getCt().getValue().toDouble();
fullParams[7] = reservoirData.getCf().getValue().toDouble();
fullParams[8] = reservoirData.getSwi().getValue().toDouble();
fullParams[4] = reservoirData.getThickness().getValue().toDouble();
fullParams[5] = reservoirData.getCt().getValue().toDouble();
fullParams[6] = reservoirData.getCf().getValue().toDouble();
fullParams[7] = reservoirData.getSwi().getValue().toDouble();
nmDataWellBase* pTargetWell = dataManager->findWellByName(m_targetWellName);
@ -1202,9 +1200,9 @@ void nmCalculationAutoFitPSO::writeTraceRow(int generation,
<< traceParamAt(currentParams, 1)
<< traceParamAt(currentParams, 2)
<< traceParamAt(currentParams, 3)
<< traceParamAt(currentParams, 4)
<< traceParamAt(currentParams, 5)
<< traceParamAt(currentParams, 6)
<< traceParamAt(currentParams, 7)
<< traceNumber(solverObjective)
<< QString::number(solverSuccess ? 1 : 0)
<< QString::number(elapsedMs)
@ -1215,17 +1213,17 @@ void nmCalculationAutoFitPSO::writeTraceRow(int generation,
<< traceParamAt(pbestParams, 1)
<< traceParamAt(pbestParams, 2)
<< traceParamAt(pbestParams, 3)
<< traceParamAt(pbestParams, 4)
<< traceParamAt(pbestParams, 5)
<< traceParamAt(pbestParams, 6)
<< traceParamAt(pbestParams, 7)
<< traceNumber(m_globalBestFitness)
<< traceParamAt(gbestParams, 0)
<< traceParamAt(gbestParams, 1)
<< traceParamAt(gbestParams, 2)
<< traceParamAt(gbestParams, 3)
<< traceParamAt(gbestParams, 4)
<< traceParamAt(gbestParams, 5)
<< traceParamAt(gbestParams, 6)
<< traceParamAt(gbestParams, 7)
<< csvEscape(enabledIndices.join(";"));
QTextStream out(&m_traceFile);
@ -1415,14 +1413,14 @@ bool nmCalculationAutoFitPSO::writeSurrogateCandidateCsv(const QString& candidat
QVector<double> params = buildTraceParameterVector(m_swarm[i].position);
QString cfForModel = useConstPvtTrainingCf
? QString::number(kSurrogateConstPvtCfFixed, 'g', 17)
: traceParamAt(params, 7);
: traceParamAt(params, 6);
QStringList cols;
cols << QString::number(i)
<< traceParamAt(params, 0)
<< traceParamAt(params, 1)
<< traceParamAt(params, 2)
<< traceParamAt(params, 3)
<< traceParamAt(params, 5)
<< traceParamAt(params, 4)
<< cfForModel
<< QString::number(solverType);
out << cols.join(",") << "\n";
@ -1439,14 +1437,14 @@ bool nmCalculationAutoFitPSO::writeSurrogateCandidateCsv(const QString& candidat
QVector<double> params = buildTraceParameterVector(guidePosition);
QString cfForModel = useConstPvtTrainingCf
? QString::number(kSurrogateConstPvtCfFixed, 'g', 17)
: traceParamAt(params, 7);
: traceParamAt(params, 6);
QStringList cols;
cols << QString::number(m_swarm.size() + i)
<< traceParamAt(params, 0)
<< traceParamAt(params, 1)
<< traceParamAt(params, 2)
<< traceParamAt(params, 3)
<< traceParamAt(params, 5)
<< traceParamAt(params, 4)
<< cfForModel
<< QString::number(solverType);
out << cols.join(",") << "\n";
@ -2077,10 +2075,10 @@ bool nmCalculationAutoFitPSO::isSurrogateRunContextSupported(QString* reason) co
// 参数门控:只有训练数据中 Cf 实际变化的 T2/T4 允许 Cf 参与拟合。
// 用户勾选其它参数时,代理无法可靠反映这些参数变化,直接禁用代理筛选。
QVector<int> allowedParamIndices;
allowedParamIndices << 0 << 1 << 2 << 3 << 5;
allowedParamIndices << 0 << 1 << 2 << 3 << 4;
if(parameterDomain.variableCf) {
allowedParamIndices << 7;
allowedParamIndices << 6;
}
for(int i = 0; i < m_enabledParamIndices.size(); ++i) {
@ -2249,8 +2247,8 @@ bool nmCalculationAutoFitPSO::isSurrogateCandidateInDomain(const QVector<double>
double skin = params.size() > 1 ? params[1] : std::numeric_limits<double>::quiet_NaN();
double wellboreC = params.size() > 2 ? params[2] : std::numeric_limits<double>::quiet_NaN();
double phi = params.size() > 3 ? params[3] : std::numeric_limits<double>::quiet_NaN();
double h = params.size() > 5 ? params[5] : std::numeric_limits<double>::quiet_NaN();
double cf = params.size() > 7 ? params[7] : std::numeric_limits<double>::quiet_NaN();
double h = params.size() > 4 ? params[4] : std::numeric_limits<double>::quiet_NaN();
double cf = params.size() > 6 ? params[6] : std::numeric_limits<double>::quiet_NaN();
nmDataAnalyzeManager* dataManager = nmDataAnalyzeManager::getCurrentInstance();
NM_SOLVER_MODEL_TYPE solverModelType = dataManager
@ -2317,7 +2315,7 @@ bool nmCalculationAutoFitPSO::forceSolverByFallbackGate(const QVector<double>& s
double skin = params.size() > 1 ? params[1] : std::numeric_limits<double>::quiet_NaN();
double wellboreC = params.size() > 2 ? params[2] : std::numeric_limits<double>::quiet_NaN();
double phi = params.size() > 3 ? params[3] : std::numeric_limits<double>::quiet_NaN();
double h = params.size() > 5 ? params[5] : std::numeric_limits<double>::quiet_NaN();
double h = params.size() > 4 ? params[4] : std::numeric_limits<double>::quiet_NaN();
if(!isFiniteNumber(k) || !isFiniteNumber(skin) || !isFiniteNumber(wellboreC) || !isFiniteNumber(phi) || !isFiniteNumber(h)) {
return true;
@ -2791,27 +2789,26 @@ void nmCalculationAutoFitPSO::loadParameterBounds()
// 读取用户勾选的拟合参数及上下界。
//
// 这里构建三个核心数组:
// - m_parameterSelected[9]:完整参数体系中每个参数是否参与拟合;
// - m_parameterLower/Upper[9]:完整参数体系的搜索上下界;
// - m_parameterSelected[8]:完整参数体系中每个参数是否参与拟合;
// - m_parameterLower/Upper[8]:完整参数体系的搜索上下界;
// - m_enabledParamIndices把粒子内部紧凑向量映射回完整参数索引。
nmDataAnalyzeManager* dataManager = nmDataAnalyzeManager::getCurrentInstance();
nmDataAutomaticFitting fittingData = dataManager->getAutomaticFittingDataCopy();
// 获取参数选择状态
m_parameterSelected.resize(9);
m_parameterSelected.resize(8);
m_parameterSelected[0] = fittingData.getPermeabilitySelected();
m_parameterSelected[1] = fittingData.getSkinSelected();
m_parameterSelected[2] = fittingData.getWellboreStorageSelected();
m_parameterSelected[3] = fittingData.getPorositySelected();
m_parameterSelected[4] = fittingData.getInitialPressureSelected();
m_parameterSelected[5] = fittingData.getThicknessSelected();
m_parameterSelected[6] = fittingData.getCtSelected();
m_parameterSelected[7] = fittingData.getCfSelected();
m_parameterSelected[8] = fittingData.getSwiSelected();
m_parameterSelected[4] = fittingData.getThicknessSelected();
m_parameterSelected[5] = fittingData.getCtSelected();
m_parameterSelected[6] = fittingData.getCfSelected();
m_parameterSelected[7] = fittingData.getSwiSelected();
// 获取参数边界
m_parameterLower.resize(9);
m_parameterUpper.resize(9);
m_parameterLower.resize(8);
m_parameterUpper.resize(8);
m_parameterLower[0] = fittingData.getPermeabilityMin().getValue().toDouble();
m_parameterUpper[0] = fittingData.getPermeabilityMax().getValue().toDouble();
@ -2825,20 +2822,17 @@ void nmCalculationAutoFitPSO::loadParameterBounds()
m_parameterLower[3] = fittingData.getPorosityMin().getValue().toDouble();
m_parameterUpper[3] = fittingData.getPorosityMax().getValue().toDouble();
m_parameterLower[4] = fittingData.getInitialPressureMin().getValue().toDouble();
m_parameterUpper[4] = fittingData.getInitialPressureMax().getValue().toDouble();
m_parameterLower[4] = fittingData.getThicknessMin().getValue().toDouble();
m_parameterUpper[4] = fittingData.getThicknessMax().getValue().toDouble();
m_parameterLower[5] = fittingData.getThicknessMin().getValue().toDouble();
m_parameterUpper[5] = fittingData.getThicknessMax().getValue().toDouble();
m_parameterLower[5] = fittingData.getCtMin().getValue().toDouble();
m_parameterUpper[5] = fittingData.getCtMax().getValue().toDouble();
m_parameterLower[6] = fittingData.getCtMin().getValue().toDouble();
m_parameterUpper[6] = fittingData.getCtMax().getValue().toDouble();
m_parameterLower[6] = fittingData.getCfMin().getValue().toDouble();
m_parameterUpper[6] = fittingData.getCfMax().getValue().toDouble();
m_parameterLower[7] = fittingData.getCfMin().getValue().toDouble();
m_parameterUpper[7] = fittingData.getCfMax().getValue().toDouble();
m_parameterLower[8] = fittingData.getSwiMin().getValue().toDouble();
m_parameterUpper[8] = fittingData.getSwiMax().getValue().toDouble();
m_parameterLower[7] = fittingData.getSwiMin().getValue().toDouble();
m_parameterUpper[7] = fittingData.getSwiMax().getValue().toDouble();
// 更新启用参数索引
m_enabledParamIndices.clear();
@ -3437,23 +3431,19 @@ void nmCalculationAutoFitPSO::extractUserInitialValues()
initialValue = reservoirData.getPorosity().getValue().toDouble();
break;
case 4: // 初始压力
initialValue = reservoirData.getInitialPressure().getValue().toDouble();
break;
case 5: // 储层厚度
case 4: // 储层厚度
initialValue = reservoirData.getThickness().getValue().toDouble();
break;
case 6: // 综合压缩系数
case 5: // 综合压缩系数
initialValue = reservoirData.getCt().getValue().toDouble();
break;
case 7: // 岩石压缩系数
case 6: // 岩石压缩系数
initialValue = reservoirData.getCf().getValue().toDouble();
break;
case 8: // 初始含水饱和度
case 7: // 初始含水饱和度
initialValue = reservoirData.getSwi().getValue().toDouble();
break;
}
@ -4251,11 +4241,11 @@ void nmCalculationAutoFitPSO::updateReservoirParameters(const QVector<double>& p
nmDataAnalyzeManager* dataManager = nmDataAnalyzeManager::getCurrentInstance();
nmDataReservoir reservoirData = dataManager->getReservoirDataCopy();
// paramIndex 是粒子 position 中的索引i 是完整 9 个参数体系中的索引。
// paramIndex 是粒子 position 中的索引i 是完整 8 个参数体系中的索引。
// 只有 m_parameterSelected[i] 为 true 时,才从 parameters 中消费一个值。
int paramIndex = 0;
for(int i = 0; i < m_parameterSelected.size() && i < 9; ++i) {
for(int i = 0; i < m_parameterSelected.size(); ++i) {
if(m_parameterSelected[i] && paramIndex < parameters.size()) {
double value = parameters[paramIndex];
@ -4268,23 +4258,19 @@ void nmCalculationAutoFitPSO::updateReservoirParameters(const QVector<double>& p
reservoirData.getPorosity().setValue(value);
break;
case 4: // 初始压力
reservoirData.getInitialPressure().setValue(value);
break;
case 5: // 储层厚度
case 4: // 储层厚度
reservoirData.getThickness().setValue(value);
break;
case 6: // 综合压缩系数
case 5: // 综合压缩系数
reservoirData.getCt().setValue(value);
break;
case 7: // 岩石压缩系数
case 6: // 岩石压缩系数
reservoirData.getCf().setValue(value);
break;
case 8: // 初始含水饱和度
case 7: // 初始含水饱和度
reservoirData.getSwi().setValue(value);
break;
}
@ -4315,7 +4301,7 @@ void nmCalculationAutoFitPSO::updateWellParameters(const QVector<double>& parame
int paramIndex = 0;
for(int i = 0; i < m_parameterSelected.size() && i < 9; ++i) {
for(int i = 0; i < m_parameterSelected.size(); ++i) {
if(m_parameterSelected[i] && paramIndex < parameters.size()) {
double value = parameters[paramIndex];
@ -4759,7 +4745,7 @@ bool nmCalculationAutoFitPSO::validateParameters(const QVector<double>& paramete
break;
case 6: // 综合压缩系数:必须大于零
case 5: // 综合压缩系数:必须大于零
if(value <= 1e-8) {
DEBUG_OUT(QString("Rejecting near-zero total compressibility: %1").arg(value));
return false;

@ -7,7 +7,6 @@ nmDataAutomaticFitting::nmDataAutomaticFitting()
m_skinSelected = true; // 默认选中
m_wellboreStorageSelected = true; // 默认选中
m_porositySelected = true; // 默认选中
m_initialPressureSelected = false; // 默认不选中
m_thicknessSelected = true; // 默认选中
m_ctSelected = true; // 默认选中
m_cfSelected = false; // 默认不选中
@ -18,7 +17,6 @@ nmDataAutomaticFitting::nmDataAutomaticFitting()
m_skinMax = nmDataAttribute("Skin Max", 10.0, ""); // 100
m_wellboreStorageMax = nmDataAttribute("Wellbore Storage Max", 2.0, "m3/MPa");
m_porosityMax = nmDataAttribute("Porosity Max", 0.5, ""); // 50%
m_initialPressureMax = nmDataAttribute("Initial Pressure Max", 50.0, "MPa");
m_thicknessMax = nmDataAttribute("Thickness Max", 50.0, "m");
m_ctMax = nmDataAttribute("Ct Max", 0.1, ""); // 1/MPa
m_cfMax = nmDataAttribute("Cf Max", 0.01, ""); // 1/MPa
@ -29,7 +27,6 @@ nmDataAutomaticFitting::nmDataAutomaticFitting()
m_skinMin = nmDataAttribute("Skin Min", -10.0, ""); // 允许负表皮
m_wellboreStorageMin = nmDataAttribute("Wellbore Storage Min", 1e-4, "m3/MPa");
m_porosityMin = nmDataAttribute("Porosity Min", 0.01, ""); // 1%
m_initialPressureMin = nmDataAttribute("Initial Pressure Min", 0.1, "MPa");
m_thicknessMin = nmDataAttribute("Thickness Min", 2.0, "m");
m_ctMin = nmDataAttribute("Ct Min", 1e-3, ""); // 小正值
m_cfMin = nmDataAttribute("Cf Min", 1e-5, ""); // 小正值
@ -59,7 +56,6 @@ nmDataAutomaticFitting& nmDataAutomaticFitting::operator=(const nmDataAutomaticF
m_skinSelected = other.m_skinSelected;
m_wellboreStorageSelected = other.m_wellboreStorageSelected;
m_porositySelected = other.m_porositySelected;
m_initialPressureSelected = other.m_initialPressureSelected;
m_thicknessSelected = other.m_thicknessSelected;
m_ctSelected = other.m_ctSelected;
m_cfSelected = other.m_cfSelected;
@ -70,7 +66,6 @@ nmDataAutomaticFitting& nmDataAutomaticFitting::operator=(const nmDataAutomaticF
m_skinMax = other.m_skinMax;
m_wellboreStorageMax = other.m_wellboreStorageMax;
m_porosityMax = other.m_porosityMax;
m_initialPressureMax = other.m_initialPressureMax;
m_thicknessMax = other.m_thicknessMax;
m_ctMax = other.m_ctMax;
m_cfMax = other.m_cfMax;
@ -81,7 +76,6 @@ nmDataAutomaticFitting& nmDataAutomaticFitting::operator=(const nmDataAutomaticF
m_skinMin = other.m_skinMin;
m_wellboreStorageMin = other.m_wellboreStorageMin;
m_porosityMin = other.m_porosityMin;
m_initialPressureMin = other.m_initialPressureMin;
m_thicknessMin = other.m_thicknessMin;
m_ctMin = other.m_ctMin;
m_cfMin = other.m_cfMin;
@ -105,7 +99,6 @@ rapidjson::Value nmDataAutomaticFitting::ToJsonValue(rapidjson::Document::Alloca
fittingObject.AddMember("SkinSelected", m_skinSelected, allocator);
fittingObject.AddMember("WellboreStorageSelected", m_wellboreStorageSelected, allocator);
fittingObject.AddMember("PorositySelected", m_porositySelected, allocator);
fittingObject.AddMember("InitialPressureSelected", m_initialPressureSelected, allocator);
fittingObject.AddMember("ThicknessSelected", m_thicknessSelected, allocator);
fittingObject.AddMember("CtSelected", m_ctSelected, allocator);
fittingObject.AddMember("CfSelected", m_cfSelected, allocator);
@ -116,7 +109,6 @@ rapidjson::Value nmDataAutomaticFitting::ToJsonValue(rapidjson::Document::Alloca
fittingObject.AddMember("SkinMax", m_skinMax.ToJsonValue(allocator), allocator);
fittingObject.AddMember("WellboreStorageMax", m_wellboreStorageMax.ToJsonValue(allocator), allocator);
fittingObject.AddMember("PorosityMax", m_porosityMax.ToJsonValue(allocator), allocator);
fittingObject.AddMember("InitialPressureMax", m_initialPressureMax.ToJsonValue(allocator), allocator);
fittingObject.AddMember("ThicknessMax", m_thicknessMax.ToJsonValue(allocator), allocator);
fittingObject.AddMember("CtMax", m_ctMax.ToJsonValue(allocator), allocator);
fittingObject.AddMember("CfMax", m_cfMax.ToJsonValue(allocator), allocator);
@ -127,7 +119,6 @@ rapidjson::Value nmDataAutomaticFitting::ToJsonValue(rapidjson::Document::Alloca
fittingObject.AddMember("SkinMin", m_skinMin.ToJsonValue(allocator), allocator);
fittingObject.AddMember("WellboreStorageMin", m_wellboreStorageMin.ToJsonValue(allocator), allocator);
fittingObject.AddMember("PorosityMin", m_porosityMin.ToJsonValue(allocator), allocator);
fittingObject.AddMember("InitialPressureMin", m_initialPressureMin.ToJsonValue(allocator), allocator);
fittingObject.AddMember("ThicknessMin", m_thicknessMin.ToJsonValue(allocator), allocator);
fittingObject.AddMember("CtMin", m_ctMin.ToJsonValue(allocator), allocator);
fittingObject.AddMember("CfMin", m_cfMin.ToJsonValue(allocator), allocator);
@ -157,9 +148,6 @@ void nmDataAutomaticFitting::FromJsonValue(const rapidjson::Value& jsonValue)
if (jsonValue.HasMember("PorositySelected") && jsonValue["PorositySelected"].IsBool()) {
m_porositySelected = jsonValue["PorositySelected"].GetBool();
}
if (jsonValue.HasMember("InitialPressureSelected") && jsonValue["InitialPressureSelected"].IsBool()) {
m_initialPressureSelected = jsonValue["InitialPressureSelected"].GetBool();
}
if (jsonValue.HasMember("ThicknessSelected") && jsonValue["ThicknessSelected"].IsBool()) {
m_thicknessSelected = jsonValue["ThicknessSelected"].GetBool();
}
@ -186,9 +174,6 @@ void nmDataAutomaticFitting::FromJsonValue(const rapidjson::Value& jsonValue)
if (jsonValue.HasMember("PorosityMax") && jsonValue["PorosityMax"].IsObject()) {
m_porosityMax.FromJsonValue(jsonValue["PorosityMax"]);
}
if (jsonValue.HasMember("InitialPressureMax") && jsonValue["InitialPressureMax"].IsObject()) {
m_initialPressureMax.FromJsonValue(jsonValue["InitialPressureMax"]);
}
if (jsonValue.HasMember("ThicknessMax") && jsonValue["ThicknessMax"].IsObject()) {
m_thicknessMax.FromJsonValue(jsonValue["ThicknessMax"]);
}
@ -215,9 +200,6 @@ void nmDataAutomaticFitting::FromJsonValue(const rapidjson::Value& jsonValue)
if (jsonValue.HasMember("PorosityMin") && jsonValue["PorosityMin"].IsObject()) {
m_porosityMin.FromJsonValue(jsonValue["PorosityMin"]);
}
if (jsonValue.HasMember("InitialPressureMin") && jsonValue["InitialPressureMin"].IsObject()) {
m_initialPressureMin.FromJsonValue(jsonValue["InitialPressureMin"]);
}
if (jsonValue.HasMember("ThicknessMin") && jsonValue["ThicknessMin"].IsObject()) {
m_thicknessMin.FromJsonValue(jsonValue["ThicknessMin"]);
}
@ -260,9 +242,6 @@ void nmDataAutomaticFitting::setWellboreStorageSelected(bool selected) { m_wellb
bool nmDataAutomaticFitting::getPorositySelected() const { return m_porositySelected; }
void nmDataAutomaticFitting::setPorositySelected(bool selected) { m_porositySelected = selected; }
bool nmDataAutomaticFitting::getInitialPressureSelected() const { return m_initialPressureSelected; }
void nmDataAutomaticFitting::setInitialPressureSelected(bool selected) { m_initialPressureSelected = selected; }
bool nmDataAutomaticFitting::getThicknessSelected() const { return m_thicknessSelected; }
void nmDataAutomaticFitting::setThicknessSelected(bool selected) { m_thicknessSelected = selected; }
@ -289,9 +268,6 @@ void nmDataAutomaticFitting::setWellboreStorageMax(const nmDataAttribute& wellbo
nmDataAttribute& nmDataAutomaticFitting::getPorosityMax() { return m_porosityMax; }
void nmDataAutomaticFitting::setPorosityMax(const nmDataAttribute& porosityMax) { m_porosityMax = porosityMax; }
nmDataAttribute& nmDataAutomaticFitting::getInitialPressureMax() { return m_initialPressureMax; }
void nmDataAutomaticFitting::setInitialPressureMax(const nmDataAttribute& initialPressureMax) { m_initialPressureMax = initialPressureMax; }
nmDataAttribute& nmDataAutomaticFitting::getThicknessMax() { return m_thicknessMax; }
void nmDataAutomaticFitting::setThicknessMax(const nmDataAttribute& thicknessMax) { m_thicknessMax = thicknessMax; }
@ -317,9 +293,6 @@ void nmDataAutomaticFitting::setWellboreStorageMin(const nmDataAttribute& wellbo
nmDataAttribute& nmDataAutomaticFitting::getPorosityMin() { return m_porosityMin; }
void nmDataAutomaticFitting::setPorosityMin(const nmDataAttribute& porosityMin) { m_porosityMin = porosityMin; }
nmDataAttribute& nmDataAutomaticFitting::getInitialPressureMin() { return m_initialPressureMin; }
void nmDataAutomaticFitting::setInitialPressureMin(const nmDataAttribute& initialPressureMin) { m_initialPressureMin = initialPressureMin; }
nmDataAttribute& nmDataAutomaticFitting::getThicknessMin() { return m_thicknessMin; }
void nmDataAutomaticFitting::setThicknessMin(const nmDataAttribute& thicknessMin) { m_thicknessMin = thicknessMin; }

@ -155,7 +155,7 @@ void nmWxAutomaticFitting::renumberVisibleParameterRows(QTableWidget* table)
}
}
// 根据当前模型类型控制参数显示0-5行为通用参数6-10行为随PVT模型变化的参数
// 根据当前模型类型控制Ct/Cf/Swi参数显示。
void nmWxAutomaticFitting::updateParameterVisibility(QTableWidget* table, NM_SOLVER_MODEL_TYPE eType)
{
if(!table) {
@ -192,9 +192,9 @@ void nmWxAutomaticFitting::updateParameterVisibility(QTableWidget* table, NM_SOL
break;
}
setParameterRowVisible(table, 6, showCt); // Ct
setParameterRowVisible(table, 7, showCf); // Cf
setParameterRowVisible(table, 8, showSwi); // Swi
setParameterRowVisible(table, 5, showCt); // Ct
setParameterRowVisible(table, 6, showCf); // Cf
setParameterRowVisible(table, 7, showSwi); // Swi
renumberVisibleParameterRows(table);
}
@ -251,8 +251,6 @@ nmWxAutomaticFitting::nmWxAutomaticFitting(QWidget *parent)
automaticFittingData.getWellboreStorageMax().setValue(2.0);
automaticFittingData.getPorosityMin().setValue(1.0e-2);
automaticFittingData.getPorosityMax().setValue(5.0e-1);
automaticFittingData.getInitialPressureMin().setValue(0.1);
automaticFittingData.getInitialPressureMax().setValue(50.0);
automaticFittingData.getThicknessMin().setValue(2.0);
automaticFittingData.getThicknessMax().setValue(50.0);
automaticFittingData.getCtMin().setValue(1.0e-3);
@ -261,6 +259,16 @@ nmWxAutomaticFitting::nmWxAutomaticFitting(QWidget *parent)
automaticFittingData.getCfMax().setValue(1.0e-2);
}
if(solverModelType == SMT_Oil_ConstPvt ||
solverModelType == SMT_Water_ConstPvt) {
// T1/T3 的综合压缩系数默认不参与拟合。
automaticFittingData.setCtSelected(false);
} else if(solverModelType == SMT_Oil_VariablePvt ||
solverModelType == SMT_Water_VariablePvt) {
// T2/T4 的岩石压缩系数默认参与拟合。
automaticFittingData.setCfSelected(true);
}
// 气单相变化 PVT 使用 T5 数据集对应的初始值和拟合范围。
if(solverModelType == SMT_Gas_VariablePvt) {
reservoirData.getPermeability().setValue(5.5e-6);
@ -284,7 +292,6 @@ nmWxAutomaticFitting::nmWxAutomaticFitting(QWidget *parent)
solverModelType == SMT_Water_ConstPvt) {
// T1/T3 使用固定初值,不继承当前储层参数。
reservoirData.getPorosity().setValue(2.45e-2);
reservoirData.getInitialPressure().setValue(34.47);
reservoirData.getThickness().setValue(9.144);
reservoirData.getCt().setValue(1.0e-2);
} else if(solverModelType == SMT_Oil_VariablePvt) {
@ -292,15 +299,11 @@ nmWxAutomaticFitting::nmWxAutomaticFitting(QWidget *parent)
reservoirData.getPorosity().setValue(6.0e-2);
reservoirData.getThickness().setValue(10.5);
reservoirData.getCf().setValue(1.0e-3);
reservoirData.getInitialPressure().setValue(34.47);
automaticFittingData.setInitialPressureSelected(false);
} else if(solverModelType == SMT_Water_VariablePvt) {
// 水单相变化 PVT 使用固定初值。
reservoirData.getPorosity().setValue(6.0e-2);
reservoirData.getThickness().setValue(10.5);
reservoirData.getCf().setValue(1.5e-3);
reservoirData.getInitialPressure().setValue(34.47);
automaticFittingData.setInitialPressureSelected(false);
}
}
@ -368,7 +371,7 @@ void nmWxAutomaticFitting::setupUI()
void nmWxAutomaticFitting::setupParameterTable()
{
// 创建表格
m_parameterTable = new QTableWidget(9, 6, this);
m_parameterTable = new QTableWidget(8, 6, this);
// 设置表头
QStringList headers;
@ -437,55 +440,45 @@ void nmWxAutomaticFitting::setupParameterTable()
m_parameterTable->setItem(3, 4, new QTableWidgetItem(QString::number(automaticFittingData.getPorosityMax().getValue().toDouble())));
m_parameterTable->setItem(3, 5, new QTableWidgetItem(""));
// 初始压力 (Initial Pressure)
m_parameterTable->setItem(4, 0, new QTableWidgetItem("5"));
m_piCheckBox = new QCheckBox(tr("Initial Pressure"));
m_piCheckBox->setChecked(automaticFittingData.getInitialPressureSelected());
m_parameterTable->setCellWidget(4, 1, m_piCheckBox);
m_parameterTable->setItem(4, 2, new QTableWidgetItem(QString::number(automaticFittingData.getInitialPressureMin().getValue().toDouble())));
m_parameterTable->setItem(4, 3, new QTableWidgetItem(QString::number(reservoirData.getInitialPressure().getValue().toDouble())));
m_parameterTable->setItem(4, 4, new QTableWidgetItem(QString::number(automaticFittingData.getInitialPressureMax().getValue().toDouble())));
m_parameterTable->setItem(4, 5, new QTableWidgetItem(tr("MPa")));
// 储层厚度 (Thickness)
m_parameterTable->setItem(5, 0, new QTableWidgetItem("6"));
m_parameterTable->setItem(4, 0, new QTableWidgetItem("5"));
m_hCheckBox = new QCheckBox(tr("Thickness"));
m_hCheckBox->setChecked(automaticFittingData.getThicknessSelected());
m_parameterTable->setCellWidget(5, 1, m_hCheckBox);
m_parameterTable->setItem(5, 2, new QTableWidgetItem(QString::number(automaticFittingData.getThicknessMin().getValue().toDouble())));
m_parameterTable->setItem(5, 3, new QTableWidgetItem(QString::number(reservoirData.getThickness().getValue().toDouble())));
m_parameterTable->setItem(5, 4, new QTableWidgetItem(QString::number(automaticFittingData.getThicknessMax().getValue().toDouble())));
m_parameterTable->setItem(5, 5, new QTableWidgetItem(tr("m")));
m_parameterTable->setCellWidget(4, 1, m_hCheckBox);
m_parameterTable->setItem(4, 2, new QTableWidgetItem(QString::number(automaticFittingData.getThicknessMin().getValue().toDouble())));
m_parameterTable->setItem(4, 3, new QTableWidgetItem(QString::number(reservoirData.getThickness().getValue().toDouble())));
m_parameterTable->setItem(4, 4, new QTableWidgetItem(QString::number(automaticFittingData.getThicknessMax().getValue().toDouble())));
m_parameterTable->setItem(4, 5, new QTableWidgetItem(tr("m")));
// 综合压缩系数 (Ct)
m_parameterTable->setItem(6, 0, new QTableWidgetItem("7"));
m_parameterTable->setItem(5, 0, new QTableWidgetItem("6"));
m_ctCheckBox = new QCheckBox(tr("Ct"));
m_ctCheckBox->setChecked(automaticFittingData.getCtSelected());
m_parameterTable->setCellWidget(6, 1, m_ctCheckBox);
m_parameterTable->setItem(6, 2, new QTableWidgetItem(QString::number(automaticFittingData.getCtMin().getValue().toDouble())));
m_parameterTable->setItem(6, 3, new QTableWidgetItem(QString::number(reservoirData.getCt().getValue().toDouble())));
m_parameterTable->setItem(6, 4, new QTableWidgetItem(QString::number(automaticFittingData.getCtMax().getValue().toDouble())));
m_parameterTable->setItem(6, 5, new QTableWidgetItem(""));
m_parameterTable->setCellWidget(5, 1, m_ctCheckBox);
m_parameterTable->setItem(5, 2, new QTableWidgetItem(QString::number(automaticFittingData.getCtMin().getValue().toDouble())));
m_parameterTable->setItem(5, 3, new QTableWidgetItem(QString::number(reservoirData.getCt().getValue().toDouble())));
m_parameterTable->setItem(5, 4, new QTableWidgetItem(QString::number(automaticFittingData.getCtMax().getValue().toDouble())));
m_parameterTable->setItem(5, 5, new QTableWidgetItem(""));
// 岩石压缩系数 (Cf)
m_parameterTable->setItem(7, 0, new QTableWidgetItem("8"));
m_parameterTable->setItem(6, 0, new QTableWidgetItem("7"));
m_cfCheckBox = new QCheckBox(tr("Cf"));
m_cfCheckBox->setChecked(automaticFittingData.getCfSelected());
m_parameterTable->setCellWidget(7, 1, m_cfCheckBox);
m_parameterTable->setItem(7, 2, new QTableWidgetItem(QString::number(automaticFittingData.getCfMin().getValue().toDouble())));
m_parameterTable->setItem(7, 3, new QTableWidgetItem(QString::number(reservoirData.getCf().getValue().toDouble())));
m_parameterTable->setItem(7, 4, new QTableWidgetItem(QString::number(automaticFittingData.getCfMax().getValue().toDouble())));
m_parameterTable->setItem(7, 5, new QTableWidgetItem(""));
m_parameterTable->setCellWidget(6, 1, m_cfCheckBox);
m_parameterTable->setItem(6, 2, new QTableWidgetItem(QString::number(automaticFittingData.getCfMin().getValue().toDouble())));
m_parameterTable->setItem(6, 3, new QTableWidgetItem(QString::number(reservoirData.getCf().getValue().toDouble())));
m_parameterTable->setItem(6, 4, new QTableWidgetItem(QString::number(automaticFittingData.getCfMax().getValue().toDouble())));
m_parameterTable->setItem(6, 5, new QTableWidgetItem(""));
// 初始含水饱和度 (Swi)
m_parameterTable->setItem(8, 0, new QTableWidgetItem("9"));
m_parameterTable->setItem(7, 0, new QTableWidgetItem("8"));
m_swiCheckBox = new QCheckBox(tr("Swi"));
m_swiCheckBox->setChecked(automaticFittingData.getSwiSelected());
m_parameterTable->setCellWidget(8, 1, m_swiCheckBox);
m_parameterTable->setItem(8, 2, new QTableWidgetItem(QString::number(automaticFittingData.getSwiMin().getValue().toDouble())));
m_parameterTable->setItem(8, 3, new QTableWidgetItem(QString::number(reservoirData.getSwi().getValue().toDouble())));
m_parameterTable->setItem(8, 4, new QTableWidgetItem(QString::number(automaticFittingData.getSwiMax().getValue().toDouble())));
m_parameterTable->setItem(8, 5, new QTableWidgetItem(""));
m_parameterTable->setCellWidget(7, 1, m_swiCheckBox);
m_parameterTable->setItem(7, 2, new QTableWidgetItem(QString::number(automaticFittingData.getSwiMin().getValue().toDouble())));
m_parameterTable->setItem(7, 3, new QTableWidgetItem(QString::number(reservoirData.getSwi().getValue().toDouble())));
m_parameterTable->setItem(7, 4, new QTableWidgetItem(QString::number(automaticFittingData.getSwiMax().getValue().toDouble())));
m_parameterTable->setItem(7, 5, new QTableWidgetItem(""));
// 设置表格行为
for(int i = 0; i < m_parameterTable->rowCount(); ++i) {
@ -682,11 +675,10 @@ void nmWxAutomaticFitting::onReverseSelection()
if(!m_parameterTable->isRowHidden(1)) m_sCheckBox->setChecked(!m_sCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(2)) m_cCheckBox->setChecked(!m_cCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(3)) m_phiCheckBox->setChecked(!m_phiCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(4)) m_piCheckBox->setChecked(!m_piCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(5)) m_hCheckBox->setChecked(!m_hCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(6)) m_ctCheckBox->setChecked(!m_ctCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(7)) m_cfCheckBox->setChecked(!m_cfCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(8)) m_swiCheckBox->setChecked(!m_swiCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(4)) m_hCheckBox->setChecked(!m_hCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(5)) m_ctCheckBox->setChecked(!m_ctCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(6)) m_cfCheckBox->setChecked(!m_cfCheckBox->isChecked());
if(!m_parameterTable->isRowHidden(7)) m_swiCheckBox->setChecked(!m_swiCheckBox->isChecked());
}
void nmWxAutomaticFitting::onAlgorithmChanged(int index)
@ -801,7 +793,7 @@ void nmWxAutomaticFitting::onAccept()
// 检查是否有参数被选中
bool hasSelectedParams = m_kCheckBox->isChecked() || m_sCheckBox->isChecked() ||
m_cCheckBox->isChecked() || m_phiCheckBox->isChecked() ||
m_piCheckBox->isChecked() || m_hCheckBox->isChecked() ||
m_hCheckBox->isChecked() ||
m_ctCheckBox->isChecked() || m_cfCheckBox->isChecked() ||
m_swiCheckBox->isChecked();
@ -817,7 +809,6 @@ void nmWxAutomaticFitting::onAccept()
if(m_sCheckBox->isChecked()) selectedParameterNames << tr("Skin");
if(m_cCheckBox->isChecked()) selectedParameterNames << tr("Wellbore storage");
if(m_phiCheckBox->isChecked()) selectedParameterNames << tr("Porosity");
if(m_piCheckBox->isChecked()) selectedParameterNames << tr("Initial Pressure");
if(m_hCheckBox->isChecked()) selectedParameterNames << tr("Thickness");
if(m_ctCheckBox->isChecked()) selectedParameterNames << tr("Ct");
if(m_cfCheckBox->isChecked()) selectedParameterNames << tr("Cf");
@ -934,7 +925,6 @@ void nmWxAutomaticFitting::setAutomaticFittingValue()
automaticFittingData.setSkinSelected(m_sCheckBox->isChecked());
automaticFittingData.setWellboreStorageSelected(m_cCheckBox->isChecked());
automaticFittingData.setPorositySelected(m_phiCheckBox->isChecked());
automaticFittingData.setInitialPressureSelected(m_piCheckBox->isChecked());
automaticFittingData.setThicknessSelected(m_hCheckBox->isChecked());
automaticFittingData.setCtSelected(m_ctCheckBox->isChecked());
automaticFittingData.setCfSelected(m_cfCheckBox->isChecked());
@ -957,25 +947,21 @@ void nmWxAutomaticFitting::setAutomaticFittingValue()
automaticFittingData.getPorosityMin().setValue(m_parameterTable->item(3, 2)->text().toDouble());
automaticFittingData.getPorosityMax().setValue(m_parameterTable->item(3, 4)->text().toDouble());
// 保存初始压力的最小值和最大值
automaticFittingData.getInitialPressureMin().setValue(m_parameterTable->item(4, 2)->text().toDouble());
automaticFittingData.getInitialPressureMax().setValue(m_parameterTable->item(4, 4)->text().toDouble());
// 保存储层厚度的最小值和最大值
automaticFittingData.getThicknessMin().setValue(m_parameterTable->item(5, 2)->text().toDouble());
automaticFittingData.getThicknessMax().setValue(m_parameterTable->item(5, 4)->text().toDouble());
automaticFittingData.getThicknessMin().setValue(m_parameterTable->item(4, 2)->text().toDouble());
automaticFittingData.getThicknessMax().setValue(m_parameterTable->item(4, 4)->text().toDouble());
// 保存综合压缩系数的最小值和最大值
automaticFittingData.getCtMin().setValue(m_parameterTable->item(6, 2)->text().toDouble());
automaticFittingData.getCtMax().setValue(m_parameterTable->item(6, 4)->text().toDouble());
automaticFittingData.getCtMin().setValue(m_parameterTable->item(5, 2)->text().toDouble());
automaticFittingData.getCtMax().setValue(m_parameterTable->item(5, 4)->text().toDouble());
// 保存岩石压缩系数的最小值和最大值
automaticFittingData.getCfMin().setValue(m_parameterTable->item(7, 2)->text().toDouble());
automaticFittingData.getCfMax().setValue(m_parameterTable->item(7, 4)->text().toDouble());
automaticFittingData.getCfMin().setValue(m_parameterTable->item(6, 2)->text().toDouble());
automaticFittingData.getCfMax().setValue(m_parameterTable->item(6, 4)->text().toDouble());
// 保存初始含水饱和度的最小值和最大值
automaticFittingData.getSwiMin().setValue(m_parameterTable->item(8, 2)->text().toDouble());
automaticFittingData.getSwiMax().setValue(m_parameterTable->item(8, 4)->text().toDouble());
automaticFittingData.getSwiMin().setValue(m_parameterTable->item(7, 2)->text().toDouble());
automaticFittingData.getSwiMax().setValue(m_parameterTable->item(7, 4)->text().toDouble());
// 保存迭代参数
automaticFittingData.getIterationCount().setValue(m_iterationEdit->text().toInt());
@ -984,11 +970,10 @@ void nmWxAutomaticFitting::setAutomaticFittingValue()
// 保存储层数据的初值
reservoirData.getPermeability().setValue(m_parameterTable->item(0, 3)->text().toDouble()); // 渗透率
reservoirData.getPorosity().setValue(m_parameterTable->item(3, 3)->text().toDouble()); // 孔隙度
reservoirData.getInitialPressure().setValue(m_parameterTable->item(4, 3)->text().toDouble()); // 初始压力
reservoirData.getThickness().setValue(m_parameterTable->item(5, 3)->text().toDouble()); // 储层厚度
reservoirData.getCt().setValue(m_parameterTable->item(6, 3)->text().toDouble()); // 综合压缩系数
reservoirData.getCf().setValue(m_parameterTable->item(7, 3)->text().toDouble()); // 岩石压缩系数
reservoirData.getSwi().setValue(m_parameterTable->item(8, 3)->text().toDouble()); // 初始含水饱和度
reservoirData.getThickness().setValue(m_parameterTable->item(4, 3)->text().toDouble()); // 储层厚度
reservoirData.getCt().setValue(m_parameterTable->item(5, 3)->text().toDouble()); // 综合压缩系数
reservoirData.getCf().setValue(m_parameterTable->item(6, 3)->text().toDouble()); // 岩石压缩系数
reservoirData.getSwi().setValue(m_parameterTable->item(7, 3)->text().toDouble()); // 初始含水饱和度
// 更新储层数据(全局)
nmDataAnalyzeManager::getCurrentInstance()->updateReservoirData(reservoirData);
@ -1325,11 +1310,10 @@ void nmWxAutomaticFitting::updateBestParametersToTable()
if(m_sCheckBox->isChecked()) enabledParams.append(1); // 表皮系数
if(m_cCheckBox->isChecked()) enabledParams.append(2); // 井筒储集系数
if(m_phiCheckBox->isChecked()) enabledParams.append(3); // 孔隙度
if(m_piCheckBox->isChecked()) enabledParams.append(4); // 初始压力
if(m_hCheckBox->isChecked()) enabledParams.append(5); // 储层厚度
if(m_ctCheckBox->isChecked()) enabledParams.append(6); // 综合压缩系数
if(m_cfCheckBox->isChecked()) enabledParams.append(7); // 岩石压缩系数
if(m_swiCheckBox->isChecked()) enabledParams.append(8); // 初始含水饱和度
if(m_hCheckBox->isChecked()) enabledParams.append(4); // 储层厚度
if(m_ctCheckBox->isChecked()) enabledParams.append(5); // 综合压缩系数
if(m_cfCheckBox->isChecked()) enabledParams.append(6); // 岩石压缩系数
if(m_swiCheckBox->isChecked()) enabledParams.append(7); // 初始含水饱和度
// 范围收缩比例
double shrinkFactor = 0.3;
@ -1353,7 +1337,7 @@ void nmWxAutomaticFitting::updateBestParametersToTable()
double newMax = bestValue + newHalfRange;
// 确保某些参数不为负数
if (paramIndex == 0 || paramIndex == 2 || paramIndex == 3 || paramIndex == 5) {
if (paramIndex == 0 || paramIndex == 2 || paramIndex == 3 || paramIndex == 4) {
newMin = qMax(newMin, 0.0);
}
@ -1387,23 +1371,19 @@ void nmWxAutomaticFitting::updateBestParametersToTable()
automaticFittingData.getPorosityMin().setValue(newMin);
automaticFittingData.getPorosityMax().setValue(newMax);
break;
case 4: // 初始压力
automaticFittingData.getInitialPressureMin().setValue(newMin);
automaticFittingData.getInitialPressureMax().setValue(newMax);
break;
case 5: // 储层厚度
case 4: // 储层厚度
automaticFittingData.getThicknessMin().setValue(newMin);
automaticFittingData.getThicknessMax().setValue(newMax);
break;
case 6: // 综合压缩系数
case 5: // 综合压缩系数
automaticFittingData.getCtMin().setValue(newMin);
automaticFittingData.getCtMax().setValue(newMax);
break;
case 7: // 岩石压缩系数
case 6: // 岩石压缩系数
automaticFittingData.getCfMin().setValue(newMin);
automaticFittingData.getCfMax().setValue(newMax);
break;
case 8: // 初始含水饱和度
case 7: // 初始含水饱和度
automaticFittingData.getSwiMin().setValue(newMin);
automaticFittingData.getSwiMax().setValue(newMax);
break;

Loading…
Cancel
Save