diff --git a/dumux/assembly/cvfelocalassembler.hh b/dumux/assembly/cvfelocalassembler.hh index a057f660c233821e51004631582e23f99f760954..a12b66b6cf209716550614b2c5f74e2a443575d3 100644 --- a/dumux/assembly/cvfelocalassembler.hh +++ b/dumux/assembly/cvfelocalassembler.hh @@ -172,10 +172,13 @@ public: if (this->asImp_().problem().gridGeometry().dofOnPeriodicBoundary(scvI.dofIndex())) { const auto periodicDof = this->asImp_().problem().gridGeometry().periodicallyMappedDof(scvI.dofIndex()); - res[periodicDof][eqIdx] = this->curElemVolVars()[scvI].priVars()[pvIdx] - dirichletValues[pvIdx]; - const auto end = jac[periodicDof].end(); - for (auto it = jac[periodicDof].begin(); it != end; ++it) - (*it) = periodicDof != it.index() ? 0.0 : 1.0; + res[periodicDof][eqIdx] = this->asImp_().curSol()[periodicDof][pvIdx] - dirichletValues[pvIdx]; + + auto& rowP = jac[periodicDof]; + for (auto col = rowP.begin(); col != rowP.end(); ++col) + rowP[col.index()][eqIdx] = 0.0; + + rowP[periodicDof][eqIdx][pvIdx] = 1.0; } };