Merge pull request #5676 from OPM/backport-of-pr-5675

Fix memory bug in setPrimaryVars for MSW
This commit is contained in:
Bård Skaflestad 2024-10-16 09:40:02 +02:00 committed by GitHub
commit 996bd78172
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2237,7 +2237,7 @@ namespace Opm
constexpr int num_eq = MSWEval::numWellEq;
std::array<Scalar, num_eq> tmp;
for (int ii = 0; ii < num_seg; ++ii) {
const auto start = it + num_seg * num_eq;
const auto start = it + ii * num_eq;
std::copy(start, start + num_eq, tmp.begin());
this->primary_variables_.setValue(ii, tmp);
}