Merge pull request #5668 from totto82/fixGWrestart

FIX gas-water restart
This commit is contained in:
Bård Skaflestad 2024-10-17 09:18:31 +02:00 committed by GitHub
commit 0d4b7ece0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 8 deletions

View File

@ -497,19 +497,18 @@ public:
const auto gasActive = FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx); const auto gasActive = FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx);
const auto waterActive = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx); const auto waterActive = FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx);
const auto enableSwatinit = simulator_.vanguard().eclState().fieldProps().has_double("SWATINIT"); const auto enableSwatinit = simulator_.vanguard().eclState().fieldProps().has_double("SWATINIT");
const auto opm_rst_file = Parameters::Get<Parameters::EnableOpmRstFile>();
const auto read_temp = enableEnergy || (opm_rst_file && enableTemperature);
std::vector<RestartKey> solutionKeys { std::vector<RestartKey> solutionKeys {
{"PRESSURE", UnitSystem::measure::pressure}, {"PRESSURE", UnitSystem::measure::pressure},
{"SWAT", UnitSystem::measure::identity, waterActive}, {"SWAT", UnitSystem::measure::identity, waterActive},
{"SGAS", UnitSystem::measure::identity, gasActive}, {"SGAS", UnitSystem::measure::identity, gasActive},
{"TEMP", UnitSystem::measure::temperature, read_temp}, {"TEMP", UnitSystem::measure::temperature, enableEnergy},
{"SSOLVENT", UnitSystem::measure::identity, enableSolvent}, {"SSOLVENT", UnitSystem::measure::identity, enableSolvent},
{"RS", UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGas()}, {"RS", UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGas()},
{"RV", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedOil()}, {"RV", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedOil()},
{"RVW", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedWater()}, {"RVW", UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedWater()},
{"RSW", UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGasInWater()},
{"SGMAX", UnitSystem::measure::identity, enableNonWettingHysteresis && oilActive && gasActive}, {"SGMAX", UnitSystem::measure::identity, enableNonWettingHysteresis && oilActive && gasActive},
{"SHMAX", UnitSystem::measure::identity, enableWettingHysteresis && oilActive && gasActive}, {"SHMAX", UnitSystem::measure::identity, enableWettingHysteresis && oilActive && gasActive},

View File

@ -802,9 +802,9 @@ setRestart(const data::Solution& sol,
rswSol_[elemIdx] = sol.data<double>("RSWSOL")[globalDofIndex]; rswSol_[elemIdx] = sol.data<double>("RSWSOL")[globalDofIndex];
} }
if (!saturation_[oilPhaseIdx].empty()) {
assert(!saturation_[oilPhaseIdx].empty()); saturation_[oilPhaseIdx][elemIdx] = so;
saturation_[oilPhaseIdx][elemIdx] = so; }
auto assign = [elemIdx, globalDofIndex, &sol](const std::string& name, auto assign = [elemIdx, globalDofIndex, &sol](const std::string& name,
ScalarBuffer& data) ScalarBuffer& data)

View File

@ -1146,12 +1146,18 @@ public:
MaterialLaw::capillaryPressures(pc, matParams, fs); MaterialLaw::capillaryPressures(pc, matParams, fs);
Valgrind::CheckDefined(this->fluidPressure_[elemIdx]); Valgrind::CheckDefined(this->fluidPressure_[elemIdx]);
Valgrind::CheckDefined(pc); Valgrind::CheckDefined(pc);
assert(FluidSystem::phaseIsActive(oilPhaseIdx)); const auto& pressure = this->fluidPressure_[elemIdx];
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) { for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
if (!FluidSystem::phaseIsActive(phaseIdx)) if (!FluidSystem::phaseIsActive(phaseIdx))
continue; continue;
fs.setPressure(phaseIdx, this->fluidPressure_[elemIdx] + (pc[phaseIdx] - pc[oilPhaseIdx])); if (Indices::oilEnabled)
fs.setPressure(phaseIdx, pressure + (pc[phaseIdx] - pc[oilPhaseIdx]));
else if (Indices::gasEnabled)
fs.setPressure(phaseIdx, pressure + (pc[phaseIdx] - pc[gasPhaseIdx]));
else if (Indices::waterEnabled)
//single (water) phase
fs.setPressure(phaseIdx, pressure);
} }
} }