From 44ab370faed52b212c19aeb7e82f89d1ed6ecdd6 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Mon, 19 Feb 2018 08:49:02 +0100 Subject: [PATCH] Make the restart code more robust. Don't assume all needed data is given in the restart file. i.e. make it possible to run a solvent restart run from a standard blackoil run. --- ebos/ecloutputblackoilmodule.hh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index 157300008..956e7637d 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -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]; } }