From 5990201ee97dc95dbb8372c748d88b15956ad403 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Thu, 5 Jan 2017 10:02:50 +0100 Subject: [PATCH] Fix SOIL restart initialization --- opm/autodiff/Compat.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/opm/autodiff/Compat.hpp b/opm/autodiff/Compat.hpp index 12b775e73..8c57d72a2 100644 --- a/opm/autodiff/Compat.hpp +++ b/opm/autodiff/Compat.hpp @@ -120,6 +120,7 @@ inline void solutionToSim( const data::Solution& sol, SimulationDataContainer& state ) { const auto stride = phases.num_phases; + if( sol.has( "SWAT" ) ) { stripe( sol.data( "SWAT" ), stride, @@ -134,6 +135,18 @@ inline void solutionToSim( const data::Solution& sol, state.saturation() ); } + for (size_t c = 0; c < state.numCells(); ++c) { + double& so = state.saturation()[phases.num_phases*c + phases.phase_pos[ BlackoilPhases::Liquid ]]; + so = 1.0; + if (phases.phase_used[ BlackoilPhases::Aqua]) { + so -= state.saturation()[phases.num_phases*c + phases.phase_pos[ BlackoilPhases::Aqua ]]; + } + if (phases.phase_used[ BlackoilPhases::Vapour]) { + so -= state.saturation()[phases.num_phases*c + phases.phase_pos[ BlackoilPhases::Vapour ]]; + } + } + + if( sol.has( "PRESSURE" ) ) { state.pressure() = sol.data( "PRESSURE" ); }