diff --git a/dumux/multidomain/embedded/couplingmanager1d3d_average.hh b/dumux/multidomain/embedded/couplingmanager1d3d_average.hh index aa405034e2ed7e844d03b77af9f0f241e199b168..26b61fd4cba0ef9c988072989e47bde28463eb7d 100644 --- a/dumux/multidomain/embedded/couplingmanager1d3d_average.hh +++ b/dumux/multidomain/embedded/couplingmanager1d3d_average.hh @@ -135,7 +135,7 @@ public: JacobianMatrixDiagBlock& A, GridVariables& gridVariables) { - extendedSourceStencil_.evalAdditionalDomainDerivatives(*this, domainI, localAssemblerI, this->curSol(), A, gridVariables); + extendedSourceStencil_.evalAdditionalDomainDerivatives(*this, domainI, localAssemblerI, A, gridVariables); } /* \brief Compute integration point point sources and associated data diff --git a/dumux/multidomain/embedded/couplingmanager1d3d_kernel.hh b/dumux/multidomain/embedded/couplingmanager1d3d_kernel.hh index 2fc693cf36cb5d0ada8716b0718851c26038adab..d64de37a39e23bb58d6dcc7d185ad35d3b2c4b5c 100644 --- a/dumux/multidomain/embedded/couplingmanager1d3d_kernel.hh +++ b/dumux/multidomain/embedded/couplingmanager1d3d_kernel.hh @@ -147,7 +147,7 @@ public: JacobianMatrixDiagBlock& A, GridVariables& gridVariables) { - extendedSourceStencil_.evalAdditionalDomainDerivatives(*this, domainI, localAssemblerI, this->curSol(), A, gridVariables); + extendedSourceStencil_.evalAdditionalDomainDerivatives(*this, domainI, localAssemblerI, A, gridVariables); } /* \brief Compute integration point point sources and associated data diff --git a/dumux/multidomain/embedded/couplingmanager1d3d_surface.hh b/dumux/multidomain/embedded/couplingmanager1d3d_surface.hh index 886ef74b23b44db30ec7d034b9f71542b1ddad00..dc8de7fbcb4b443d6a78c0d98252672cec1ef04a 100644 --- a/dumux/multidomain/embedded/couplingmanager1d3d_surface.hh +++ b/dumux/multidomain/embedded/couplingmanager1d3d_surface.hh @@ -132,7 +132,7 @@ public: JacobianMatrixDiagBlock& A, GridVariables& gridVariables) { - extendedSourceStencil_.evalAdditionalDomainDerivatives(*this, domainI, localAssemblerI, this->curSol(), A, gridVariables); + extendedSourceStencil_.evalAdditionalDomainDerivatives(*this, domainI, localAssemblerI, A, gridVariables); } /* \brief Compute integration point point sources and associated data diff --git a/dumux/multidomain/embedded/couplingmanagerbase.hh b/dumux/multidomain/embedded/couplingmanagerbase.hh index 2fe4e66c55799f8cb0f5e5732e06c6d46e47246f..b1cd9c4b723764465e17ee62bc85f5f405623203 100644 --- a/dumux/multidomain/embedded/couplingmanagerbase.hh +++ b/dumux/multidomain/embedded/couplingmanagerbase.hh @@ -419,7 +419,26 @@ public: const CouplingStencil<i>& emptyStencil(Dune::index_constant<i> dom) const { return std::get<i>(emptyStencil_); } + /*! + * \brief the solution vector of the subproblem + * \param domainIdx The domain index + * \note in case of numeric differentiation the solution vector always carries the deflected solution + */ + template<std::size_t i> + auto& curSol(Dune::index_constant<i> domainIdx) + { return ParentType::curSol(domainIdx); } + + /*! + * \brief the solution vector of the subproblem + * \param domainIdx The domain index + * \note in case of numeric differentiation the solution vector always carries the deflected solution + */ + template<std::size_t i> + const auto& curSol(Dune::index_constant<i> domainIdx) const + { return ParentType::curSol(domainIdx); } + protected: + using ParentType::curSol; //! computes the vertex indices per element for the box method template<std::size_t id> diff --git a/dumux/multidomain/embedded/extendedsourcestencil.hh b/dumux/multidomain/embedded/extendedsourcestencil.hh index bfdc88d867ca5d4a05ddd62fc3ab470bec870743..6a80947f99f4af397a876f36be46cdfef73536e6 100644 --- a/dumux/multidomain/embedded/extendedsourcestencil.hh +++ b/dumux/multidomain/embedded/extendedsourcestencil.hh @@ -94,15 +94,15 @@ public: * term depends on a non-local average of a quantity of the same domain * \note This is the same for box and cc */ - template<std::size_t i, class LocalAssemblerI, class SolutionVector, class JacobianMatrixDiagBlock, class GridVariables> + template<std::size_t i, class LocalAssemblerI, class JacobianMatrixDiagBlock, class GridVariables> void evalAdditionalDomainDerivatives(CouplingManager& couplingManager, Dune::index_constant<i> domainI, const LocalAssemblerI& localAssemblerI, - const SolutionVector& curSol, JacobianMatrixDiagBlock& A, GridVariables& gridVariables) const { - constexpr auto numEq = std::decay_t<decltype(curSol[domainI][0])>::size(); + const auto& curSolI = couplingManager.curSol(domainI); + constexpr auto numEq = std::decay_t<decltype(curSolI[0])>::size(); const auto& elementI = localAssemblerI.element(); // only do something if we have an extended stencil @@ -116,7 +116,7 @@ public: for (const auto dofIndex : extendedSourceStencil_(couplingManager, domainI, elementI)) { auto partialDerivs = origResidual; - const auto origPriVars = curSol[domainI][dofIndex]; + const auto origPriVars = curSolI[dofIndex]; // calculate derivatives w.r.t to the privars at the dof at hand for (int pvIdx = 0; pvIdx < numEq; pvIdx++) @@ -135,7 +135,7 @@ public: // derive the residuals numerically static const int numDiffMethod = getParam<int>("Assembly.NumericDifferenceMethod"); - NumericDifferentiation::partialDerivative(evalResiduals, curSol[domainI][dofIndex][pvIdx], + NumericDifferentiation::partialDerivative(evalResiduals, curSolI[dofIndex][pvIdx], partialDerivs, origResidual, numDiffMethod); // update the global stiffness matrix with the current partial derivatives @@ -157,6 +157,21 @@ public: } } + /*! + * \brief Deprecated overload + */ + template<std::size_t i, class LocalAssemblerI, class SolutionVector, class JacobianMatrixDiagBlock, class GridVariables> + [[deprecated("Use signature without curSol. Will be removed after release 3.5")]] + void evalAdditionalDomainDerivatives(CouplingManager& couplingManager, + Dune::index_constant<i> domainI, + const LocalAssemblerI& localAssemblerI, + const SolutionVector& curSol, + JacobianMatrixDiagBlock& A, + GridVariables& gridVariables) const + { + evalAdditionalDomainDerivatives(couplingManager, domainI, localAssemblerI, A, gridVariables); + } + //! clear the internal data void clear() { sourceStencils_.clear(); } @@ -175,7 +190,7 @@ private: if (auto stencil = sourceStencils_.find(bulkElementIdx); stencil != sourceStencils_.end()) return stencil->second; } - + return couplingManager.emptyStencil(domainId); }