From aaf94f1393196392aaedb53fd36c3c84da0a3823 Mon Sep 17 00:00:00 2001 From: Martin Schneider <martin.schneider@iws.uni-stuttgart.de> Date: Mon, 8 Apr 2024 14:30:13 +0200 Subject: [PATCH] [assembly][periodic] Fix Dirichlet treatment for vector-valued unknowns --- dumux/assembly/cvfelocalassembler.hh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dumux/assembly/cvfelocalassembler.hh b/dumux/assembly/cvfelocalassembler.hh index a057f660c2..a12b66b6cf 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; } }; -- GitLab