不需要兼容旧版6个参数

feature/Model-20260625
lvjunjie 4 weeks ago
parent 5e731a3a3b
commit 2ede9c2410

@ -87,7 +87,7 @@ namespace RunnerIO
std::cerr << "RunnerIO::readParamsBin: header read failed\n"; std::cerr << "RunnerIO::readParamsBin: header read failed\n";
return false; return false;
} }
if (magic != MAGIC || (ver != 1 && ver != 2)) if (magic != MAGIC || ver != 2)
{ {
std::cerr << "RunnerIO::readParamsBin: magic/version mismatch\n"; std::cerr << "RunnerIO::readParamsBin: magic/version mismatch\n";
return false; return false;
@ -98,12 +98,7 @@ namespace RunnerIO
if (!readDouble(fs, out.wellboreC)) return false; if (!readDouble(fs, out.wellboreC)) return false;
if (!readDouble(fs, out.phi)) return false; if (!readDouble(fs, out.phi)) return false;
if (!readDouble(fs, out.h)) return false; if (!readDouble(fs, out.h)) return false;
out.hasCt = false; if (!readDouble(fs, out.Ct)) return false;
out.Ct = 0.0;
if (ver >= 2) {
if (!readDouble(fs, out.Ct)) return false;
out.hasCt = true;
}
if (!readDouble(fs, out.Cf)) return false; if (!readDouble(fs, out.Cf)) return false;
out.sectionIndex = 0; out.sectionIndex = 0;
@ -200,4 +195,4 @@ namespace RunnerIO
return fs.good(); return fs.good();
} }
} }

@ -13,7 +13,6 @@ struct RunnerParams
double h; double h;
double Ct; double Ct;
double Cf; double Cf;
bool hasCt;
// optional schedule extension // optional schedule extension
uint32_t sectionIndex; // wellFlowSectionIndex uint32_t sectionIndex; // wellFlowSectionIndex
@ -21,7 +20,7 @@ struct RunnerParams
std::vector<double> q; // m^3/d std::vector<double> q; // m^3/d
RunnerParams() RunnerParams()
: k(0), skin(0), wellboreC(0), phi(0), h(0), Ct(0), Cf(0), hasCt(false), sectionIndex(0) : k(0), skin(0), wellboreC(0), phi(0), h(0), Ct(0), Cf(0), sectionIndex(0)
{} {}
}; };

@ -130,7 +130,7 @@ static void applySampledParamsAndMaybeOverrideRate(HX_NWTM_MODEL_INPUT& in, cons
std::fill(in.Base.k.begin(), in.Base.k.end(), p.k); std::fill(in.Base.k.begin(), in.Base.k.end(), p.k);
std::fill(in.Base.phi.begin(), in.Base.phi.end(), p.phi); std::fill(in.Base.phi.begin(), in.Base.phi.end(), p.phi);
std::fill(in.Base.h.begin(), in.Base.h.end(), p.h); std::fill(in.Base.h.begin(), in.Base.h.end(), p.h);
if (p.hasCt) in.Base.Cti = p.Ct; in.Base.Cti = p.Ct;
in.Base.Cf = p.Cf; in.Base.Cf = p.Cf;
// 制度覆盖params.bin 带 schedule 才覆盖 // 制度覆盖params.bin 带 schedule 才覆盖
@ -440,4 +440,4 @@ int main(int argc, char** argv)
if (hMod_solver) FreeLibrary(hMod_solver); if (hMod_solver) FreeLibrary(hMod_solver);
FreeLibrary(hx); FreeLibrary(hx);
return 0; return 0;
} }

Loading…
Cancel
Save