mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #288 from totto82/fix_restart_norne
Fix restart norne
This commit is contained in:
commit
aaf885098d
@ -905,59 +905,60 @@ public:
|
||||
void setRestart(const Opm::data::Solution& sol, unsigned elemIdx, unsigned globalDofIndex)
|
||||
{
|
||||
Scalar so = 1.0;
|
||||
if( sol.has( "SWAT" ) ) {
|
||||
if( saturation_[waterPhaseIdx].size() > 0 && sol.has( "SWAT" ) ) {
|
||||
saturation_[waterPhaseIdx][elemIdx] = sol.data("SWAT")[globalDofIndex];
|
||||
so -= sol.data("SWAT")[globalDofIndex];
|
||||
}
|
||||
|
||||
if( sol.has( "SGAS" ) ) {
|
||||
if( saturation_[gasPhaseIdx].size() > 0 && sol.has( "SGAS" ) ) {
|
||||
saturation_[gasPhaseIdx][elemIdx] = sol.data("SGAS")[globalDofIndex];
|
||||
so -= sol.data("SGAS")[globalDofIndex];
|
||||
}
|
||||
|
||||
assert(saturation_[oilPhaseIdx].size() > 0);
|
||||
saturation_[oilPhaseIdx][elemIdx] = so;
|
||||
|
||||
if( sol.has( "PRESSURE" ) ) {
|
||||
if( oilPressure_.size() > 0 && sol.has( "PRESSURE" ) ) {
|
||||
oilPressure_[elemIdx] = sol.data( "PRESSURE" )[globalDofIndex];
|
||||
}
|
||||
|
||||
if( sol.has( "TEMP" ) ) {
|
||||
if( temperature_.size() > 0 && sol.has( "TEMP" ) ) {
|
||||
temperature_[elemIdx] = sol.data( "TEMP" )[globalDofIndex];
|
||||
}
|
||||
|
||||
if( sol.has( "RS" ) ) {
|
||||
if( rs_.size() > 0 && sol.has( "RS" ) ) {
|
||||
rs_[elemIdx] = sol.data("RS")[globalDofIndex];
|
||||
}
|
||||
|
||||
if( sol.has( "RV" ) ) {
|
||||
if( rv_.size() > 0 && sol.has( "RV" ) ) {
|
||||
rv_[elemIdx] = sol.data("RV")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has( "SSOL" ) ) {
|
||||
if ( sSol_.size() > 0 && sol.has( "SSOL" ) ) {
|
||||
sSol_[elemIdx] = sol.data("SSOL")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has("POLYMER" ) ) {
|
||||
if ( cPolymer_.size() > 0 && sol.has("POLYMER" ) ) {
|
||||
cPolymer_[elemIdx] = sol.data("POLYMER")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has("SOMAX" ) ) {
|
||||
if ( soMax_.size() > 0 && sol.has("SOMAX" ) ) {
|
||||
soMax_[elemIdx] = sol.data("SOMAX")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has("PCSWM_OW" ) ) {
|
||||
if ( pcSwMdcOw_.size() > 0 &&sol.has("PCSWM_OW" ) ) {
|
||||
pcSwMdcOw_[elemIdx] = sol.data("PCSWM_OW")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has("KRNSW_OW" ) ) {
|
||||
if ( krnSwMdcOw_.size() > 0 && sol.has("KRNSW_OW" ) ) {
|
||||
krnSwMdcOw_[elemIdx] = sol.data("KRNSW_OW")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has("PCSWM_GO" ) ) {
|
||||
if ( pcSwMdcGo_.size() > 0 && sol.has("PCSWM_GO" ) ) {
|
||||
pcSwMdcGo_[elemIdx] = sol.data("PCSWM_GO")[globalDofIndex];
|
||||
}
|
||||
|
||||
if ( sol.has("KRNSW_GO" ) ) {
|
||||
if ( krnSwMdcGo_.size() > 0 && sol.has("KRNSW_GO" ) ) {
|
||||
krnSwMdcGo_[elemIdx] = sol.data("KRNSW_GO")[globalDofIndex];
|
||||
}
|
||||
}
|
||||
@ -1008,7 +1009,7 @@ public:
|
||||
void initHysteresisParams(Simulator& simulator, unsigned elemIdx) const {
|
||||
|
||||
if (soMax_.size() > 0)
|
||||
simulator.problem().setMaxOilSaturation(soMax_[elemIdx], elemIdx);
|
||||
simulator.problem().setMaxOilSaturation(elemIdx, soMax_[elemIdx]);
|
||||
|
||||
if (simulator.problem().materialLawManager()->enableHysteresis()) {
|
||||
auto matLawManager = simulator.problem().materialLawManager();
|
||||
|
@ -564,8 +564,9 @@ public:
|
||||
simulator.setTimeStepSize(dt);
|
||||
}
|
||||
|
||||
bool doInvalidate = updateHysteresis_();
|
||||
doInvalidate = doInvalidate || updateMaxOilSaturation_();
|
||||
const bool invalidateFromHyst = updateHysteresis_();
|
||||
const bool invalidateFromMaxOilSat = updateMaxOilSaturation_();
|
||||
const bool doInvalidate = invalidateFromHyst || invalidateFromMaxOilSat;
|
||||
|
||||
if (GET_PROP_VALUE(TypeTag, EnablePolymer))
|
||||
updateMaxPolymerAdsorption_();
|
||||
|
@ -236,17 +236,18 @@ public:
|
||||
|
||||
void restartBegin()
|
||||
{
|
||||
bool enableHysteresis = simulator_.problem().materialLawManager()->enableHysteresis();
|
||||
std::map<std::string, Opm::RestartKey> solution_keys {{"PRESSURE" , Opm::RestartKey(Opm::UnitSystem::measure::pressure)},
|
||||
{"SWAT" , Opm::RestartKey(Opm::UnitSystem::measure::identity, FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx))},
|
||||
{"SGAS" , Opm::RestartKey(Opm::UnitSystem::measure::identity, FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx))},
|
||||
{"TEMP" , Opm::RestartKey(Opm::UnitSystem::measure::temperature)}, // always required for now
|
||||
{"RS" , Opm::RestartKey(Opm::UnitSystem::measure::gas_oil_ratio, FluidSystem::enableDissolvedGas())},
|
||||
{"RV" , Opm::RestartKey(Opm::UnitSystem::measure::oil_gas_ratio, FluidSystem::enableVaporizedOil())},
|
||||
{"SOMAX", {Opm::UnitSystem::measure::identity, false}},
|
||||
{"PCSWM_OW", {Opm::UnitSystem::measure::identity, false}},
|
||||
{"KRNSW_OW", {Opm::UnitSystem::measure::identity, false}},
|
||||
{"PCSWM_GO", {Opm::UnitSystem::measure::identity, false}},
|
||||
{"KRNSW_GO", {Opm::UnitSystem::measure::identity, false}}};
|
||||
{"SOMAX", {Opm::UnitSystem::measure::identity, simulator_.problem().vapparsActive()}},
|
||||
{"PCSWM_OW", {Opm::UnitSystem::measure::identity, enableHysteresis}},
|
||||
{"KRNSW_OW", {Opm::UnitSystem::measure::identity, enableHysteresis}},
|
||||
{"PCSWM_GO", {Opm::UnitSystem::measure::identity, enableHysteresis}},
|
||||
{"KRNSW_GO", {Opm::UnitSystem::measure::identity, enableHysteresis}}};
|
||||
|
||||
std::map<std::string, bool> extra_keys {
|
||||
{"OPMEXTRA" , false}
|
||||
|
Loading…
Reference in New Issue
Block a user