Makes hysteresis and somax optional in restart file

This commit is contained in:
babrodtk 2017-04-07 16:20:35 +02:00
parent 1fd36e9451
commit 4d286cf0b3
4 changed files with 25 additions and 19 deletions

View File

@ -123,6 +123,7 @@ data::Solution simToSolution( const SimulationDataContainer& reservoir,
void solutionToSim( const data::Solution& sol,
const std::map<std::string,std::vector<double> >& extra,
PhaseUsage phases,
SimulationDataContainer& state ) {
@ -174,29 +175,29 @@ void solutionToSim( const data::Solution& sol,
state.getCellData("SSOL") = sol.data("SSOL");
}
if ( sol.has( "SOMAX" ) ) {
if ( extra.find("SOMAX") != extra.end() ) {
state.registerCellData("SOMAX", 1);
state.getCellData("SOMAX") = sol.data("SOMAX");
state.getCellData("SOMAX") = extra.find("SOMAX")->second;
}
if ( sol.has( "PCSWM_OW" ) ) {
if ( extra.find("PCSWM_OW") != extra.end() ) {
state.registerCellData("PCSWMDC_OW", 1);
state.getCellData("PCSWMDC_OW") = sol.data("PCSWM_OW");
state.getCellData("PCSWMDC_OW") = extra.find("PCSWM_OW")->second;
}
if ( sol.has( "KRNSW_OW" ) ) {
if ( extra.find("KRNSW_OW") != extra.end() ) {
state.registerCellData("KRNSWMDC_OW", 1);
state.getCellData("KRNSWMDC_OW") = sol.data("KRNSW_OW");
state.getCellData("KRNSWMDC_OW") = extra.find("KRNSW_OW")->second;
}
if ( sol.has( "PCSWM_GO" ) ) {
if ( extra.find("PCSWM_GO") != extra.end() ) {
state.registerCellData("PCSWMDC_GO", 1);
state.getCellData("PCSWMDC_GO") = sol.data("PCSWM_GO");
state.getCellData("PCSWMDC_GO") = extra.find("PCSWM_GO")->second;
}
if ( sol.has( "KRNSW_GO" ) ) {
if ( extra.find("KRNSW_GO") != extra.end() ) {
state.registerCellData("KRNSWMDC_GO", 1);
state.getCellData("KRNSWMDC_GO") = sol.data("KRNSW_GO");
state.getCellData("KRNSWMDC_GO") = extra.find("KRNSW_GO")->second;
}
}

View File

@ -59,7 +59,9 @@ namespace Opm {
/// Copies the following fields from sol into state (all conditionally):
/// PRESSURE, TEMP, SWAT, SGAS, RS, RV, SSOL
/// Also handles extra data such as hysteresis parameters, SOMAX, etc.
void solutionToSim( const data::Solution& sol,
const std::map<std::string,std::vector<double> >& extra,
PhaseUsage phases,
SimulationDataContainer& state );

View File

@ -665,7 +665,8 @@ namespace Opm
if( isIORank() )
{
// Update values in the globalReservoirState
solutionToSim(*globalCellData_, phaseUsage_, *globalReservoirState_);
const std::map<std::string, std::vector<double> > no_extra_data;
solutionToSim(*globalCellData_, no_extra_data, phaseUsage_, *globalReservoirState_);
}
return isIORank();
}

View File

@ -424,13 +424,15 @@ namespace Opm
{"SGAS" , UnitSystem::measure::identity},
{"TEMP" , UnitSystem::measure::temperature},
{"RS" , UnitSystem::measure::gas_oil_ratio},
{"RV" , UnitSystem::measure::oil_gas_ratio},
{"SOMAX", UnitSystem::measure::identity},
{"PCSWM_OW", UnitSystem::measure::identity},
{"KRNSW_OW", UnitSystem::measure::identity},
{"PCSWM_GO", UnitSystem::measure::identity},
{"KRNSW_GO", UnitSystem::measure::identity}};
std::map<std::string, bool> extra_keys {{"OPMEXTRA" , false}};
{"RV" , UnitSystem::measure::oil_gas_ratio}};
std::map<std::string, bool> extra_keys {
{"OPMEXTRA" , false},
{"SOMAX", false},
{"PCSWM_OW", false},
{"KRNSW_OW", false},
{"PCSWM_GO", false},
{"KRNSW_GO", false}
};
if (restart_double_si_) {
// Avoid any unit conversions, treat restart input as SI units.
@ -462,7 +464,7 @@ namespace Opm
wellstate.resize(wells, simulatorstate, phaseUsage ); //Resize for restart step
auto restart_values = eclIO_->loadRestart(solution_keys, extra_keys);
solutionToSim( restart_values.solution, phaseUsage, simulatorstate );
solutionToSim( restart_values.solution, restart_values.extra, phaseUsage, simulatorstate );
wellsToState( restart_values.wells, phaseUsage, wellstate );
const auto opmextra_iter = restart_values.extra.find("OPMEXTRA");