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(); }