diff --git a/dumux/discretization/staggered/connectivitymap.hh b/dumux/discretization/staggered/connectivitymap.hh index 630c3391567282f10745d565212fae872ed10b08..58913596968620b6753685c1779b2f9e08eff259 100644 --- a/dumux/discretization/staggered/connectivitymap.hh +++ b/dumux/discretization/staggered/connectivitymap.hh @@ -31,13 +31,20 @@ namespace Dumux { +namespace Properties +{ + NEW_PROP_TAG(StaggeredFluxStencils); +} + template<class TypeTag> class StaggeredConnectivityMap { using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using Element = typename GridView::template Codim<0>::Entity; using IndexType = typename GridView::IndexSet::IndexType; using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); @@ -53,6 +60,7 @@ class StaggeredConnectivityMap using FaceToFaceMap = std::vector<std::vector<IndexType>>; using Stencil = std::vector<IndexType>; + using FluxStencils = typename GET_PROP_TYPE(TypeTag, StaggeredFluxStencils); public: @@ -76,7 +84,6 @@ public: std::vector<Stencil> fullfaceToFaceStencils; fullfaceToFaceStencils.resize(numDofsFace); - FluxVariables fluxVars; for(auto&& element: elements(fvGridGeometry.gridView())) { // restrict the FvGeometry locally and bind to the element @@ -87,12 +94,12 @@ public: for (auto&& scvf : scvfs(fvGeometry)) { const auto dofIdxCellCenter = fvGridGeometry.elementMapper().index(element); - fluxVars.computeCellCenterToCellCenterStencil(cellCenterToCellCenterMap_[dofIdxCellCenter], element, fvGeometry, scvf); - fluxVars.computeCellCenterToFaceStencil(cellCenterToFaceMap_[dofIdxCellCenter], element, fvGeometry, scvf); + FluxStencils::computeCellCenterToCellCenterStencil(cellCenterToCellCenterMap_[dofIdxCellCenter], element, fvGeometry, scvf); + FluxStencils::computeCellCenterToFaceStencil(cellCenterToFaceMap_[dofIdxCellCenter], element, fvGeometry, scvf); const auto scvfIdx = scvf.index(); - fluxVars.computeFaceToCellCenterStencil(faceToCellCenterMap_[scvfIdx], fvGeometry, scvf); - fluxVars.computeFaceToFaceStencil(faceToFaceMap_[scvfIdx], fvGeometry, scvf); + FluxStencils::computeFaceToCellCenterStencil(faceToCellCenterMap_[scvfIdx], fvGeometry, scvf); + FluxStencils::computeFaceToFaceStencil(faceToFaceMap_[scvfIdx], fvGeometry, scvf); } } } diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index 778405f0ef4bd51e08a9b487ea6f998b5db30869..3d5deffe3fd38f27e5f3c89792ef3a6aba036138 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -129,64 +129,6 @@ public: return result; } - void computeCellCenterToCellCenterStencil(Stencil& stencil, - const Element& element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf) - { - // the first entry is always the cc dofIdx itself - if(stencil.empty()) - stencil.push_back(scvf.insideScvIdx()); - if(!scvf.boundary()) - stencil.push_back(scvf.outsideScvIdx()); - } - - void computeCellCenterToFaceStencil(Stencil& stencil, - const Element& element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf) - { - stencil.push_back(scvf.dofIndex()); - } - - void computeFaceToCellCenterStencil(Stencil& stencil, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf) - { - const int eIdx = scvf.insideScvIdx(); - stencil.push_back(scvf.insideScvIdx()); - - for(const auto& data : scvf.pairData()) - { - auto& normalFace = fvGeometry.scvf(eIdx, data.localNormalFaceIdx); - const auto outerParallelElementDofIdx = normalFace.outsideScvIdx(); - if(!normalFace.boundary()) - stencil.push_back(outerParallelElementDofIdx); - } - } - - void computeFaceToFaceStencil(Stencil& stencil, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf) - { - // the first entries are always the face dofIdx itself and the one of the opposing face - if(stencil.empty()) - { - stencil.push_back(scvf.dofIndex()); - stencil.push_back(scvf.dofIndexOpposingFace()); - } - - for(const auto& data : scvf.pairData()) - { - stencil.push_back(data.normalPair.first); - const auto outerParallelFaceDofIdx = data.outerParallelFaceDofIdx; - if(outerParallelFaceDofIdx >= 0) - stencil.push_back(outerParallelFaceDofIdx); - if(!scvf.boundary()) - stencil.push_back(data.normalPair.second); - } - } - /*! * \brief Returns the normal part of the momentum flux * \param scvf The sub control volume face diff --git a/test/discretization/staggered/test_staggeredfvgeometry.cc b/test/discretization/staggered/test_staggeredfvgeometry.cc index 96efaaf397d18478957ace3a71416c8108c8beba..fb6049fdb6ff81cfa115f1b7ce9341b5b5ad2773 100644 --- a/test/discretization/staggered/test_staggeredfvgeometry.cc +++ b/test/discretization/staggered/test_staggeredfvgeometry.cc @@ -38,34 +38,34 @@ namespace Dumux { //! Dummy flux variables class so that we can update the connectivity map -class MockFluxVariables +class MockFluxStencil { public: template<class Map, class Element, class FvGeometry, class Scvf> - void computeCellCenterToCellCenterStencil(Map& map, - const Element& element, - const FvGeometry& fvGeometry, - const Scvf& scvf) + static void computeCellCenterToCellCenterStencil(Map& map, + const Element& element, + const FvGeometry& fvGeometry, + const Scvf& scvf) {} template<class Map, class Element, class FvGeometry, class Scvf> - void computeCellCenterToFaceStencil(Map& map, - const Element& element, - const FvGeometry& fvGeometry, - const Scvf& scvf) + static void computeCellCenterToFaceStencil(Map& map, + const Element& element, + const FvGeometry& fvGeometry, + const Scvf& scvf) {} template<class Map, class FvGeometry, class Scvf> - void computeFaceToCellCenterStencil(Map& map, - const FvGeometry& fvGeometry, - const Scvf& scvf) + static void computeFaceToCellCenterStencil(Map& map, + const FvGeometry& fvGeometry, + const Scvf& scvf) {} template<class Map, class FvGeometry, class Scvf> - void computeFaceToFaceStencil(Map& map, - const FvGeometry& fvGeometry, - const Scvf& scvf) + static void computeFaceToFaceStencil(Map& map, + const FvGeometry& fvGeometry, + const Scvf& scvf) {} }; @@ -76,7 +76,7 @@ NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(StaggeredModel)); SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>); -SET_TYPE_PROP(TestFVGeometry, FluxVariables, MockFluxVariables); +SET_TYPE_PROP(TestFVGeometry, StaggeredFluxStencils, MockFluxStencil); SET_BOOL_PROP(TestFVGeometry, EnableFVGridGeometryCache, true); }