diff --git a/dumux/assembly/cclocalassembler.hh b/dumux/assembly/cclocalassembler.hh index 9a9b8168e246e8cc6ae78c09022695a96db0926d..a539283a120d08d81fb0b0f80fa9a75a52c71d6e 100644 --- a/dumux/assembly/cclocalassembler.hh +++ b/dumux/assembly/cclocalassembler.hh @@ -272,6 +272,12 @@ public: partialDerivs[0][pvIdx] = 1.0; } + // restore the original state of the scv's volume variables + curVolVars = origVolVars; + + // restore the current element solution + elemSol[0][pvIdx] = origPriVars[pvIdx]; + // add the current partial derivatives to the global jacobian matrix // no special treatment is needed if globalJ is a ghost because then derivatives have been assembled to 0 above if constexpr (Problem::enableInternalDirichletConstraints()) @@ -323,12 +329,6 @@ public: A[dataJ.globalJ][globalI][eqIdx][pvIdx] += partialDerivs[j++][eqIdx]; } } - - // restore the original state of the scv's volume variables - curVolVars = origVolVars; - - // restore the current element solution - elemSol[0][pvIdx] = origPriVars[pvIdx]; } // restore original state of the flux vars cache in case of global caching. @@ -442,6 +442,12 @@ public: // results in a delta of zero for ghosts else partialDeriv[pvIdx] = 1.0; + // restore the original state of the scv's volume variables + curVolVars = origVolVars; + + // restore the current element solution + elemSol[0][pvIdx] = origPriVars[pvIdx]; + // add the current partial derivatives to the global jacobian matrix // only diagonal entries for explicit jacobians if constexpr (Problem::enableInternalDirichletConstraints()) @@ -466,12 +472,6 @@ public: for (int eqIdx = 0; eqIdx < numEq; eqIdx++) A[globalI][globalI][eqIdx][pvIdx] += partialDeriv[eqIdx]; } - - // restore the original state of the scv's volume variables - curVolVars = origVolVars; - - // restore the current element solution - elemSol[0][pvIdx] = origPriVars[pvIdx]; } // return the original residual diff --git a/dumux/multidomain/subdomaincclocalassembler.hh b/dumux/multidomain/subdomaincclocalassembler.hh index 54c1a9768265be5db918f1c692a2387f9c9afa8b..1af0ca57bd29c8fced3f31a51567df6cc04a1b26 100644 --- a/dumux/multidomain/subdomaincclocalassembler.hh +++ b/dumux/multidomain/subdomaincclocalassembler.hh @@ -419,6 +419,15 @@ public: partialDerivs[0][pvIdx] = 1.0; } + // restore the original state of the scv's volume variables + curVolVars = origVolVars; + + // restore the current element solution + elemSol[0][pvIdx] = origPriVars[pvIdx]; + + // restore the undeflected state of the coupling context + this->couplingManager().updateCouplingContext(domainI, *this, domainI, globalI, elemSol[0], pvIdx); + // add the current partial derivatives to the global jacobian matrix if constexpr (Problem::enableInternalDirichletConstraints()) { @@ -469,15 +478,6 @@ public: A[dataJ.globalJ][globalI][eqIdx][pvIdx] += partialDerivs[j++][eqIdx]; } } - - // restore the original state of the scv's volume variables - curVolVars = origVolVars; - - // restore the current element solution - elemSol[0][pvIdx] = origPriVars[pvIdx]; - - // restore the undeflected state of the coupling context - this->couplingManager().updateCouplingContext(domainI, *this, domainI, globalI, elemSol[0], pvIdx); } // restore original state of the flux vars cache in case of global caching. @@ -720,6 +720,12 @@ public: // results in a delta of zero for ghosts else partialDeriv[pvIdx] = 1.0; + // restore the original state of the scv's volume variables + curVolVars = origVolVars; + + // restore the current element solution + elemSol[0][pvIdx] = origPriVars[pvIdx]; + // add the current partial derivatives to the global jacobian matrix // only diagonal entries for explicit jacobians if constexpr (Problem::enableInternalDirichletConstraints()) @@ -744,12 +750,6 @@ public: for (int eqIdx = 0; eqIdx < numEq; eqIdx++) A[globalI][globalI][eqIdx][pvIdx] += partialDeriv[eqIdx]; } - - // restore the original state of the scv's volume variables - curVolVars = origVolVars; - - // restore the current element solution - elemSol[0][pvIdx] = origPriVars[pvIdx]; } // return the original residual