diff --git a/CHANGELOG.md b/CHANGELOG.md index 5657b200b319d09dbca4b017b7499bf9c241c3b3..106ada952e8f094bd2a7158c553d7b493094d08d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +Differences Between DuMu<sup>x</sup> 3.6 and DuMu<sup>x</sup> 3.5 +============================================= + +### General changes / structure + +### Improvements and Enhancements + +- __Discretization__: There is now defaults for `FluxVariablesCache` and `FluxVariablesCacheFiller` for box/cctpfa/ccmpfa/staggered +that implement an empty cache (i.e. nothing is cached for the flux variables). + +- __Properties__: There is now a `GetPropOr` helper that evaluates to the property type if that type is specialized for the given TypeTag and a given type if not. + +### Immediate interface changes not allowing/requiring a deprecation period: + +### Deprecated properties/classes/functions/files, to be removed after 3.6: + +### New experimental features (possibly subject to backwards-incompatible changes in the future) + + Differences Between DuMu<sup>x</sup> 3.5 and DuMu<sup>x</sup> 3.4 ============================================= - __Requirements__: DuMux requires Dune >=2.8 and CMake >= 3.13. It was successfully tested with OPM 2021.10 (which in turn requires Dune <= 2.8), see also [patches](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/tree/master/patches). diff --git a/dumux/common/properties/propertysystem.hh b/dumux/common/properties/propertysystem.hh index 2b334726b73e54d5149683bf1d06d075dc08186b..981fb70962ac0bc195f140fc823f5f81c3f4664c 100644 --- a/dumux/common/properties/propertysystem.hh +++ b/dumux/common/properties/propertysystem.hh @@ -36,6 +36,10 @@ struct UndefinedProperty {}; } // end namespace Dumux::Properties + +// hide from doxygen +#ifndef DOXYGEN + //! implementation details for template meta programming namespace Dumux::Properties::Detail { @@ -124,22 +128,48 @@ struct GetDefined<TypeTag, Property, std::tuple<FirstTypeTag, Args...>> typename GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, void>::type>; }; -//! helper struct to extract get the Property specilization given a TypeTag, asserts that the property is defined +//! helper struct to extract get the Property specialization given a TypeTag, asserts that the property is defined template<class TypeTag, template<class,class> class Property> struct GetPropImpl { using type = typename Detail::GetDefined<TypeTag, Property, std::tuple<TypeTag>>::type; - static_assert(!std::is_same<type, UndefinedProperty>::value, "Property is undefined!"); + static_assert(!std::is_same_v<type, UndefinedProperty>, "Property is undefined!"); +}; + +template<class TypeTag, template<class,class> class Property, class T> +struct GetPropOrImpl +{ + using PT = typename Detail::GetDefined<TypeTag, Property, std::tuple<TypeTag>>::type; + struct OT { using type = T; }; // fake property wrapper + using type = std::conditional_t<std::is_same_v<PT, UndefinedProperty>, OT, PT>; }; } // end namespace Dumux::Properties::Detail +#endif // DOXYGEN + +namespace Dumux::Properties { + +//! whether the property is defined/specialized for TypeTag +template<class TypeTag, template<class,class> class Property> +inline constexpr bool hasDefinedType() +{ + using type = typename Detail::GetDefined<TypeTag, Property, std::tuple<TypeTag>>::type; + return !std::is_same_v<type, UndefinedProperty>; +} + +} // end namespace Dumux::Properties + namespace Dumux { //! get the type of a property template<class TypeTag, template<class,class> class Property> using GetProp = typename Properties::Detail::GetPropImpl<TypeTag, Property>::type; +//! get the type of a property or the type T if the property is undefined +template<class TypeTag, template<class,class> class Property, class T> +using GetPropOr = typename Properties::Detail::GetPropOrImpl<TypeTag, Property, T>::type; + // See the comment above. #ifdef __clang__ #pragma clang diagnostic push @@ -147,11 +177,15 @@ using GetProp = typename Properties::Detail::GetPropImpl<TypeTag, Property>::typ #endif //! get the type alias defined in the property template<class TypeTag, template<class,class> class Property> -using GetPropType = typename Properties::Detail::GetPropImpl<TypeTag, Property>::type::type; +using GetPropType = typename GetProp<TypeTag, Property>::type; + +//! get the type alias defined in the property or the type T if the property is undefined +template<class TypeTag, template<class,class> class Property, class T> +using GetPropTypeOr = typename GetPropOr<TypeTag, Property, T>::type; //! get the value data member of a property template<class TypeTag, template<class,class> class Property> -constexpr auto getPropValue() { return Properties::Detail::GetPropImpl<TypeTag, Property>::type::value; } +inline constexpr auto getPropValue() { return GetProp<TypeTag, Property>::value; } #ifdef __clang__ #pragma clang diagnostic pop #endif diff --git a/dumux/discretization/box.hh b/dumux/discretization/box.hh index 59669c347fddb697440a5f6fb3896d474e42741c..ee56e70826ea3b02553b2b67d1cf730aff9825a3 100644 --- a/dumux/discretization/box.hh +++ b/dumux/discretization/box.hh @@ -45,6 +45,8 @@ #include <dumux/discretization/box/gridvolumevariables.hh> #include <dumux/discretization/box/fvgridgeometry.hh> +#include <dumux/flux/fluxvariablescaching.hh> + namespace Dumux { namespace Properties { @@ -85,7 +87,11 @@ struct GridFluxVariablesCache<TypeTag, TTag::BoxModel> private: static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>(); using Problem = GetPropType<TypeTag, Properties::Problem>; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluxVariablesCache = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar> + >; public: using type = BoxGridFluxVariablesCache<Problem, FluxVariablesCache, enableCache>; }; diff --git a/dumux/discretization/ccmpfa.hh b/dumux/discretization/ccmpfa.hh index fbd738fae081515383a353a380995cc49e22e468..8d2f04d9fcac45175dad6b32aee94a65e435c1c0 100644 --- a/dumux/discretization/ccmpfa.hh +++ b/dumux/discretization/ccmpfa.hh @@ -48,6 +48,8 @@ #include <dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh> +#include <dumux/flux/fluxvariablescaching.hh> + namespace Dumux { namespace Properties { @@ -130,8 +132,14 @@ struct GridFluxVariablesCache<TypeTag, TTag::CCMpfaModel> private: static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>(); using Problem = GetPropType<TypeTag, Properties::Problem>; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; - using FluxVariablesCacheFiller = GetPropType<TypeTag, Properties::FluxVariablesCacheFiller>; + + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluxVariablesCache = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar> + >; + using FluxVariablesCacheFiller = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCacheFiller, FluxVariablesCaching::EmptyCacheFiller + >; using PrimaryInteractionVolume = GetPropType<TypeTag, Properties::PrimaryInteractionVolume>; using SecondaryInteractionVolume = GetPropType<TypeTag, Properties::SecondaryInteractionVolume>; diff --git a/dumux/discretization/cctpfa.hh b/dumux/discretization/cctpfa.hh index 3447dc2c942b18fbddfb266bcde2e61d1a8c6706..4b5348d6e16a0950058a7e97d1544697ab1a45c1 100644 --- a/dumux/discretization/cctpfa.hh +++ b/dumux/discretization/cctpfa.hh @@ -42,6 +42,8 @@ #include <dumux/discretization/cellcentered/tpfa/gridfluxvariablescache.hh> #include <dumux/discretization/cellcentered/tpfa/subcontrolvolumeface.hh> +#include <dumux/flux/fluxvariablescaching.hh> + namespace Dumux { namespace Properties { @@ -81,8 +83,14 @@ struct GridFluxVariablesCache<TypeTag, TTag::CCTpfaModel> private: static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>(); using Problem = GetPropType<TypeTag, Properties::Problem>; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; - using FluxVariablesCacheFiller = GetPropType<TypeTag, Properties::FluxVariablesCacheFiller>; + + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluxVariablesCache = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar> + >; + using FluxVariablesCacheFiller = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCacheFiller, FluxVariablesCaching::EmptyCacheFiller + >; public: using type = CCTpfaGridFluxVariablesCache<Problem, FluxVariablesCache, FluxVariablesCacheFiller, enableCache>; }; diff --git a/dumux/discretization/fcstaggered.hh b/dumux/discretization/fcstaggered.hh index 6de37e6114c1bcef7748a788d37c8fe238d3cd5f..433e282e23804b0b2be46aa4ba5d14bfb638bb17 100644 --- a/dumux/discretization/fcstaggered.hh +++ b/dumux/discretization/fcstaggered.hh @@ -80,8 +80,13 @@ struct GridFluxVariablesCache<TypeTag, TTag::FaceCenteredStaggeredModel> private: static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>(); using Problem = GetPropType<TypeTag, Properties::Problem>; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; - using FluxVariablesCacheFiller = GetPropType<TypeTag, Properties::FluxVariablesCacheFiller>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluxVariablesCache = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar> + >; + using FluxVariablesCacheFiller = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCacheFiller, FluxVariablesCaching::EmptyCacheFiller + >; public: using type = FaceCenteredStaggeredGridFluxVariablesCache<Problem, FluxVariablesCache, FluxVariablesCacheFiller, enableCache>; }; diff --git a/dumux/discretization/staggered.hh b/dumux/discretization/staggered.hh index 3caccbd7a0a0735b32b452bf2e734dcd4265e4ac..afcd527712f5ce565be4d0703094c6ff368c0fb9 100644 --- a/dumux/discretization/staggered.hh +++ b/dumux/discretization/staggered.hh @@ -83,8 +83,13 @@ struct GridFluxVariablesCache<TypeTag, TTag::StaggeredModel> { private: using Problem = GetPropType<TypeTag, Properties::Problem>; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; - using FluxVariablesCacheFiller = GetPropType<TypeTag, Properties::FluxVariablesCacheFiller>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluxVariablesCache = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar> + >; + using FluxVariablesCacheFiller = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCacheFiller, FluxVariablesCaching::EmptyCacheFiller + >; static constexpr auto enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>(); static constexpr auto upwindSchemeOrder = getPropValue<TypeTag, Properties::UpwindSchemeOrder>(); public: diff --git a/dumux/flux/box/dispersionflux.hh b/dumux/flux/box/dispersionflux.hh index 0e496e569ecf17967dd88f33f935d2374a098621..b1a6c6d1cac254802d17d3e2133c344d20f8196b 100644 --- a/dumux/flux/box/dispersionflux.hh +++ b/dumux/flux/box/dispersionflux.hh @@ -58,8 +58,9 @@ class DispersionFluxImplementation<TypeTag, DiscretizationMethods::Box, referenc using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; using Extrusion = Extrusion_t<GridGeometry>; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; - using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; + using FluxVarCache = typename GridFluxVariablesCache::FluxVariablesCache; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using FluxTraits = typename Dumux::FluxTraits<FluxVariables>; using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>; diff --git a/dumux/flux/box/fickslaw.hh b/dumux/flux/box/fickslaw.hh index f802f6ec7f9afeaab4475c825aa504f8fa12ef02..5099a17cf7a7b276fac0a1713b49e0f0252a5768 100644 --- a/dumux/flux/box/fickslaw.hh +++ b/dumux/flux/box/fickslaw.hh @@ -60,8 +60,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::Box, referenceSyste using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; using Extrusion = Extrusion_t<GridGeometry>; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; - using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; + using FluxVarCache = typename GridFluxVariablesCache::FluxVariablesCache; using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>; using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/flux/ccmpfa/fickslaw.hh b/dumux/flux/ccmpfa/fickslaw.hh index 071a9b2e230db1a355d1791c9020477b4d792887..4681a060dcb4b3c961c569c796e9b946ddbda8cd 100644 --- a/dumux/flux/ccmpfa/fickslaw.hh +++ b/dumux/flux/ccmpfa/fickslaw.hh @@ -57,8 +57,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCMpfa, referenceSy using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; - using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; + using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache; using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>; static constexpr int numComponents = GetPropType<TypeTag, Properties::ModelTraits>::numFluidComponents(); diff --git a/dumux/flux/ccmpfa/fourierslaw.hh b/dumux/flux/ccmpfa/fourierslaw.hh index c094d4abed78a36fd396328877160887171a8319..af476d6be8f6d517f79aa298c880cbfbd5478f81 100644 --- a/dumux/flux/ccmpfa/fourierslaw.hh +++ b/dumux/flux/ccmpfa/fourierslaw.hh @@ -55,8 +55,9 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCMpfa> using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; - using ElementFluxVarsCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVarsCache = typename GridFluxVariablesCache::LocalView; + using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache; //! Class that fills the cache corresponding to mpfa Darcy's Law class MpfaFouriersLawCacheFiller diff --git a/dumux/flux/cctpfa/dispersionflux.hh b/dumux/flux/cctpfa/dispersionflux.hh index 4a77270c3e1ee50e2b05c4856987d55b56644e55..e3428afa204e2113c185abf7d25cfcc2aaeef64c 100644 --- a/dumux/flux/cctpfa/dispersionflux.hh +++ b/dumux/flux/cctpfa/dispersionflux.hh @@ -59,8 +59,9 @@ class DispersionFluxImplementation<TypeTag, DiscretizationMethods::CCTpfa, refer using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; using Extrusion = Extrusion_t<GridGeometry>; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; - using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; + using FluxVarCache = typename GridFluxVariablesCache::FluxVariablesCache; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using FluxTraits = typename Dumux::FluxTraits<FluxVariables>; using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>; diff --git a/dumux/flux/cctpfa/fickslaw.hh b/dumux/flux/cctpfa/fickslaw.hh index 7876e600e10a2c092cf7cba2eb4f0f0024d1aa86..66ad159965bb7de6377ba32bb94cdaa3039e143e 100644 --- a/dumux/flux/cctpfa/fickslaw.hh +++ b/dumux/flux/cctpfa/fickslaw.hh @@ -60,8 +60,9 @@ class FicksLawImplementation<TypeTag, DiscretizationMethods::CCTpfa, referenceSy using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = typename ElementVolumeVariables::VolumeVariables; using Element = typename GridView::template Codim<0>::Entity; - using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; + using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache; using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>; using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; diff --git a/dumux/flux/cctpfa/fourierslaw.hh b/dumux/flux/cctpfa/fourierslaw.hh index ac3b95b99cd5c2b2440d963fe3bbf0ab1b8d9889..03bc4affc19314e6247268b149aeffde630de370 100644 --- a/dumux/flux/cctpfa/fourierslaw.hh +++ b/dumux/flux/cctpfa/fourierslaw.hh @@ -55,8 +55,9 @@ class FouriersLawImplementation<TypeTag, DiscretizationMethods::CCTpfa> using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = typename ElementVolumeVariables::VolumeVariables; using Element = typename GridView::template Codim<0>::Entity; - using ElementFluxVarsCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVarsCache = typename GridFluxVariablesCache::LocalView; + using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache; static const int dim = GridView::dimension; static const int dimWorld = GridView::dimensionworld; diff --git a/dumux/flux/cctpfa/maxwellstefanslaw.hh b/dumux/flux/cctpfa/maxwellstefanslaw.hh index 89f3a1a48a61850a5f84341a24eec32c20edf1aa..b567b05722ce5e69f8409066f63ef4bc32c2978e 100644 --- a/dumux/flux/cctpfa/maxwellstefanslaw.hh +++ b/dumux/flux/cctpfa/maxwellstefanslaw.hh @@ -61,8 +61,9 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethods::CCTpfa, re using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using Element = typename GridView::template Codim<0>::Entity; - using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; + using FluxVariablesCache = typename GridFluxVariablesCache::FluxVariablesCache; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; static const int dim = GridView::dimension; diff --git a/dumux/freeflow/navierstokes/mass/1p/model.hh b/dumux/freeflow/navierstokes/mass/1p/model.hh index 91aae0039856bc099881f96cc3d51c66c5aa9391..d37c58f68005290a61d1839e63f512e90d341c43 100644 --- a/dumux/freeflow/navierstokes/mass/1p/model.hh +++ b/dumux/freeflow/navierstokes/mass/1p/model.hh @@ -201,14 +201,6 @@ public: >; }; -template<class TypeTag> -struct FluxVariablesCache<TypeTag, TTag::NavierStokesMassOneP> -{ using type = FluxVariablesCaching::EmptyCache<GetPropType<TypeTag, Properties::Scalar>>; }; - -template<class TypeTag> -struct FluxVariablesCacheFiller<TypeTag, TTag::NavierStokesMassOneP> -{ using type = FluxVariablesCaching::EmptyCacheFiller; }; - // ! The specific I/O fields template<class TypeTag> struct IOFields<TypeTag, TTag::NavierStokesMassOneP> { using type = NavierStokesIOFields; }; diff --git a/dumux/freeflow/navierstokes/momentum/model.hh b/dumux/freeflow/navierstokes/momentum/model.hh index 2dc4a8378879140f2ba1cb9546cfe751c67ce1eb..6e6e6a7878d7194e4ed34c00cc2a6aca6ecd2b0e 100644 --- a/dumux/freeflow/navierstokes/momentum/model.hh +++ b/dumux/freeflow/navierstokes/momentum/model.hh @@ -61,7 +61,6 @@ #include <dumux/material/fluidstates/immiscible.hh> #include <dumux/discretization/method.hh> #include <dumux/flux/fourierslaw.hh> -#include <dumux/flux/fluxvariablescaching.hh> namespace Dumux { @@ -204,12 +203,6 @@ public: template<class TypeTag> struct FluxVariables<TypeTag, TTag::NavierStokesMomentum> { using type = NavierStokesMomentumFluxVariables<TypeTag>; }; -template<class TypeTag> -struct FluxVariablesCache<TypeTag, TTag::NavierStokesMomentum> { using type = FluxVariablesCaching::EmptyCache<GetPropType<TypeTag, Properties::Scalar>>; }; - -template<class TypeTag> -struct FluxVariablesCacheFiller<TypeTag, TTag::NavierStokesMomentum> { using type = FluxVariablesCaching::EmptyCacheFiller; }; - template<class TypeTag> struct CouplingManager<TypeTag, TTag::NavierStokesMomentum> { diff --git a/dumux/freeflow/properties.hh b/dumux/freeflow/properties.hh index 4b7af1936d5a5c65fa85b27c112e5f04acbfd657..8036b946cd38c5f2b2caaca940d68c43b58312fe 100644 --- a/dumux/freeflow/properties.hh +++ b/dumux/freeflow/properties.hh @@ -28,7 +28,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/properties/model.hh> #include <dumux/flux/fourierslaw.hh> -#include <dumux/flux/fluxvariablescaching.hh> + #include "turbulencemodel.hh" #include "spatialparams.hh" @@ -41,16 +41,6 @@ namespace TTag { struct FreeFlow { using InheritsFrom = std::tuple<ModelProperties>; }; } // end namespace TTag -//! The flux variables cache class, by default the one for free flow -template<class TypeTag> -struct FluxVariablesCache<TypeTag, TTag::FreeFlow> { using type = FluxVariablesCaching::EmptyCache<GetPropType<TypeTag, Properties::Scalar>>; }; - -//! The flux variables cache filler (FluxVariablesCache is the data type, -//! the filler knows how to build up the caches for the stencil efficiently) -//! For the free flow model there is no need for a cache and filler -template<class TypeTag> -struct FluxVariablesCacheFiller<TypeTag, TTag::FreeFlow> { using type = FluxVariablesCaching::EmptyCacheFiller; }; - //! Use Fourier's Law as default heat conduction type template<class TypeTag> struct HeatConductionType<TypeTag, TTag::FreeFlow> { using type = FouriersLaw<TypeTag>; }; diff --git a/dumux/freeflow/shallowwater/model.hh b/dumux/freeflow/shallowwater/model.hh index 85d702fb9c29a553124b02ee6ba756ee1bece1d1..d87ccde78b754f1afe348f6df8db513ff0bc2a5a 100644 --- a/dumux/freeflow/shallowwater/model.hh +++ b/dumux/freeflow/shallowwater/model.hh @@ -76,7 +76,6 @@ #include <dumux/flux/shallowwaterflux.hh> #include <dumux/flux/shallowwaterviscousflux.hh> -#include <dumux/flux/fluxvariablescaching.hh> #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/1pliquid.hh> @@ -157,14 +156,6 @@ public: using type = ShallowWaterVolumeVariables<Traits>; }; -template<class TypeTag> -struct FluxVariablesCache<TypeTag, TTag::ShallowWater> -{ using type = FluxVariablesCaching::EmptyCache< GetPropType<TypeTag, Properties::Scalar> >; }; - -template<class TypeTag> -struct FluxVariablesCacheFiller<TypeTag, TTag::ShallowWater> -{ using type = FluxVariablesCaching::EmptyCacheFiller; }; - template<class TypeTag> struct IOFields<TypeTag, TTag::ShallowWater> { using type = ShallowWaterIOFields; }; diff --git a/dumux/porenetwork/2p/model.hh b/dumux/porenetwork/2p/model.hh index 61c3df98f6ec3e92afcf7dedaa4e54bbdc9c2346..2782d1d44ee1d8149dd7d6a168e33072f0037e33 100644 --- a/dumux/porenetwork/2p/model.hh +++ b/dumux/porenetwork/2p/model.hh @@ -57,6 +57,7 @@ #include <dumux/common/properties.hh> #include <dumux/flux/porenetwork/advection.hh> +#include <dumux/flux/fluxvariablescaching.hh> #include <dumux/porenetwork/properties.hh> @@ -130,7 +131,10 @@ struct GridFluxVariablesCache<TypeTag, TTag::PNMTwoP> private: static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridFluxVariablesCache>(); using Problem = GetPropType<TypeTag, Properties::Problem>; - using FluxVariablesCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using FluxVariablesCache = GetPropTypeOr<TypeTag, + Properties::FluxVariablesCache, FluxVariablesCaching::EmptyCache<Scalar> + >; using Traits = PoreNetwork::PNMTwoPDefaultGridFVCTraits<Problem, FluxVariablesCache>; public: using type = PoreNetwork::PNMTwoPGridFluxVariablesCache<Problem, FluxVariablesCache, enableCache, Traits>; diff --git a/dumux/porousmediumflow/2p1c/darcyslaw.hh b/dumux/porousmediumflow/2p1c/darcyslaw.hh index f687bfd1c40ff3d726014237775876d43d49d72d..61e5aeee6cb80f01b7af206af9cfb4d536748213 100644 --- a/dumux/porousmediumflow/2p1c/darcyslaw.hh +++ b/dumux/porousmediumflow/2p1c/darcyslaw.hh @@ -52,8 +52,8 @@ class TwoPOneCDarcysLaw : public DarcysLaw<TypeTag> using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using ElemFluxVarCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FluxVarCache = GetPropType<TypeTag, Properties::FluxVariablesCache>; + using GridFluxVariablesCache = GetPropType<TypeTag, Properties::GridFluxVariablesCache>; + using ElemFluxVarCache = typename GridFluxVariablesCache::LocalView; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; diff --git a/test/common/propertysystem/test_propertysystem.cc b/test/common/propertysystem/test_propertysystem.cc index e173328427e9e43e6d8f6bc7689748bcadd66e1f..fbc8d185258294487fc379a4ed8d476fd5c3f708 100644 --- a/test/common/propertysystem/test_propertysystem.cc +++ b/test/common/propertysystem/test_propertysystem.cc @@ -31,8 +31,7 @@ #include <dumux/common/properties/propertysystem.hh> -namespace Dumux { -namespace Properties { +namespace Dumux::Properties { // create some properties: // the first type tag is the actual TypeTag for which the property will be obtained @@ -77,8 +76,7 @@ struct CoordinateType<TypeTag, TTag::Grid> { using type = GetPropType<TypeTag, S template<class TypeTag> struct UseTpfaFlux<TypeTag, TTag::CCTpfaDisc> { static constexpr bool value = true; }; -} // end namespace Properties -} // end namespace Dumux +} // end namespace Dumux::Properties int main(int argc, char* argv[]) { @@ -87,27 +85,40 @@ int main(int argc, char* argv[]) { using Scalar = GetPropType<TTag::Base, Scalar>; - if (!std::is_same<Scalar, float>::value) + if (!std::is_same_v<Scalar, float>) DUNE_THROW(Dune::InvalidStateException, "Property Scalar in TTag::Base should be float but is " << Dune::className<Scalar>()); } { using Scalar = GetPropType<TTag::OnePTest, Scalar>; - if (!std::is_same<Scalar, int>::value) + if (!std::is_same_v<Scalar, int>) DUNE_THROW(Dune::InvalidStateException, "Property Scalar in TTag::OnePTest should be int but is " << Dune::className<Scalar>()); } { using Scalar = GetPropType<TTag::OnePModel, Scalar>; - if (!std::is_same<Scalar, double>::value) - DUNE_THROW(Dune::InvalidStateException, "Property Scalar in TTag::OnePModel should be double but is " << Dune::className<Scalar>()); + if (!std::is_same_v<Scalar, double>) + DUNE_THROW(Dune::InvalidStateException, "Property Scalar in TTag::OnePModel should be double but is " << Dune::className<Scalar>()); + } + { + static_assert( + !hasDefinedType<TTag::Base, CoordinateType>(), + "Property type should be undefined for TTag::Base" + ); + } + { + using CoordinateType = GetPropTypeOr<TTag::Base, CoordinateType, double>; + static_assert( + std::is_same_v<CoordinateType, double>, + "Property is expected to default to double" + ); } { using CoordinateType = GetPropType<TTag::OnePTest, CoordinateType>; - if (!std::is_same<CoordinateType, int>::value) + if (!std::is_same_v<CoordinateType, int>) DUNE_THROW(Dune::InvalidStateException, "Property CoordinateType in TTag::OnePTest should be int but is " << Dune::className<CoordinateType>()); } { using CoordinateType = GetPropType<TTag::CCTpfaDisc, CoordinateType>; - if (!std::is_same<CoordinateType, float>::value) + if (!std::is_same_v<CoordinateType, float>) DUNE_THROW(Dune::InvalidStateException, "Property CoordinateType in TTag::CCTpfaDisc should be float but is " << Dune::className<CoordinateType>()); } {