diff --git a/exercises/exercise-biomineralization/biominproblem.hh b/exercises/exercise-biomineralization/biominproblem.hh index 41061e68ff542f0d033ddb9a770b6c5e91268a73..489d26576f5f77b491a31a52a176463debffecfc 100644 --- a/exercises/exercise-biomineralization/biominproblem.hh +++ b/exercises/exercise-biomineralization/biominproblem.hh @@ -53,7 +53,7 @@ namespace Properties //! Create new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFourBioMin { using InheritsFrom = std::tuple<BioMinSpatialparams, TwoPNCMin>; }; +struct ExerciseFourBioMin { using InheritsFrom = std::tuple<TwoPNCMin>; }; struct ExerciseFourBioMinCCTpfa { using InheritsFrom = std::tuple<ExerciseFourBioMin, CCTpfaModel>; }; } // end namespace TTag @@ -92,6 +92,14 @@ struct SolidSystem<TypeTag, TTag::ExerciseFourBioMin> using type = SolidSystems::BiominSolidPhase<Scalar>; }; +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::ExerciseFourBioMin> { + using MT = GetPropType<TypeTag, ModelTraits>; + static constexpr int numFluidComps = MT::numFluidComponents(); + static constexpr int numActiveSolidComps = MT::numSolidComps() - MT::numInertSolidComps(); + using type = BioMinSpatialparams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>, numFluidComps, numActiveSolidComps>; +}; template<class TypeTag> struct EnableFVGridGeometryCache<TypeTag, TTag::ExerciseFourBioMin> { static constexpr bool value = false; }; diff --git a/exercises/exercise-biomineralization/biominspatialparams.hh b/exercises/exercise-biomineralization/biominspatialparams.hh index 12be491883ddd47bb5e96e5495b4f101b7e37520..393bd57d708f468f5bd3e62d0978184bdbb112d8 100644 --- a/exercises/exercise-biomineralization/biominspatialparams.hh +++ b/exercises/exercise-biomineralization/biominspatialparams.hh @@ -33,39 +33,20 @@ #include <dumux/discretization/method.hh> -namespace Dumux -{ -//forward declaration -template<class TypeTag> -class BioMinSpatialparams; - -namespace Properties -{ -// The spatial parameters TypeTag -NEW_TYPE_TAG(BioMinSpatialparams); - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::BioMinSpatialparams> { using type = BioMinSpatialparams<TypeTag>; }; -} // end namespace Properties +namespace Dumux { /*! * \brief Definition of the spatial parameters for the biomineralisation problem * with geostatistically distributed initial permeability. */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar, int numFluidComps, int numActiveSolidComps> class BioMinSpatialparams -: public FVSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, - GetPropType<TypeTag, Properties::Scalar>, - BioMinSpatialparams<TypeTag>> +: public FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>> { - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<TypeTag>>; + using ParentType = FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>>; using EffectiveLaw = RegularizedBrooksCorey<Scalar>; - using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using GridView = typename FVGridGeometry::GridView; using CoordScalar = typename GridView::ctype; @@ -75,8 +56,9 @@ class BioMinSpatialparams using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; using Tensor = Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld>; + using PoroLaw = PorosityPrecipitation<Scalar, numFluidComps, numActiveSolidComps>; + public: - using SolidSystem = GetPropType<TypeTag, Properties::SolidSystem>; using PermeabilityType = Tensor; using MaterialLaw = EffToAbsLaw<EffectiveLaw>; using MaterialLawParams = typename MaterialLaw::Params; @@ -156,6 +138,7 @@ public: * \param fvGridGeometry The fvGridGeometry * \param sol The (initial) solution vector */ + template<class SolutionVector> void computeReferencePorosity(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { @@ -174,6 +157,7 @@ public: const auto& dofPosition = scv.dofPosition(); const bool isInAquitardNotFaultZone = isInAquitard_(dofPosition) && !isFaultZone_(dofPosition); auto phi = isInAquitardNotFaultZone ? aquitardPorosity_ : initialPorosity_; + auto phiEvaluated = poroLaw_.evaluatePorosity(element, scv, elemSol, phi); referencePorosity_[eIdx][scv.indexInElement()] = calculatephiRef(phi, phiEvaluated); } @@ -226,6 +210,7 @@ public: * \param fvGridGeometry The fvGridGeometry * \param sol The (initial) solution vector */ + template<class SolutionVector> void computeReferencePermeability(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { @@ -332,10 +317,8 @@ private: bool isFaultZone_(const GlobalPosition &globalPos) const { return globalPos[dimWorld-2] > 2 - eps_ && globalPos[dimWorld-2] < 3 + eps_;} - using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; - PorosityPrecipitation<Scalar, ModelTraits::numFluidComponents(), ModelTraits::numSolidComps()> poroLaw_; PermeabilityKozenyCarman<PermeabilityType> permLaw_; - + PoroLaw poroLaw_; Scalar initialPorosity_; std::vector< std::vector<Scalar> > referencePorosity_; diff --git a/exercises/exercise-coupling-ff-pm/1pspatialparams.hh b/exercises/exercise-coupling-ff-pm/1pspatialparams.hh index e95c24917d05382c77b53c769357a61ee41a9994..a042388f1eac51bb38ef980cb0f183756aaf6362 100644 --- a/exercises/exercise-coupling-ff-pm/1pspatialparams.hh +++ b/exercises/exercise-coupling-ff-pm/1pspatialparams.hh @@ -26,27 +26,20 @@ #include <dumux/material/spatialparams/fv1p.hh> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup OnePModel - * \ingroup ImplicitTestProblems * * \brief The spatial parameters class for the test problem using the * 1p cc model */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class OnePSpatialParams -: public FVSpatialParamsOneP<GetPropType<TypeTag, Properties::FVGridGeometry>, - GetPropType<TypeTag, Properties::Scalar>, - OnePSpatialParams<TypeTag>> +: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>> { - using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = GetPropType<TypeTag, Properties::GridView>; - using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<TypeTag>>; + using GridView = typename FVGridGeometry::GridView; + using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>>; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -56,7 +49,7 @@ public: using PermeabilityType = Scalar; OnePSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + : ParentType(fvGridGeometry) { permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); diff --git a/exercises/exercise-coupling-ff-pm/2pspatialparams.hh b/exercises/exercise-coupling-ff-pm/2pspatialparams.hh index 948b7a7b7ce4e00bbba83f88b399b8889eee7177..622e4f59ca7837281111f6a79435d0fb74c1cddb 100644 --- a/exercises/exercise-coupling-ff-pm/2pspatialparams.hh +++ b/exercises/exercise-coupling-ff-pm/2pspatialparams.hh @@ -29,29 +29,22 @@ #include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup TwoPModel - * \ingroup ImplicitTestProblems * * \brief The spatial parameters class for the test problem using the 2p cc model */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class TwoPSpatialParams -: public FVSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, - GetPropType<TypeTag, Properties::Scalar>, - TwoPSpatialParams<TypeTag>> +: public FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>> { - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = GetPropType<TypeTag, Properties::GridView>; + using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<TypeTag>>; + using ParentType = FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>>; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using EffectiveLaw = RegularizedVanGenuchten<Scalar>; @@ -62,7 +55,7 @@ public: using PermeabilityType = Scalar; TwoPSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + : ParentType(fvGridGeometry) { permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); @@ -134,6 +127,6 @@ private: static constexpr Scalar eps_ = 1.0e-7; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/exercises/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh b/exercises/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh index 2fbb48231d6aa8be8f7dfe8497767727e3806c0e..456a837f7b88f455838e2c9ee1eeb22b9a35574f 100644 --- a/exercises/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh @@ -17,10 +17,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! -* \file -* -* \brief The porous medium flow sub problem -*/ + * \file + * + * \brief The porous medium flow sub problem + */ #ifndef DUMUX_DARCY_SUBPROBLEM_HH #define DUMUX_DARCY_SUBPROBLEM_HH @@ -80,8 +80,11 @@ struct Grid<TypeTag, TTag::DarcyOneP> }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOneP> { using type = OnePSpatialParams<TypeTag>; }; -} +struct SpatialParams<TypeTag, TTag::DarcyOneP> { + using type = OnePSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +} // end namespace Properties /*! * \brief The porous medium flow sub problem diff --git a/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh b/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh index 73f87d211a966eeee9dcceaed9c6ce76c8a510dc..31fdc8a3383e7c52a5271291133b10d179751568 100644 --- a/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh @@ -79,8 +79,11 @@ struct Grid<TypeTag, TTag::DarcyOnePNC> { using type = Dune::YaspGrid<2>; }; // Set the spatial paramaters type template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { using type = OnePSpatialParams<TypeTag>; }; -} +struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { + using type = OnePSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +} // end namespace Properties template <class TypeTag> class DarcySubProblem : public PorousMediumFlowProblem<TypeTag> @@ -396,6 +399,6 @@ private: Dumux::GnuplotInterface<Scalar> gnuplotInterfaceFluxes_; Dumux::GnuplotInterface<Scalar> gnuplotStorage_; }; -} //end namespace +} //end namespace Dumux #endif //DUMUX_DARCY_SUBPROBLEM_HH diff --git a/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh index 79b958a00ccd9880dddb0419fff85d2305e38951..e6abb8e430d72f705f03bc7b19fa3a15032a2507 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh @@ -32,13 +32,13 @@ #include <dumux/freeflow/compositional/navierstokesncmodel.hh> #include <dumux/freeflow/navierstokes/problem.hh> -namespace Dumux -{ +namespace Dumux { + template <class TypeTag> class FreeFlowSubProblem; -namespace Properties -{ +namespace Properties { + // Create new type tags namespace TTag { struct StokesZeroEq { using InheritsFrom = std::tuple<NavierStokesNCNI, StaggeredFreeFlowModel>; }; diff --git a/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh index 361ac60e5b7b1e5c3b2503d91bf9f5b05678ffd2..0ded6f6e318a04d42753cbb792e59d6a057974b1 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh @@ -16,11 +16,11 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ - /*! - * \file - * - * \brief The porous medium sub problem - */ +/*! + * \file + * + * \brief The porous medium sub problem + */ #ifndef DUMUX_DARCY2P2C_SUBPROBLEM_HH #define DUMUX_DARCY2P2C_SUBPROBLEM_HH @@ -72,8 +72,11 @@ template<class TypeTag> struct UseMoles<TypeTag, TTag::DarcyTwoPTwoCNI> { static constexpr bool value = true; }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = TwoPSpatialParams<TypeTag>; }; -} +struct SpatialParams<TypeTag, TTag::DarcyTwoPTwoCNI> { + using type = TwoPSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +} // end namespace Properties /*! * \brief The porous medium sub problem diff --git a/exercises/exercise-mainfile/1pproblem.hh b/exercises/exercise-mainfile/1pproblem.hh index 14273f4eabf0cc4d89f4309eb80286beef047e95..31f4f9336de5d4295cff5893351381e7e53f3588 100644 --- a/exercises/exercise-mainfile/1pproblem.hh +++ b/exercises/exercise-mainfile/1pproblem.hh @@ -70,7 +70,9 @@ struct Problem<TypeTag, TTag::OnePBase> { using type = OnePTestProblem<TypeTag>; // set the spatial params template<class TypeTag> -struct SpatialParams<TypeTag, TTag::OnePBase> { using type = OnePTestSpatialParams<TypeTag>; }; +struct SpatialParams<TypeTag, TTag::OnePBase> { + using type = OnePTestSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; // the fluid system for incompressible tests template<class TypeTag> diff --git a/exercises/exercise-mainfile/1pspatialparams.hh b/exercises/exercise-mainfile/1pspatialparams.hh index 49a5969e08daeb6ce5a6da75d7cccf32d47b4f26..a7df1fd516c48b61e2c8c3a6c57325e0be49a3b6 100644 --- a/exercises/exercise-mainfile/1pspatialparams.hh +++ b/exercises/exercise-mainfile/1pspatialparams.hh @@ -24,7 +24,6 @@ #ifndef DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH #define DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH -#include <dumux/porousmediumflow/properties.hh> #include <dumux/material/spatialparams/fv1p.hh> namespace Dumux { @@ -34,19 +33,15 @@ namespace Dumux { * \brief The spatial parameters class for the test problem using the * compressible 1p model */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class OnePTestSpatialParams -: public FVSpatialParamsOneP<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), - typename GET_PROP_TYPE(TypeTag, Scalar), - OnePTestSpatialParams<TypeTag>> +: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<TypeTag>>; + using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; diff --git a/exercises/solution/exercise-biomineralization/biominproblem.hh b/exercises/solution/exercise-biomineralization/biominproblem.hh index 311b06bdc7702ede95696c69c0b19ba830f69bbf..672b544f177e1411734e508208bd7ef56cf617b7 100644 --- a/exercises/solution/exercise-biomineralization/biominproblem.hh +++ b/exercises/solution/exercise-biomineralization/biominproblem.hh @@ -54,7 +54,7 @@ namespace Properties //! Create new type tag for the problem // Create new type tags namespace TTag { -struct ExerciseFourBioMin { using InheritsFrom = std::tuple<BioMinSpatialparams, TwoPNCMin>; }; +struct ExerciseFourBioMin { using InheritsFrom = std::tuple<TwoPNCMin>; }; struct ExerciseFourBioMinCCTpfa { using InheritsFrom = std::tuple<ExerciseFourBioMin, CCTpfaModel>; }; } // end namespace TTag @@ -93,6 +93,14 @@ struct SolidSystem<TypeTag, TTag::ExerciseFourBioMin> using type = SolidSystems::BiominSolidPhase<Scalar>; }; +// Set the spatial parameters +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::ExerciseFourBioMin> { + using MT = GetPropType<TypeTag, ModelTraits>; + static constexpr int numFluidComps = MT::numFluidComponents(); + static constexpr int numActiveSolidComps = MT::numSolidComps() - MT::numInertSolidComps(); + using type = BioMinSpatialparams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>, numFluidComps, numActiveSolidComps>; +}; template<class TypeTag> struct EnableFVGridGeometryCache<TypeTag, TTag::ExerciseFourBioMin> { static constexpr bool value = false; }; diff --git a/exercises/solution/exercise-biomineralization/biominspatialparams.hh b/exercises/solution/exercise-biomineralization/biominspatialparams.hh index 12be491883ddd47bb5e96e5495b4f101b7e37520..393bd57d708f468f5bd3e62d0978184bdbb112d8 100644 --- a/exercises/solution/exercise-biomineralization/biominspatialparams.hh +++ b/exercises/solution/exercise-biomineralization/biominspatialparams.hh @@ -33,39 +33,20 @@ #include <dumux/discretization/method.hh> -namespace Dumux -{ -//forward declaration -template<class TypeTag> -class BioMinSpatialparams; - -namespace Properties -{ -// The spatial parameters TypeTag -NEW_TYPE_TAG(BioMinSpatialparams); - -// Set the spatial parameters -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::BioMinSpatialparams> { using type = BioMinSpatialparams<TypeTag>; }; -} // end namespace Properties +namespace Dumux { /*! * \brief Definition of the spatial parameters for the biomineralisation problem * with geostatistically distributed initial permeability. */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar, int numFluidComps, int numActiveSolidComps> class BioMinSpatialparams -: public FVSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, - GetPropType<TypeTag, Properties::Scalar>, - BioMinSpatialparams<TypeTag>> +: public FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>> { - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<TypeTag>>; + using ParentType = FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>>; using EffectiveLaw = RegularizedBrooksCorey<Scalar>; - using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; using GridView = typename FVGridGeometry::GridView; using CoordScalar = typename GridView::ctype; @@ -75,8 +56,9 @@ class BioMinSpatialparams using GlobalPosition = Dune::FieldVector<CoordScalar, dimWorld>; using Tensor = Dune::FieldMatrix<CoordScalar, dimWorld, dimWorld>; + using PoroLaw = PorosityPrecipitation<Scalar, numFluidComps, numActiveSolidComps>; + public: - using SolidSystem = GetPropType<TypeTag, Properties::SolidSystem>; using PermeabilityType = Tensor; using MaterialLaw = EffToAbsLaw<EffectiveLaw>; using MaterialLawParams = typename MaterialLaw::Params; @@ -156,6 +138,7 @@ public: * \param fvGridGeometry The fvGridGeometry * \param sol The (initial) solution vector */ + template<class SolutionVector> void computeReferencePorosity(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { @@ -174,6 +157,7 @@ public: const auto& dofPosition = scv.dofPosition(); const bool isInAquitardNotFaultZone = isInAquitard_(dofPosition) && !isFaultZone_(dofPosition); auto phi = isInAquitardNotFaultZone ? aquitardPorosity_ : initialPorosity_; + auto phiEvaluated = poroLaw_.evaluatePorosity(element, scv, elemSol, phi); referencePorosity_[eIdx][scv.indexInElement()] = calculatephiRef(phi, phiEvaluated); } @@ -226,6 +210,7 @@ public: * \param fvGridGeometry The fvGridGeometry * \param sol The (initial) solution vector */ + template<class SolutionVector> void computeReferencePermeability(const FVGridGeometry& fvGridGeometry, const SolutionVector& sol) { @@ -332,10 +317,8 @@ private: bool isFaultZone_(const GlobalPosition &globalPos) const { return globalPos[dimWorld-2] > 2 - eps_ && globalPos[dimWorld-2] < 3 + eps_;} - using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; - PorosityPrecipitation<Scalar, ModelTraits::numFluidComponents(), ModelTraits::numSolidComps()> poroLaw_; PermeabilityKozenyCarman<PermeabilityType> permLaw_; - + PoroLaw poroLaw_; Scalar initialPorosity_; std::vector< std::vector<Scalar> > referencePorosity_; diff --git a/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh b/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh index e95c24917d05382c77b53c769357a61ee41a9994..a042388f1eac51bb38ef980cb0f183756aaf6362 100644 --- a/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh +++ b/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh @@ -26,27 +26,20 @@ #include <dumux/material/spatialparams/fv1p.hh> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup OnePModel - * \ingroup ImplicitTestProblems * * \brief The spatial parameters class for the test problem using the * 1p cc model */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class OnePSpatialParams -: public FVSpatialParamsOneP<GetPropType<TypeTag, Properties::FVGridGeometry>, - GetPropType<TypeTag, Properties::Scalar>, - OnePSpatialParams<TypeTag>> +: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>> { - using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = GetPropType<TypeTag, Properties::GridView>; - using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<TypeTag>>; + using GridView = typename FVGridGeometry::GridView; + using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>>; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -56,7 +49,7 @@ public: using PermeabilityType = Scalar; OnePSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + : ParentType(fvGridGeometry) { permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); diff --git a/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh b/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh index 948b7a7b7ce4e00bbba83f88b399b8889eee7177..622e4f59ca7837281111f6a79435d0fb74c1cddb 100644 --- a/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh +++ b/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh @@ -29,29 +29,22 @@ #include <dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/thermalconductivitysomerton.hh> -namespace Dumux -{ +namespace Dumux { /*! * \ingroup TwoPModel - * \ingroup ImplicitTestProblems * * \brief The spatial parameters class for the test problem using the 2p cc model */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class TwoPSpatialParams -: public FVSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>, - GetPropType<TypeTag, Properties::Scalar>, - TwoPSpatialParams<TypeTag>> +: public FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>> { - using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = GetPropType<TypeTag, Properties::GridView>; + using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<TypeTag>>; + using ParentType = FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>>; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using EffectiveLaw = RegularizedVanGenuchten<Scalar>; @@ -62,7 +55,7 @@ public: using PermeabilityType = Scalar; TwoPSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + : ParentType(fvGridGeometry) { permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); @@ -134,6 +127,6 @@ private: static constexpr Scalar eps_ = 1.0e-7; }; -} // end namespace +} // end namespace Dumux #endif diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh index 910df4d5128505f1bfeec263afb639c3ee5c0e7f..51e1663c8d66f1379545bb566e8c38336c4632e5 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/ex_interface_pmproblem.hh @@ -47,23 +47,29 @@ class DarcySubProblem; namespace Properties { -NEW_TYPE_TAG(DarcyOneP, INHERITS_FROM(CCTpfaModel, OneP)); +// Create new type tags +namespace TTag { +struct DarcyOneP { using InheritsFrom = std::tuple<OneP, CCTpfaModel>; }; +} // end namespace TTag // Set the problem property -SET_TYPE_PROP(DarcyOneP, Problem, Dumux::DarcySubProblem<TypeTag>); +template<class TypeTag> +struct Problem<TypeTag, TTag::DarcyOneP> { using type = Dumux::DarcySubProblem<TypeTag>; }; // the fluid system -SET_PROP(DarcyOneP, FluidSystem) +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::DarcyOneP> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using Scalar = GetPropType<TypeTag, Properties::Scalar>; using type = FluidSystems::OnePLiquid<Scalar, Dumux::Components::SimpleH2O<Scalar> > ; }; // Set the grid type -SET_PROP(DarcyOneP, Grid) +template<class TypeTag> +struct Grid<TypeTag, TTag::DarcyOneP> { static constexpr auto dim = 2; - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); + using Scalar = GetPropType<TypeTag, Properties::Scalar>; using TensorGrid = Dune::YaspGrid<2, Dune::TensorProductCoordinates<Scalar, dim> >; #if EXNUMBER < 3 // use "normal" grid @@ -74,8 +80,12 @@ SET_PROP(DarcyOneP, Grid) #endif }; -SET_TYPE_PROP(DarcyOneP, SpatialParams, OnePSpatialParams<TypeTag>); -} +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::DarcyOneP> { + using type = OnePSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +} // end namespace Properties /*! * \brief The porous medium flow sub problem @@ -84,23 +94,23 @@ template <class TypeTag> class DarcySubProblem : public PorousMediumFlowProblem<TypeTag> { using ParentType = PorousMediumFlowProblem<TypeTag>; - using GridView = typename GET_PROP_TYPE(TypeTag, GridView); - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables); - using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector); - using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes); - using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables); - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using GridView = GetPropType<TypeTag, Properties::GridView>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; + using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; + using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>; + using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>; + using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; + using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); + using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>; - using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices; + using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; - using CouplingManager = typename GET_PROP_TYPE(TypeTag, CouplingManager); + using CouplingManager = GetPropType<TypeTag, Properties::CouplingManager>; public: DarcySubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, diff --git a/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh index 8f5bc3dc5784be6b5e9e0ac37fa01731bd08294a..aec17c64c9cd62ea0800480ae8a3e4dee6015c00 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/ex_models_pmproblem.hh @@ -26,9 +26,9 @@ #include <dune/grid/yaspgrid.hh> -#include <dumux/material/fluidsystems/1padapter.hh> #include <dumux/discretization/cctpfa.hh> #include <dumux/io/gnuplotinterface.hh> +#include <dumux/material/fluidsystems/1padapter.hh> #include <dumux/material/fluidsystems/h2oair.hh> #include <dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh> @@ -100,12 +100,17 @@ struct Formulation<TypeTag, TTag::DarcyOnePNC> // Set the spatial paramaters type #if EXNUMBER >= 1 template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { using type = TwoPSpatialParams<TypeTag>; }; +struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { + using type = TwoPSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; #else template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { using type = OnePSpatialParams<TypeTag>; }; +struct SpatialParams<TypeTag, TTag::DarcyOnePNC> { + using type = OnePSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; #endif -} + +} // end namespace Properties template <class TypeTag> class DarcySubProblem : public PorousMediumFlowProblem<TypeTag> @@ -309,6 +314,11 @@ public: gnuplotInterfaceFluxes_.plot("flux_" + std::to_string(timeLoop_->timeStepIndex())); } + /*! + * \name Problem parameters + */ + // \{ + /*! * \brief Return the temperature within the domain in [K]. * @@ -380,10 +390,10 @@ public: * \param scv The subcontrolvolume */ template<class ElementVolumeVariables> - NumEqVector source(const Element &element, + NumEqVector source(const Element& element, const FVElementGeometry& fvGeometry, const ElementVolumeVariables& elemVolVars, - const SubControlVolume &scv) const + const SubControlVolume& scv) const { return NumEqVector(0.0); } // \} @@ -396,7 +406,7 @@ public: * For this method, the \a priVars parameter stores primary * variables. */ - PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + PrimaryVariables initialAtPos(const GlobalPosition& globalPos) const { static const Scalar stokesPressure = getParamFromGroup<Scalar>("Stokes", "Problem.Pressure"); @@ -460,6 +470,6 @@ private: Dumux::GnuplotInterface<Scalar> gnuplotInterfaceFluxes_; Dumux::GnuplotInterface<Scalar> gnuplotStorage_; }; -} //end namespace +} //end namespace Dumux #endif //DUMUX_DARCY_SUBPROBLEM_HH diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh index 2b5f0864b719739cefd5133991cb879ab75f6e9a..07213ac644ab775ac24e2f4cb76aef7d99358069 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_ffproblem.hh @@ -16,10 +16,10 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ - /*! - * \file - * \brief The free-flow sub problem - */ +/*! + * \file + * \brief The free-flow sub problem + */ #ifndef DUMUX_FREEFLOW1P2C_SUBPROBLEM_HH #define DUMUX_FREEFLOW1P2C_SUBPROBLEM_HH @@ -37,13 +37,13 @@ #include <dumux/freeflow/navierstokes/problem.hh> #endif -namespace Dumux -{ +namespace Dumux { + template <class TypeTag> class FreeFlowSubProblem; -namespace Properties -{ +namespace Properties { + // Create new type tags namespace TTag { #if EXNUMBER >= 1 diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh index 8f93288ba372c4241562967c44e5b3674ba367ea..0ded6f6e318a04d42753cbb792e59d6a057974b1 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/ex_turbulence_pmproblem.hh @@ -72,8 +72,11 @@ template<class TypeTag> struct UseMoles<TypeTag, TTag::DarcyTwoPTwoCNI> { static constexpr bool value = true; }; template<class TypeTag> -struct SpatialParams<TypeTag, TTag::DarcyTwoPTwoCNI> { using type = TwoPSpatialParams<TypeTag>; }; -} +struct SpatialParams<TypeTag, TTag::DarcyTwoPTwoCNI> { + using type = TwoPSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; + +} // end namespace Properties /*! * \brief The porous medium sub problem diff --git a/exercises/solution/exercise-mainfile/1pproblem.hh b/exercises/solution/exercise-mainfile/1pproblem.hh index 7f1d69c5b38ad9433de05a912b703e3b19ebf07c..7971075bd3d822dddfd5126c4a4cd1f79ebb5277 100644 --- a/exercises/solution/exercise-mainfile/1pproblem.hh +++ b/exercises/solution/exercise-mainfile/1pproblem.hh @@ -70,7 +70,9 @@ struct Problem<TypeTag, TTag::OnePBase> { using type = OnePTestProblem<TypeTag>; // set the spatial params template<class TypeTag> -struct SpatialParams<TypeTag, TTag::OnePBase> { using type = OnePTestSpatialParams<TypeTag>; }; +struct SpatialParams<TypeTag, TTag::OnePBase> { + using type = OnePTestSpatialParams<GetPropType<TypeTag, FVGridGeometry>, GetPropType<TypeTag, Scalar>>; +}; // the fluid system for incompressible tests template<class TypeTag> diff --git a/exercises/solution/exercise-mainfile/1pspatialparams.hh b/exercises/solution/exercise-mainfile/1pspatialparams.hh index 49a5969e08daeb6ce5a6da75d7cccf32d47b4f26..a7df1fd516c48b61e2c8c3a6c57325e0be49a3b6 100644 --- a/exercises/solution/exercise-mainfile/1pspatialparams.hh +++ b/exercises/solution/exercise-mainfile/1pspatialparams.hh @@ -24,7 +24,6 @@ #ifndef DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH #define DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH -#include <dumux/porousmediumflow/properties.hh> #include <dumux/material/spatialparams/fv1p.hh> namespace Dumux { @@ -34,19 +33,15 @@ namespace Dumux { * \brief The spatial parameters class for the test problem using the * compressible 1p model */ -template<class TypeTag> +template<class FVGridGeometry, class Scalar> class OnePTestSpatialParams -: public FVSpatialParamsOneP<typename GET_PROP_TYPE(TypeTag, FVGridGeometry), - typename GET_PROP_TYPE(TypeTag, Scalar), - OnePTestSpatialParams<TypeTag>> +: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>> { - using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); using GridView = typename FVGridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<TypeTag>>; + using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate;