diff --git a/dumux/porousmediumflow/compositional/primaryvariableswitch.hh b/dumux/porousmediumflow/compositional/primaryvariableswitch.hh index d8f507cba4cef8ec5bbb8fd244f6b616308a8e68..64bd67763f8ba455065e567e1208d202d20b43c0 100644 --- a/dumux/porousmediumflow/compositional/primaryvariableswitch.hh +++ b/dumux/porousmediumflow/compositional/primaryvariableswitch.hh @@ -139,20 +139,21 @@ public: for (auto&& scv : scvs(fvGeometry)) { + // Update volVars on which grounds we decide + // if we need to switch the primary variables + auto&& volVars = curGlobalVolVars.volVars(eIdx, scv.indexInElement()); + volVars.update(curElemSol, problem, element, scv); + auto dofIdxGlobal = scv.dofIndex(); + if (!visited_[dofIdxGlobal]) { // Note this implies that volume variables don't differ // in any sub control volume associated with the dof! visited_[dofIdxGlobal] = true; - // Compute temporary volVars on which grounds we decide - // if we need to switch the primary variables - auto&& volVars = curGlobalVolVars.volVars(eIdx, scv.indexInElement()); - volVars.update(curElemSol, problem, element, scv); if (asImp_().update_(curSol[dofIdxGlobal], volVars, dofIdxGlobal, scv.dofPosition())) switched = true; - } } }