From 0ab5a1f3e9134fb22e814c35aa8541d72542096c Mon Sep 17 00:00:00 2001 From: DennisGlaeser <dennis.glaeser@iws.uni-stuttgart.de> Date: Wed, 15 Feb 2017 12:34:28 +0100 Subject: [PATCH] [mpfa-o] interaction volume gets implementation as template parameter by passing the implementation of the actual method's interaction volume type to the o-method interaction volume we are able to overload functionalities in derived classes and still use different interaction volume types on the boundary and inside the domain. This was not possible through the property system as it was unclear which interaction volume is the actual implementation. --- .../mpfa/lmethod/interactionvolume.hh | 3 +- .../mpfa/omethod/interactionvolume.hh | 22 +++---- .../mpfa/omethodfps/interactionvolume.hh | 13 ++-- .../facet/mpfa/interactionvolume.hh | 63 ++++++------------- dumux/mixeddimension/facet/mpfa/properties.hh | 7 +-- 5 files changed, 42 insertions(+), 66 deletions(-) diff --git a/dumux/discretization/cellcentered/mpfa/lmethod/interactionvolume.hh b/dumux/discretization/cellcentered/mpfa/lmethod/interactionvolume.hh index 6ab3030efd..c5647e7b05 100644 --- a/dumux/discretization/cellcentered/mpfa/lmethod/interactionvolume.hh +++ b/dumux/discretization/cellcentered/mpfa/lmethod/interactionvolume.hh @@ -66,7 +66,8 @@ public: * \brief Base class for the interaction volumes of the mpfa-l method. */ template<class TypeTag> -class CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::lMethod> : public CCMpfaInteractionVolumeBase<TypeTag, CCMpfaLInteractionVolumeTraits<TypeTag>> +class CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::lMethod> + : public CCMpfaInteractionVolumeBase<TypeTag, CCMpfaLInteractionVolumeTraits<TypeTag>> { // The interaction volume implementation has to be friend friend typename GET_PROP_TYPE(TypeTag, InteractionVolume); diff --git a/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh b/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh index 532846a65f..28d37d8079 100644 --- a/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh +++ b/dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh @@ -61,7 +61,8 @@ public: }; //! Forward declaration of the mpfa-o interaction volume -template<class TypeTag, class Traits> class CCMpfaOInteractionVolume; +template<class TypeTag, class Traits, class Implementation> +class CCMpfaOInteractionVolume; /*! * \ingroup Mpfa @@ -71,10 +72,14 @@ template<class TypeTag, class Traits> class CCMpfaOInteractionVolume; * traits class. */ template<class TypeTag> -class CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod> : public CCMpfaOInteractionVolume<TypeTag, CCMpfaOInteractionVolumeTraits<TypeTag>> +class CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod> + : public CCMpfaOInteractionVolume<TypeTag, + CCMpfaOInteractionVolumeTraits<TypeTag>, + CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod>> { + using ThisType = CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod>; using TraitsType = CCMpfaOInteractionVolumeTraits<TypeTag>; - using ParentType = CCMpfaOInteractionVolume<TypeTag, TraitsType>; + using ParentType = CCMpfaOInteractionVolume<TypeTag, TraitsType, ThisType>; using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); @@ -94,18 +99,13 @@ public: }; -template<class TypeTag, class Traits> +template<class TypeTag, class Traits, class Implementation> class CCMpfaOInteractionVolume : public CCMpfaInteractionVolumeBase<TypeTag, Traits> { - // The interaction volume implementations have to be friend, - // because some methods use the mpfa-o interaction volume as base - friend typename GET_PROP_TYPE(TypeTag, InteractionVolume); - friend typename Traits::BoundaryInteractionVolume; + // The actual implementation has to be friend + friend Implementation; - // We assume the actual implementation always to be the boundary-specific implementation - using Implementation = typename Traits::BoundaryInteractionVolume; using ParentType = CCMpfaInteractionVolumeBase<TypeTag, Traits>; - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); diff --git a/dumux/discretization/cellcentered/mpfa/omethodfps/interactionvolume.hh b/dumux/discretization/cellcentered/mpfa/omethodfps/interactionvolume.hh index add7c081b8..8ff3f3186a 100644 --- a/dumux/discretization/cellcentered/mpfa/omethodfps/interactionvolume.hh +++ b/dumux/discretization/cellcentered/mpfa/omethodfps/interactionvolume.hh @@ -43,8 +43,9 @@ class CCMpfaOFpsInteractionVolumeTraits : public CCMpfaOInteractionVolumeTraits< public: // Interior boundaries can not yet be handled by the currend o-method fps implementation // In that case we use the o-interactionvolume, otherwise we use its own interaction volumes at the boundary - // TODO Implement this using std::conditional - using BoundaryInteractionVolume = CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethodFps>; + using BoundaryInteractionVolume = typename std::conditional<GET_PROP_VALUE(TypeTag, EnableInteriorBoundaries), + CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod>, + CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethodFps>>::type; // The local sub-control volume type differs from the standard mpfa-o method using LocalScvType = CCMpfaOFpsLocalScv<TypeTag>; @@ -54,10 +55,14 @@ public: * \brief Base class for the interaction volumes of the mpfa-o method with full pressure support. */ template<class TypeTag> -class CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethodFps> : public CCMpfaOInteractionVolume<TypeTag, CCMpfaOFpsInteractionVolumeTraits<TypeTag>> +class CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethodFps> + : public CCMpfaOInteractionVolume<TypeTag, + CCMpfaOFpsInteractionVolumeTraits<TypeTag>, + CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethodFps>> { using Traits = CCMpfaOFpsInteractionVolumeTraits<TypeTag>; - using ParentType = CCMpfaOInteractionVolume<TypeTag, Traits>; + using ThisType = CCMpfaInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethodFps>; + using ParentType = CCMpfaOInteractionVolume<TypeTag, Traits, ThisType>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); diff --git a/dumux/mixeddimension/facet/mpfa/interactionvolume.hh b/dumux/mixeddimension/facet/mpfa/interactionvolume.hh index 5a4a58f2b0..a0831c8a92 100644 --- a/dumux/mixeddimension/facet/mpfa/interactionvolume.hh +++ b/dumux/mixeddimension/facet/mpfa/interactionvolume.hh @@ -20,8 +20,8 @@ * \file * \brief Base classes for interaction volumes of mpfa models with active coupling over the element facets. */ -#ifndef DUMUX_MIXEDDIMENSION_FACET_INTERACTIONVOLUME_HH -#define DUMUX_MIXEDDIMENSION_FACET_INTERACTIONVOLUME_HH +#ifndef DUMUX_MIXEDDIMENSION_FACET_MPFA_O_INTERACTIONVOLUME_HH +#define DUMUX_MIXEDDIMENSION_FACET_MPFA_O_INTERACTIONVOLUME_HH #include <dumux/discretization/cellcentered/mpfa/interactionvolume.hh> #include <dumux/discretization/cellcentered/mpfa/facetypes.hh> @@ -29,54 +29,27 @@ namespace Dumux { -// forward declaration of the implementation -template<class TypeTag, MpfaMethods Method> -class CCMpfaFacetCouplingInteractionVolumeImplementation; +//! Forward declaration +template<class TypeTag> class CCMpfaOFacetCouplingInteractionVolume; -/*! - * \ingroup MixedDimension - * \brief Base class for the interaction volumes of the mpfa method with active coupling over the element facets. - */ -template<class TypeTag> -using CCMpfaFacetCouplingInteractionVolume = CCMpfaFacetCouplingInteractionVolumeImplementation<TypeTag, GET_PROP_VALUE(TypeTag, MpfaMethod)>; - -// Per default, we inherit from the standard interaction volumes -template<class TypeTag, MpfaMethods Method> -class CCMpfaFacetCouplingInteractionVolumeImplementation : public CCMpfaInteractionVolumeImplementation<TypeTag, Method> -{ - using ParentType = CCMpfaInteractionVolumeImplementation<TypeTag, Method>; - - using Problem = typename GET_PROP_TYPE(TypeTag, Problem); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); - using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, ElementVolumeVariables); - -public: - using typename ParentType::Seed; - - CCMpfaFacetCouplingInteractionVolumeImplementation(const Seed& seed, - const Problem& problem, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars) - : ParentType(seed, problem, fvGeometry, elemVolVars) - {} -}; - -//! Specialization of the interaction volume traits class for the coupled models +//! Specialization of the interaction volume traits class for the o-method in coupled models template<class TypeTag> -class CCMpfaFacetCouplingOInteractionVolumeTraits : public CCMpfaOInteractionVolumeTraits<TypeTag> +class CCMpfaOFacetCouplingInteractionVolumeTraits : public CCMpfaOInteractionVolumeTraits<TypeTag> { public: - using BoundaryInteractionVolume = CCMpfaFacetCouplingInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod>; + using BoundaryInteractionVolume = CCMpfaOFacetCouplingInteractionVolume<TypeTag>; }; // the o-method interaction volume is substituted by the one including data on the facet element's -// tensorial quantities into the local system to be solved. This has to be used as boundary interaction volume +// tensorial quantities into the local system to be solved. template<class TypeTag> -class CCMpfaFacetCouplingInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod> - : public CCMpfaOInteractionVolume<TypeTag, CCMpfaFacetCouplingOInteractionVolumeTraits<TypeTag>> +class CCMpfaOFacetCouplingInteractionVolume : public CCMpfaOInteractionVolume<TypeTag, + CCMpfaOFacetCouplingInteractionVolumeTraits<TypeTag>, + CCMpfaOFacetCouplingInteractionVolume<TypeTag>> { - using Traits = CCMpfaFacetCouplingOInteractionVolumeTraits<TypeTag>; - using ParentType = CCMpfaOInteractionVolume<TypeTag, Traits>; + using Traits = CCMpfaOFacetCouplingInteractionVolumeTraits<TypeTag>; + using ThisType = CCMpfaOFacetCouplingInteractionVolume<TypeTag>; + using ParentType = CCMpfaOInteractionVolume<TypeTag, Traits, ThisType>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); @@ -97,10 +70,10 @@ public: using typename ParentType::LocalIndexType; using typename ParentType::Seed; - CCMpfaFacetCouplingInteractionVolumeImplementation(const Seed& seed, - const Problem& problem, - const FVElementGeometry& fvGeometry, - const ElementVolumeVariables& elemVolVars) + CCMpfaOFacetCouplingInteractionVolume(const Seed& seed, + const Problem& problem, + const FVElementGeometry& fvGeometry, + const ElementVolumeVariables& elemVolVars) : ParentType(seed, problem, fvGeometry, elemVolVars) {} diff --git a/dumux/mixeddimension/facet/mpfa/properties.hh b/dumux/mixeddimension/facet/mpfa/properties.hh index 75237f39d2..5b8104083a 100644 --- a/dumux/mixeddimension/facet/mpfa/properties.hh +++ b/dumux/mixeddimension/facet/mpfa/properties.hh @@ -42,11 +42,8 @@ namespace Properties { NEW_TYPE_TAG(FacetCouplingBulkMpfaModel, INHERITS_FROM(CCMpfaModel)); -//! The interaction volume class -SET_TYPE_PROP(FacetCouplingBulkMpfaModel, InteractionVolume, CCMpfaFacetCouplingInteractionVolume<TypeTag>); - -//! The boundary interaction volume class (for methods other than the omethod) -SET_TYPE_PROP(FacetCouplingBulkMpfaModel, BoundaryInteractionVolume, CCMpfaFacetCouplingInteractionVolumeImplementation<TypeTag, MpfaMethods::oMethod>); +//! The boundary interaction volume class (we use the facet coupling specialized o-method interaction volume) +SET_TYPE_PROP(FacetCouplingBulkMpfaModel, BoundaryInteractionVolume, CCMpfaOFacetCouplingInteractionVolume<TypeTag>); //! The interior boundary data class SET_TYPE_PROP(FacetCouplingBulkMpfaModel, InteriorBoundaryData, CCMpfaFacetCouplingInteriorBoundaryData<TypeTag>); -- GitLab