From dd9ad42a28bbdccb6532f76896f98ced29299674 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Tue, 26 Sep 2017 09:36:30 +0200 Subject: [PATCH] correcting the size of seg_comp_initial_ based on num_comp for standards wells, all the three equations are mass balance equatiions, it is safe to use numWellEq. for MS wells, there is one extra pressure equation, it should be the number of mass balance equations. If we do not put the polymer equation inside the well equations, we will face dilemma soon. --- opm/autodiff/MultisegmentWell_impl.hpp | 8 +++++--- opm/autodiff/StandardWell_impl.hpp | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/opm/autodiff/MultisegmentWell_impl.hpp b/opm/autodiff/MultisegmentWell_impl.hpp index af6eb1179..7536b598a 100644 --- a/opm/autodiff/MultisegmentWell_impl.hpp +++ b/opm/autodiff/MultisegmentWell_impl.hpp @@ -33,7 +33,7 @@ namespace Opm , segment_inlets_(numberOfSegments()) , perforation_cell_pressure_diffs_(number_of_perforations_, 0.0) , segment_perforation_depth_diffs_(number_of_perforations_) - , segment_comp_initial_(numberOfSegments(), std::vector(numWellEq, 0.0)) + , segment_comp_initial_(numberOfSegments(), std::vector(numComponents(), 0.0)) , segment_densities_(numberOfSegments(), 0.0) , segment_depth_diffs_(numberOfSegments(), 0.0) { @@ -762,8 +762,10 @@ namespace Opm computeInitialComposition() { for (int seg = 0; seg < numberOfSegments(); ++seg) { - for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) { - segment_comp_initial_[seg][eq_idx] = surfaceVolumeFraction(seg, eq_idx).value(); + // TODO: probably it should be numWellEq -1 more accurately, + // while by meaning it should be num_comp + for (int comp_idx = 0; comp_idx < numComponents(); ++comp_idx) { + segment_comp_initial_[seg][comp_idx] = surfaceVolumeFraction(seg, comp_idx).value(); } } } diff --git a/opm/autodiff/StandardWell_impl.hpp b/opm/autodiff/StandardWell_impl.hpp index e420ea967..f42159cc4 100644 --- a/opm/autodiff/StandardWell_impl.hpp +++ b/opm/autodiff/StandardWell_impl.hpp @@ -316,7 +316,7 @@ namespace Opm StandardWell:: wellVolumeFraction(const int compIdx) const { - const auto pu = phaseUsage(); + const auto& pu = phaseUsage(); if (active()[Water] && compIdx == pu.phase_pos[Water]) { return primary_variables_evaluation_[WFrac]; } @@ -1525,6 +1525,8 @@ namespace Opm StandardWell:: computeAccumWell() { + // TODO: it should be num_comp, while it also bring problem for + // the polymer case. for (int eq_idx = 0; eq_idx < numWellEq; ++eq_idx) { F0_[eq_idx] = wellSurfaceVolumeFraction(eq_idx).value(); }