mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #1198 from dr-robertk/PR/fix-densewell-for-2p
[bugfix] Fix invalid read in WellDenseStandard when used with 2P Model.
This commit is contained in:
commit
2a66aa23a9
@ -700,11 +700,18 @@ namespace Opm {
|
|||||||
setWellVariables(const WellState& xw)
|
setWellVariables(const WellState& xw)
|
||||||
{
|
{
|
||||||
const int nw = wells().number_of_wells;
|
const int nw = wells().number_of_wells;
|
||||||
for (int eqIdx = 0; eqIdx < numWellEq; ++eqIdx) {
|
// for two-phase numComp < numEq
|
||||||
|
const int numComp = numComponents();
|
||||||
|
for (int eqIdx = 0; eqIdx < numComp; ++eqIdx) {
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
wellVariables_[w + nw*eqIdx] = 0.0;
|
const unsigned int idx = nw * eqIdx + w;
|
||||||
wellVariables_[w + nw*eqIdx].setValue(xw.wellSolutions()[w + nw* eqIdx]);
|
assert( idx < wellVariables_.size() );
|
||||||
wellVariables_[w + nw*eqIdx].setDerivative(numWellEq + eqIdx, 1.0);
|
assert( idx < xw.wellSolutions().size() );
|
||||||
|
EvalWell& eval = wellVariables_[ idx ];
|
||||||
|
|
||||||
|
eval = 0.0;
|
||||||
|
eval.setValue( xw.wellSolutions()[ idx ] );
|
||||||
|
eval.setDerivative(numWellEq + eqIdx, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user