From eac56aac02d099c7874575997fe2edf831875553 Mon Sep 17 00:00:00 2001 From: Ned Coltman <edward.coltman@iws.uni-stuttgart.de> Date: Fri, 8 Mar 2019 12:02:53 +0100 Subject: [PATCH] [discretization][assembly][faces] remove scvf self index from stencil --- dumux/assembly/jacobianpattern.hh | 2 +- .../discretization/staggered/facesolution.hh | 6 +++-- .../staggered/freeflow/connectivitymap.hh | 1 - .../subdomainstaggeredlocalassembler.hh | 22 ++++++++++++++----- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/dumux/assembly/jacobianpattern.hh b/dumux/assembly/jacobianpattern.hh index 87f28b888d..3829a66b73 100644 --- a/dumux/assembly/jacobianpattern.hh +++ b/dumux/assembly/jacobianpattern.hh @@ -125,7 +125,6 @@ auto getJacobianPattern(const GridGeometry& gridGeometry) const auto numDofs = gridGeometry.numDofs(); Dune::MatrixIndexSet pattern(numDofs, numDofs); - const auto& connectivityMap = gridGeometry.connectivityMap(); // evaluate the acutal pattern @@ -150,6 +149,7 @@ auto getJacobianPattern(const GridGeometry& gridGeometry) for (auto&& scvf : scvfs(fvGeometry)) { const auto faceGlobalI = scvf.dofIndex(); + pattern.add(faceGlobalI, faceGlobalI); for (auto&& faceGlobalJ : connectivityMap(faceIdx, faceIdx, scvf.index())) pattern.add(faceGlobalI, faceGlobalJ); } diff --git a/dumux/discretization/staggered/facesolution.hh b/dumux/discretization/staggered/facesolution.hh index 71a486ec46..29d3bad86c 100644 --- a/dumux/discretization/staggered/facesolution.hh +++ b/dumux/discretization/staggered/facesolution.hh @@ -50,9 +50,11 @@ public: const auto& connectivityMap = fvGridGeometry.connectivityMap(); const auto& stencil = connectivityMap(FVGridGeometry::faceIdx(), FVGridGeometry::faceIdx(), scvf.index()); - facePriVars_.reserve(stencil.size()); - map_.reserve(stencil.size()); + facePriVars_.reserve(stencil.size()+1); + map_.reserve(stencil.size()+1); + map_.push_back(scvf.dofIndex()); + facePriVars_.push_back(sol[scvf.dofIndex()]); for(const auto dofJ : stencil) { map_.push_back(dofJ); diff --git a/dumux/discretization/staggered/freeflow/connectivitymap.hh b/dumux/discretization/staggered/freeflow/connectivitymap.hh index 536bef3c24..573af54841 100644 --- a/dumux/discretization/staggered/freeflow/connectivitymap.hh +++ b/dumux/discretization/staggered/freeflow/connectivitymap.hh @@ -181,7 +181,6 @@ private: { if(stencil.empty()) { - stencil.push_back(scvf.axisData().selfDof); stencil.push_back(scvf.axisData().oppositeDof); addHigherOrderInAxisDofs_(scvf, stencil, std::integral_constant<bool, useHigherOrder>{}); } diff --git a/dumux/multidomain/subdomainstaggeredlocalassembler.hh b/dumux/multidomain/subdomainstaggeredlocalassembler.hh index fd497df6a1..103ff467e3 100644 --- a/dumux/multidomain/subdomainstaggeredlocalassembler.hh +++ b/dumux/multidomain/subdomainstaggeredlocalassembler.hh @@ -668,7 +668,7 @@ public: // // ////////////////////////////////////////////////////////////////////////////////////////////////// - // build derivatives with for cell center dofs w.r.t. cell center dofs + // build derivatives for face dofs w.r.t. face dofs const auto& connectivityMap = fvGridGeometry.connectivityMap(); for (auto&& scvf : scvfs(fvGeometry)) @@ -679,8 +679,8 @@ public: using FaceSolution = GetPropType<TypeTag, Properties::StaggeredFaceSolution>; const auto origFaceSolution = FaceSolution(scvf, curSol, fvGridGeometry); - // build derivatives with for face dofs w.r.t. cell center dofs - for (const auto& globalJ : connectivityMap(faceId, faceId, scvf.index())) + // Lambda to evaluate the derivatives for faces + auto evaluateFaceDerivatives = [&](const std::size_t globalJ) { // get the faceVars of the face with respect to which we are going to build the derivative auto& faceVars = getFaceVarAccess(gridVariables.curGridFaceVars(), this->curElemFaceVars(), scvf); @@ -719,9 +719,19 @@ public: // restore the undeflected state of the coupling context this->couplingManager().updateCouplingContext(domainI, *this, domainI, globalJ, origFaceSolution[globalJ], pvIdx); - } - } - } + } + }; + + // evaluate derivatives w.r.t. own dof + evaluateFaceDerivatives(scvf.dofIndex()); + + // get the list of face dofs that have an influence on the resdiual of the current face + const auto& connectivityMap = fvGridGeometry.connectivityMap(); + + // evaluate derivatives w.r.t. all other related face dofs + for (const auto& globalJ : connectivityMap(faceId, faceId, scvf.index())) + evaluateFaceDerivatives(globalJ); + } return origResiduals; } -- GitLab