diff --git a/dumux/discretization/fluxvariablesbase.hh b/dumux/discretization/fluxvariablesbase.hh index 39fb993a4f0d48c1545c80b5b9b000b00af2c683..12ffb50a7b7d508ac310ee304f3623e9f5944f0c 100644 --- a/dumux/discretization/fluxvariablesbase.hh +++ b/dumux/discretization/fluxvariablesbase.hh @@ -24,33 +24,16 @@ #ifndef DUMUX_DISCRETIZATION_FLUXVARIABLESBASE_HH #define DUMUX_DISCRETIZATION_FLUXVARIABLESBASE_HH -#include <dumux/common/properties.hh> -#include <dumux/discretization/upwindscheme.hh> - namespace Dumux { -// forward declaration -template<class TypeTag, class Impl, class UpwindScheme> -class FluxVariablesBaseImplementation; - -/*! - * \ingroup Discretization - * \brief Base class for the flux variables living on a sub control volume face - * \note The upwind scheme is chosen depending on the discretization method - */ -template<class TypeTag, class Impl> -using FluxVariablesBase = FluxVariablesBaseImplementation<TypeTag, Impl, UpwindScheme<typename GET_PROP_TYPE(TypeTag, FVGridGeometry)>>; - /*! * \ingroup Discretization * \brief Base class for the flux variables living on a sub control volume face * * \tparam TypeTag The type tag - * \tparam Implementation The implementation that uses this class as base (CRTP) - * \tparam UpwindScheme The type of the upwind scheme used for upwinding of advective fluxes */ -template<class TypeTag, class Implementation, class UpwindScheme> -class FluxVariablesBaseImplementation +template<class TypeTag> +class FluxVariablesBase { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); @@ -99,23 +82,7 @@ public: const ElementFluxVariablesCache& elemFluxVarsCache() const { return *elemFluxVarsCachePtr_; } - //! Applies the upwind scheme to precalculated fluxes - template<class UpwindTermFunction> - Scalar applyUpwindScheme(const UpwindTermFunction& upwindTerm, Scalar flux, int phaseIdx) const - { - //! Give the upwind scheme access to the cached variables - return UpwindScheme::apply(asImp_(), upwindTerm, flux, phaseIdx); - } - private: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } - const Problem* problemPtr_; //!< Pointer to the problem const Element* elementPtr_; //!< Pointer to the element at hand const FVElementGeometry* fvGeometryPtr_; //!< Pointer to the current FVElementGeometry diff --git a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh index 88e07cb50d5e1c860789afe0c8fc2f7416550c50..835674a14ce9b3bebd58710a96fa36cf72dc8c1e 100644 --- a/dumux/freeflow/navierstokes/staggered/fluxvariables.hh +++ b/dumux/freeflow/navierstokes/staggered/fluxvariables.hh @@ -43,7 +43,7 @@ class NavierStokesFluxVariablesImpl; */ template<class TypeTag> class NavierStokesFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered> -: public FluxVariablesBase<TypeTag, NavierStokesFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered>> +: public FluxVariablesBase<TypeTag> { using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); diff --git a/dumux/porousmediumflow/fluxvariables.hh b/dumux/porousmediumflow/fluxvariables.hh index 40af4a14f16b4905dc2f1323f1d06d4b98eb9495..654b681c057b845a0cbea6f472753b33cb6f9188 100644 --- a/dumux/porousmediumflow/fluxvariables.hh +++ b/dumux/porousmediumflow/fluxvariables.hh @@ -28,6 +28,7 @@ #include <dumux/common/properties.hh> #include <dumux/discretization/fluxvariablesbase.hh> +#include <dumux/discretization/upwindscheme.hh> namespace Dumux { @@ -35,14 +36,15 @@ namespace Dumux { * \ingroup ImplicitModel * \brief The porous medium flux variables class that computes advective / convective, * molecular diffusive and heat conduction fluxes. + * + * \param TypeTag The type tag for access to type traits + * \param UpwindScheme The upwind scheme to be applied to advective fluxes * \note Not all specializations are currently implemented */ -template<class TypeTag> -class PorousMediumFluxVariables : public FluxVariablesBase<TypeTag, PorousMediumFluxVariables<TypeTag>> +template<class TypeTag, + class UpwindScheme = UpwindScheme<typename GET_PROP_TYPE(TypeTag, FVGridGeometry)> > +class PorousMediumFluxVariables : public FluxVariablesBase<TypeTag> { - using ThisType = PorousMediumFluxVariables<TypeTag>; - using ParentType = FluxVariablesBase<TypeTag, ThisType>; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits); using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); @@ -99,7 +101,8 @@ public: advFluxIsCached_.set(phaseIdx, true); } - return this->applyUpwindScheme(upwindTerm, advFluxBeforeUpwinding_[phaseIdx], phaseIdx); + //! Give the upwind scheme access to the cached variables + return UpwindScheme::apply(*this, upwindTerm, advFluxBeforeUpwinding_[phaseIdx], phaseIdx); } /*!