diff --git a/dumux/assembly/staggeredlocalassembler.hh b/dumux/assembly/staggeredlocalassembler.hh index a7debdde3df2ce4450f0d435af9974a4669863bc..488ff6d96804494b8cfb1c7c1177fb2a1c80027b 100644 --- a/dumux/assembly/staggeredlocalassembler.hh +++ b/dumux/assembly/staggeredlocalassembler.hh @@ -70,6 +70,7 @@ class StaggeredLocalAssembler<TypeTag, using NumFaceEqVector = typename GET_PROP_TYPE(TypeTag, FacePrimaryVariables); using FaceSolutionVector = typename GET_PROP_TYPE(TypeTag, FaceSolutionVector); + using FaceSolution = typename GET_PROP_TYPE(TypeTag, StaggeredFaceSolution); enum { numEq = GET_PROP_VALUE(TypeTag, NumEq) }; @@ -516,7 +517,7 @@ static void dFacedFace_(Assembler& assembler, for(auto pvIdx : PriVarIndices(faceIdx)) { - auto faceSolution = StaggeredFaceSolution<TypeTag>(scvf, curSol[faceIdx], assembler.fvGridGeometry()); + auto faceSolution = FaceSolution(scvf, curSol[faceIdx], assembler.fvGridGeometry()); const Scalar eps = numericEpsilon(faceSolution[globalJ][pvIdx], faceIdx, faceIdx); diff --git a/dumux/discretization/staggered/elementfacevariables.hh b/dumux/discretization/staggered/elementfacevariables.hh index ee142f93e237e562734f46de50f27927d23c2844..6bc70023581c76dfc20d4166b78e1b051502a00f 100644 --- a/dumux/discretization/staggered/elementfacevariables.hh +++ b/dumux/discretization/staggered/elementfacevariables.hh @@ -28,9 +28,17 @@ namespace Dumux { +/*! + * \ingroup ImplicitModel + * \brief Base class for the face variables vector + */ +template<class TypeTag, bool enableGlobalFaceVarsCache> +class StaggeredElementFaceVariables +{}; + template<class TypeTag> -class StaggeredElementFaceVariables +class StaggeredElementFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/true> { using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Element = typename GridView::template Codim<0>::Entity; @@ -71,6 +79,43 @@ private: const GlobalFaceVars* globalFaceVarsPtr_; }; +template<class TypeTag> +class StaggeredElementFaceVariables<TypeTag, /*enableGlobalFaceVarsCache*/false> +{ + using GridView = typename GET_PROP_TYPE(TypeTag, GridView); + using Element = typename GridView::template Codim<0>::Entity; + using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); + using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); + using GlobalFaceVars = typename GET_PROP_TYPE(TypeTag, GlobalFaceVars); + using FaceVariables = typename GET_PROP_TYPE(TypeTag, FaceVariables); + using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); + using IndexType = typename GridView::IndexSet::IndexType; + + using DofTypeIndices = typename GET_PROP(TypeTag, DofTypeIndices); + typename DofTypeIndices::CellCenterIdx cellCenterIdx; + typename DofTypeIndices::FaceIdx faceIdx; + +public: + //! For compatibility reasons with the case of not storing the vol vars. + //! function to be called before assembling an element, preparing the vol vars within the stencil + void bind(const Element& element, + const FVElementGeometry& fvGeometry, + const SolutionVector& sol) + { + faceVariables_.resize(fvGeometry.numScvf()); + + for(auto&& scvf : scvfs(fvGeometry)) + { + // TODO: do proper update + // faceVariables_[scvf.localFaceIdx()].update(sol[faceIdx], problem_(), element, fvGeometry, scvf) + + } + } +private: + std::vector<IndexType> faceVarIndices_; + std::vector<FaceVariables> faceVariables_; +}; + } // end namespace #endif diff --git a/dumux/discretization/staggered/properties.hh b/dumux/discretization/staggered/properties.hh index 15f153ebeeaca4399846da48fa7866ab3ff9979f..eee1b8aaded7a2079fa3db996252d9a9b3868b07 100644 --- a/dumux/discretization/staggered/properties.hh +++ b/dumux/discretization/staggered/properties.hh @@ -64,6 +64,7 @@ NEW_PROP_TAG(CellCenterSolutionVector); NEW_PROP_TAG(FaceSolutionVector); NEW_PROP_TAG(StaggeredFaceSolution); NEW_PROP_TAG(ElementFaceVariables); +NEW_PROP_TAG(EnableGlobalFaceVariablesCache); //! Type tag for the box scheme. NEW_TYPE_TAG(StaggeredModel, INHERITS_FROM(FiniteVolumeModel, NumericModel)); @@ -115,7 +116,9 @@ SET_TYPE_PROP(StaggeredModel, IntersectionMapper, Dumux::ConformingGridIntersect SET_TYPE_PROP(StaggeredModel, StaggeredFaceSolution, StaggeredFaceSolution<TypeTag>); -SET_TYPE_PROP(StaggeredModel, ElementFaceVariables, StaggeredElementFaceVariables<TypeTag>); +SET_TYPE_PROP(StaggeredModel, ElementFaceVariables, StaggeredElementFaceVariables<TypeTag, GET_PROP_VALUE(TypeTag, EnableGlobalFaceVariablesCache)>); + +SET_BOOL_PROP(StaggeredModel, EnableGlobalFaceVariablesCache, true); //! Definition of the indices for cell center and face dofs in the global solution vector SET_PROP(StaggeredModel, DofTypeIndices)