diff --git a/dumux/discretization/cellcentered/connectivitymap.hh b/dumux/discretization/cellcentered/connectivitymap.hh index 2c7447599bce86118902c3633b0198c5bade164e..5c69551e779f3e361c2753411ba21e616d9d84ff 100644 --- a/dumux/discretization/cellcentered/connectivitymap.hh +++ b/dumux/discretization/cellcentered/connectivitymap.hh @@ -26,6 +26,9 @@ #define DUMUX_CC_CONNECTIVITY_MAP_HH #include <vector> +#include <utility> +#include <dumux/common/properties.hh> +#include <dumux/discretization/fluxstencil.hh> namespace Dumux { @@ -44,9 +47,9 @@ template<class TypeTag> class CCSimpleConnectivityMap { using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; + using FluxStencil = Dumux::FluxStencil<TypeTag>; struct DataJ { @@ -84,7 +87,7 @@ public: // loop over sub control faces for (auto&& scvf : scvfs(fvGeometry)) { - const auto& stencil = FluxVariables::computeStencil(element, fvGeometry, scvf); + const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf); // insert our index in the neighbor stencils of the elements in the flux stencil for (auto globalI : stencil) diff --git a/dumux/discretization/cellcentered/mpfa/connectivitymap.hh b/dumux/discretization/cellcentered/mpfa/connectivitymap.hh index 8e080563327860088097e17f9aa36fbe14deac12..3c7152e75b9f48069ee935a476535f5718dffda8 100644 --- a/dumux/discretization/cellcentered/mpfa/connectivitymap.hh +++ b/dumux/discretization/cellcentered/mpfa/connectivitymap.hh @@ -24,6 +24,7 @@ #ifndef DUMUX_CC_MPFA_CONNECTIVITY_MAP_HH #define DUMUX_CC_MPFA_CONNECTIVITY_MAP_HH +#include <dumux/common/properties.hh> #include <dumux/discretization/cellcentered/mpfa/methods.hh> #include <dumux/discretization/cellcentered/connectivitymap.hh> #include <dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh> diff --git a/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh b/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh index 3c455c515533c6b4143816140831226aaf95d5c6..fce8cd33d6ed48c3434ee62a58c90b7d1e1514ae 100644 --- a/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh +++ b/dumux/discretization/cellcentered/mpfa/generalconnectivitymap.hh @@ -24,6 +24,11 @@ #ifndef DUMUX_CC_MPFA_GENERAL_CONNECTIVITY_MAP_HH #define DUMUX_CC_MPFA_GENERAL_CONNECTIVITY_MAP_HH +#include <vector> +#include <utility> +#include <dumux/common/properties.hh> +#include <dumux/discretization/fluxstencil.hh> + namespace Dumux { @@ -40,9 +45,9 @@ class CCMpfaGeneralConnectivityMap { using MpfaHelper = typename GET_PROP_TYPE(TypeTag, MpfaHelper); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); - using FluxVariables = typename GET_PROP_TYPE(TypeTag, FluxVariables); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using IndexType = typename GridView::IndexSet::IndexType; + using FluxStencil = Dumux::FluxStencil<TypeTag>; // To each cell "globalI" there will be a list of "globalJ", in which globalI is part // of the stencil. We save the scvfs over which fluxes depend on globalI and a list of @@ -80,8 +85,7 @@ public: // loop over sub control faces for (auto&& scvf : scvfs(fvGeometry)) { - FluxVariables fluxVars; - const auto& stencil = fluxVars.computeStencil(element, fvGeometry, scvf); + const auto& stencil = FluxStencil::stencil(element, fvGeometry, scvf); // insert our index in the neighbor stencils of the elements in the flux stencil for (auto globalI : stencil) @@ -192,6 +196,6 @@ public: private: Map map_; }; -} +} // end namespace Dumux #endif diff --git a/dumux/discretization/fluxstencil.hh b/dumux/discretization/fluxstencil.hh index d6edbc1be92783a03f172ecdbb16514591631030..23a6090db01892b6af9db1f99a12bd9e4a10bc2a 100644 --- a/dumux/discretization/fluxstencil.hh +++ b/dumux/discretization/fluxstencil.hh @@ -45,33 +45,10 @@ class FluxStencilImplementation; template<class TypeTag> using FluxStencil = FluxStencilImplementation<TypeTag, GET_PROP_VALUE(TypeTag, DiscretizationMethod)>; -//! Flux stencil for the box method -template<class TypeTag> -class FluxStencilImplementation<TypeTag, DiscretizationMethods::Box> -{ - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - 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 Stencil = std::vector<IndexType>; - -public: - // This is for compatibility with the cc methods. The flux stencil info is obsolete for the box method. - static Stencil stencil(const Element& element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf) - { - return Stencil(); - } -}; - //! Flux stencil for the cell-centered TPFA scheme template<class TypeTag> class FluxStencilImplementation<TypeTag, DiscretizationMethods::CCTpfa> { - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); @@ -102,7 +79,6 @@ public: template<class TypeTag> class FluxStencilImplementation<TypeTag, DiscretizationMethods::CCMpfa> { - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace); diff --git a/dumux/discretization/fluxvariablesbase.hh b/dumux/discretization/fluxvariablesbase.hh index d2d74d03b7c3c71394ab5380a3b189a8a66dc9ff..f0ecac1fef5c3bb0374e7184c69605dcf8c73d4c 100644 --- a/dumux/discretization/fluxvariablesbase.hh +++ b/dumux/discretization/fluxvariablesbase.hh @@ -23,14 +23,12 @@ #ifndef DUMUX_DISCRETIZATION_FLUXVARIABLESBASE_HH #define DUMUX_DISCRETIZATION_FLUXVARIABLESBASE_HH -#include <dumux/discretization/methods.hh> -#include <dumux/discretization/fluxstencil.hh> #include <dumux/discretization/upwindscheme.hh> namespace Dumux { -template<class TypeTag, class UpwindScheme, class FluxStencil> +template<class TypeTag, class UpwindScheme> class FluxVariablesBaseImplementation; /*! @@ -39,7 +37,7 @@ class FluxVariablesBaseImplementation; * The upwind scheme is chosen depending on the discretization method */ template<class TypeTag> -using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, UpwindScheme<TypeTag>, FluxStencil<TypeTag>>; +using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, UpwindScheme<TypeTag>>; /*! * \ingroup Discretization @@ -48,7 +46,7 @@ using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, UpwindScheme< * \param TypeTag The type tag * \param UpwindScheme The type used for the upwinding of the advective fluxes */ -template<class TypeTag, class UpwindScheme, class FluxStencil> +template<class TypeTag, class UpwindScheme> class FluxVariablesBaseImplementation { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); @@ -105,14 +103,6 @@ public: return UpwindScheme::apply(*this, upwindTerm, flux, phaseIdx); } - static Stencil computeStencil(const Element& element, - const FVElementGeometry& fvGeometry, - const SubControlVolumeFace& scvf) - { - //! Forward to the discretization specific implementation - return FluxStencil::stencil(element, fvGeometry, scvf); - } - private: const Problem* problemPtr_; //! Pointer to the problem const Element* elementPtr_; //! Pointer to the element at hand diff --git a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc index baa2ecac3477dd6c4f5414d64573d5b67e8c2581..87109b1cedbdae0742fd2961ed51f2b711b8a544 100644 --- a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc +++ b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc @@ -34,26 +34,12 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> -//! Dummy flux variables class so that we can update the connectivity map -class MockFluxVariables -{ -public: - template<class Element, class FvGeometry, class Scvf> - static std::vector<std::size_t> computeStencil(const Element& element, - const FvGeometry& fvGeometry, - const Scvf& scvf) - { - return std::vector<std::size_t>(); - } -}; - namespace Dumux { - namespace Properties { - NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(CCTpfaModel)); - SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>); - SET_TYPE_PROP(TestFVGeometry, FluxVariables, MockFluxVariables); - } -} +namespace Properties { +NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(CCTpfaModel)); +SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<2>); +} // end namespace Properties +} // end namespace Dumux template<class T> class NoopFunctor { diff --git a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc index 34548b1a6a105707455b1fd36e97f557a0173218..89ac7daad5dd77b03a69270ac5721165533027cd 100644 --- a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc +++ b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry_nonconforming.cc @@ -36,33 +36,18 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/cellcentered/tpfa/properties.hh> -//! Dummy flux variables class so that we can update the connectivity map -class MockFluxVariables -{ -public: - template<class Element, class FvGeometry, class Scvf> - static std::vector<std::size_t> computeStencil(const Element& element, - const FvGeometry& fvGeometry, - const Scvf& scvf) - { - return std::vector<std::size_t>(); - } -}; - namespace Dumux { - namespace Properties{ - //! Test without using global caching of the geometries - NEW_TYPE_TAG(TestFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel)); - SET_TYPE_PROP(TestFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); - SET_TYPE_PROP(TestFVGeometryNonConforming, FluxVariables, MockFluxVariables); - - //! Test using global geometry caching - NEW_TYPE_TAG(TestCachedFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel)); - SET_TYPE_PROP(TestCachedFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); - SET_BOOL_PROP(TestCachedFVGeometryNonConforming, EnableFVGridGeometryCache, true); - SET_TYPE_PROP(TestCachedFVGeometryNonConforming, FluxVariables, MockFluxVariables); - } -} +namespace Properties{ +//! Test without using global caching of the geometries +NEW_TYPE_TAG(TestFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel)); +SET_TYPE_PROP(TestFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); + +//! Test using global geometry caching +NEW_TYPE_TAG(TestCachedFVGeometryNonConforming, INHERITS_FROM(CCTpfaModel)); +SET_TYPE_PROP(TestCachedFVGeometryNonConforming, Grid, Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>); +SET_BOOL_PROP(TestCachedFVGeometryNonConforming, EnableFVGridGeometryCache, true); +} // end namespace Properties +} // end namespace Dumux //! epsilon for checking direction of scvf normals constexpr double eps = 1e-6;