diff --git a/exercises/exercise-coupling-ff-pm/1pspatialparams.hh b/exercises/exercise-coupling-ff-pm/1pspatialparams.hh index a042388f1eac51bb38ef980cb0f183756aaf6362..ce8734e350530087772143dcba98f6f4416ea321 100644 --- a/exercises/exercise-coupling-ff-pm/1pspatialparams.hh +++ b/exercises/exercise-coupling-ff-pm/1pspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_1P_TEST_SPATIALPARAMS_HH #define DUMUX_1P_TEST_SPATIALPARAMS_HH -#include <dumux/material/spatialparams/fv1p.hh> +#include <dumux/porousmediumflow/fvspatialparams1p.hh> namespace Dumux { @@ -34,12 +34,12 @@ namespace Dumux { * \brief The spatial parameters class for the test problem using the * 1p cc model */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class OnePSpatialParams -: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePSpatialParams<GridGeometry, Scalar>> { - using GridView = typename FVGridGeometry::GridView; - using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>>; + using GridView = typename GridGeometry::GridView; + using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePSpatialParams<GridGeometry, Scalar>>; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -48,12 +48,13 @@ public: // export permeability type using PermeabilityType = Scalar; - OnePSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + OnePSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { - permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); - porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); - alphaBJ_ = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph"); + permeability_ = getParam<Scalar>("SpatialParams.Permeability"); + porosity_ = getParam<Scalar>("SpatialParams.Porosity"); + alphaBJ_ = getParam<Scalar>("SpatialParams.AlphaBeaversJoseph"); + temperature_ = getParam<Scalar>("SpatialParams.Temperature"); } /*! @@ -79,11 +80,19 @@ public: Scalar beaversJosephCoeffAtPos(const GlobalPosition& globalPos) const { return alphaBJ_; } + /*! \brief Defines the temperature in [K]. + * + * \param globalPos The global position + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { return temperature_; } + private: Scalar permeability_; Scalar porosity_; Scalar alphaBJ_; + Scalar temperature_; }; } // end namespace diff --git a/exercises/exercise-coupling-ff-pm/2pspatialparams.hh b/exercises/exercise-coupling-ff-pm/2pspatialparams.hh index 9727e1f59104e50d27612c241fe3a4f9d15ff1b6..401e8828537295f729063289a91ed56fd67067ee 100644 --- a/exercises/exercise-coupling-ff-pm/2pspatialparams.hh +++ b/exercises/exercise-coupling-ff-pm/2pspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_TWOPHASE_SPATIAL_PARAMS_HH #define DUMUX_TWOPHASE_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> @@ -35,15 +35,15 @@ namespace Dumux { * * \brief The spatial parameters class for the test problem using the 2p cc model */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class TwoPSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, TwoPSpatialParams<GridGeometry, Scalar>> { - using GridView = typename FVGridGeometry::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename FVGridGeometry::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, TwoPSpatialParams<GridGeometry, Scalar>>; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -52,13 +52,14 @@ class TwoPSpatialParams public: using PermeabilityType = Scalar; - TwoPSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) - , pcKrSwCurve_("Darcy.SpatialParams") + TwoPSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) + , pcKrSwCurve_("SpatialParams") { - permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); - porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); - alphaBJ_ = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph"); + permeability_ = getParam<Scalar>("SpatialParams.Permeability"); + porosity_ = getParam<Scalar>("SpatialParams.Porosity"); + alphaBJ_ = getParam<Scalar>("SpatialParams.AlphaBeaversJoseph"); + temperature_ = getParam<Scalar>("SpatialParams.Temperature"); } /*! @@ -103,10 +104,18 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::phase0Idx; } + /*! \brief Defines the temperature in [K]. + * + * \param globalPos The global position + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { return temperature_; } + private: Scalar permeability_; Scalar porosity_; Scalar alphaBJ_; + Scalar temperature_; const PcKrSwCurve pcKrSwCurve_; static constexpr Scalar eps_ = 1.0e-7; }; diff --git a/exercises/exercise-coupling-ff-pm/README.md b/exercises/exercise-coupling-ff-pm/README.md index 23fbaa64acff215e0ee0927a6992f381d69ce36d..88d4b708edac6d2c36165d0ecb889ae1b3425d8b 100644 --- a/exercises/exercise-coupling-ff-pm/README.md +++ b/exercises/exercise-coupling-ff-pm/README.md @@ -336,13 +336,10 @@ Here, the turbulent free flow is wall bounded which means that the main reason f of turbulent flow is the presence of walls. The porous medium at the bottom and also the channel wall are such walls. Inside the problem you have to tell the turbulence model, where these walls are located -by providing an `isOnWallAtPos()` function: -```c++ -bool isOnWallAtPos(const GlobalPosition& globalPos) const -{ - return (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)); -} -``` +by providing boundary conditions at the wall. For that, use + ```cpp + values.setWall(); + ``` In addition, especially for the zero-equation models, any element in the free-flow domain interacts with the walls, e.g. this defines the wall distance which is needed to calculate the eddy viscosity. diff --git a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index c876aeefe415d471a51a07fcf0caf2d898003ac7..11407d6ffaa90bebd07396b897dff3f751a570cc 100644 --- a/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -71,14 +71,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - * - * This problem assumes a temperature of 10 degrees Celsius. - */ - Scalar temperature() const - { return 273.15 + 10; } // 10°C - /*! * \brief Return the sources within the domain. * @@ -235,9 +227,9 @@ public: using std::sqrt; const Scalar dPdX = -deltaP_ / (this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0]); - static const Scalar mu = FluidSystem::viscosity(temperature(), 1e5); - static const Scalar alpha = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph"); - static const Scalar K = getParam<Scalar>("Darcy.SpatialParams.Permeability"); + static const Scalar mu = FluidSystem::viscosity(this->spatialParams().temperatureAtPos({}), 1e5); + static const Scalar alpha = getParam<Scalar>("SpatialParams.AlphaBeaversJoseph"); + static const Scalar K = getParam<Scalar>("SpatialParams.Permeability"); static const Scalar sqrtK = sqrt(K); const Scalar sigma = (this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1])/sqrtK; diff --git a/exercises/exercise-coupling-ff-pm/interface/main.cc b/exercises/exercise-coupling-ff-pm/interface/main.cc index aa53262270fdf2580014e99593807f2a557f9e62..70aa5e4c7fca2634dc48e0f83e8474eaeeb7bd32 100644 --- a/exercises/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/exercise-coupling-ff-pm/interface/main.cc @@ -137,10 +137,8 @@ int main(int argc, char** argv) // create the finite volume grid geometry using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - stokesFvGridGeometry->update(); using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); - darcyFvGridGeometry->update(); using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; diff --git a/exercises/exercise-coupling-ff-pm/interface/params.input b/exercises/exercise-coupling-ff-pm/interface/params.input index 4117b7f17c501817b738dfdb6836cc2c3223e4a8..22730c83706e84a4c14db95473405ca48c0be3bd 100644 --- a/exercises/exercise-coupling-ff-pm/interface/params.input +++ b/exercises/exercise-coupling-ff-pm/interface/params.input @@ -33,10 +33,11 @@ EnableInertiaTerms = false [Darcy.Problem] Name = darcy -[Darcy.SpatialParams] +[SpatialParams] Permeability = 1e-6 # m^2 Porosity = 0.4 AlphaBeaversJoseph = 1.0 +Temperature = 283.15 [Problem] Name = ex_ff-pm-interface diff --git a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index 08388c79078136b06d3caf73bd3c9f1ba76afb10..3704dd4a2f2d628e237ada3d18daa14283a97778 100644 --- a/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -69,12 +69,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - * - */ - Scalar temperature() const - { return 273.15 + 10; } // 10°C // \} /*! diff --git a/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh index 1fff159eba02ed7b43700cde7115353ffe8b70a8..71a3393c42e47de1db1fa51c803adb9cc88dc15e 100644 --- a/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/freeflowsubproblem.hh @@ -82,12 +82,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - */ - Scalar temperature() const - { return 293.15; } - /*! * \brief Return the sources within the domain. * @@ -273,7 +267,7 @@ private: //! \brief updates the fluid state to obtain required quantities for IC/BC void updateFluidStateForBC_(FluidState& fluidState, const Scalar pressure) const { - fluidState.setTemperature(temperature()); + fluidState.setTemperature(this->spatialParams().temperatureAtPos({})); fluidState.setPressure(0, pressure); fluidState.setSaturation(0, 1.0); fluidState.setMoleFraction(0, 1, moleFraction_); diff --git a/exercises/exercise-coupling-ff-pm/models/main.cc b/exercises/exercise-coupling-ff-pm/models/main.cc index c19c3f9a6d06b8073be9c06d0a57cf540903a064..4a27aba71ce208aafc1968d2bfabd0ad7bda50b7 100644 --- a/exercises/exercise-coupling-ff-pm/models/main.cc +++ b/exercises/exercise-coupling-ff-pm/models/main.cc @@ -86,10 +86,8 @@ int main(int argc, char** argv) // create the finite volume grid geometry using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - stokesFvGridGeometry->update(); using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); - darcyFvGridGeometry->update(); using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; diff --git a/exercises/exercise-coupling-ff-pm/models/params.input b/exercises/exercise-coupling-ff-pm/models/params.input index 60720f808f0ded424678747bb2db80c94c07abc8..152a908fcd026862e0353843f42fbf456cc8d016 100644 --- a/exercises/exercise-coupling-ff-pm/models/params.input +++ b/exercises/exercise-coupling-ff-pm/models/params.input @@ -27,7 +27,7 @@ Saturation = 0.1 # - MoleFraction = 0.1 # - Pressure = 1e5 # Pa -[Darcy.SpatialParams] +[SpatialParams] Permeability = 2.65e-10 # m^2 Porosity = 0.4 # - AlphaBeaversJoseph = 1.0 # - @@ -38,6 +38,7 @@ Swr = 0.005 Snr = 0.01 PcLowSw = Swr * 5.0 PcHighSw = 1.0 - Snr * 5.0 +Temperature = 293.15 [Problem] Name = models_coupling diff --git a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index 242e629abeaa6b1624072e7de7a5b8d7a637dc5f..38a3c3396df7a5018d5ff01673fc0dc76c6bd50f 100644 --- a/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -223,19 +223,6 @@ public: } } - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Return the temperature within the domain in [K]. - * - */ - Scalar temperature() const - { return 293.15; } - // \} - /*! * \name Boundary conditions */ diff --git a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index 9169631ac43f919c6ca43c514d3ca4514f4e18fd..eed5c43ef6e20839114ec983bf8441a634c5ca5a 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -89,12 +89,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - */ - Scalar temperature() const - { return refTemperature_; } - /*! * \brief Return the sources within the domain. * @@ -131,6 +125,8 @@ public: values.setDirichlet(Indices::energyEqIdx); } +// TODO: dumux-course-task 3.A +// set boundary conditions for the turbulence model at the wall (values.setWall()) at the upper and lower boudary if (onLowerBoundary_(globalPos)) { values.setDirichlet(Indices::velocityXIdx); @@ -225,12 +221,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } - // TODO: dumux-course-task 3.A - // Tell the turbulence model, where the walls are located - - // TODO: dumux-course-task 3.B - // Remove the condition `onUpperBoundary_(globalPos)` from the `isOnWallAtPos(globalPos)` - /*! * \name Volume terms */ diff --git a/exercises/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/exercise-coupling-ff-pm/turbulence/main.cc index 006688dc9287e6dd9b399fa17eb5b51677eac7aa..0120de9ac93e89648641dea80735a4327068316b 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/exercise-coupling-ff-pm/turbulence/main.cc @@ -86,10 +86,8 @@ int main(int argc, char** argv) // create the finite volume grid geometry using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - stokesFvGridGeometry->update(); using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); - darcyFvGridGeometry->update(); using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; diff --git a/exercises/exercise-coupling-ff-pm/turbulence/params.input b/exercises/exercise-coupling-ff-pm/turbulence/params.input index 5be387644996cc69800a8a2e207a072c3129fd9e..7f0d58a81b9fbb723c235c7d3c085034f23b3154 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/params.input +++ b/exercises/exercise-coupling-ff-pm/turbulence/params.input @@ -36,7 +36,7 @@ Saturation = 0.5 # initial Sw Temperature = 298.15 # [K] InitPhasePresence = 3 # bothPhases -[Darcy.SpatialParams] +[SpatialParams] Porosity = 0.41 Permeability = 2.65e-10 AlphaBeaversJoseph = 1.0 @@ -46,6 +46,7 @@ Swr = 0.005 Snr = 0.01 PcLowSw = Swr * 5.0 PcHighSw = 1.0 - Snr * 5.0 +Temperature = 298.15 # [K] [Problem] Name = ex_coupling_turbulence_ff-pm diff --git a/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh b/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh index 51029968ed5b7146cd49881ceca640aeab96defa..b37da81619cd214aca2247d7bcaa5e27b12fbb69 100644 --- a/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh +++ b/exercises/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh @@ -126,11 +126,6 @@ public: std::cout << "mass of water is: " << massWater << std::endl; } - /*! - * \brief Return the temperature within the domain in [K]. - */ - Scalar temperature() const - { return temperature_; } // \} /*! diff --git a/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh b/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh index a042388f1eac51bb38ef980cb0f183756aaf6362..1078364520ec34450fadf114688121c1570e86cd 100644 --- a/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh +++ b/exercises/solution/exercise-coupling-ff-pm/1pspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_1P_TEST_SPATIALPARAMS_HH #define DUMUX_1P_TEST_SPATIALPARAMS_HH -#include <dumux/material/spatialparams/fv1p.hh> +#include <dumux/porousmediumflow/fvspatialparams1p.hh> namespace Dumux { @@ -34,12 +34,12 @@ namespace Dumux { * \brief The spatial parameters class for the test problem using the * 1p cc model */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class OnePSpatialParams -: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePSpatialParams<GridGeometry, Scalar>> { - using GridView = typename FVGridGeometry::GridView; - using ParentType = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePSpatialParams<FVGridGeometry, Scalar>>; + using GridView = typename GridGeometry::GridView; + using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePSpatialParams<GridGeometry, Scalar>>; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -48,12 +48,13 @@ public: // export permeability type using PermeabilityType = Scalar; - OnePSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + OnePSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { - permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); - porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); - alphaBJ_ = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph"); + permeability_ = getParam<Scalar>("SpatialParams.Permeability"); + porosity_ = getParam<Scalar>("SpatialParams.Porosity"); + alphaBJ_ = getParam<Scalar>("SpatialParams.AlphaBeaversJoseph"); + temperature_ = getParam<Scalar>("SpatialParams.PorousMediumTemperature"); } /*! @@ -79,11 +80,20 @@ public: Scalar beaversJosephCoeffAtPos(const GlobalPosition& globalPos) const { return alphaBJ_; } + /*! \brief Defines the temperature in [K]. + * + * \param globalPos The global position + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { return temperature_; } + + private: Scalar permeability_; Scalar porosity_; Scalar alphaBJ_; + Scalar temperature_; }; } // end namespace diff --git a/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh b/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh index 9727e1f59104e50d27612c241fe3a4f9d15ff1b6..359c320b2208efb68fbe73a6fda5e93257eeb8a5 100644 --- a/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh +++ b/exercises/solution/exercise-coupling-ff-pm/2pspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_TWOPHASE_SPATIAL_PARAMS_HH #define DUMUX_TWOPHASE_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> #include <dumux/material/fluidmatrixinteractions/2p/thermalconductivity/somerton.hh> @@ -35,15 +35,15 @@ namespace Dumux { * * \brief The spatial parameters class for the test problem using the 2p cc model */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class TwoPSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, TwoPSpatialParams<GridGeometry, Scalar>> { - using GridView = typename FVGridGeometry::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; - using FVElementGeometry = typename FVGridGeometry::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, TwoPSpatialParams<FVGridGeometry, Scalar>>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, TwoPSpatialParams<GridGeometry, Scalar>>; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -52,13 +52,14 @@ class TwoPSpatialParams public: using PermeabilityType = Scalar; - TwoPSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) - , pcKrSwCurve_("Darcy.SpatialParams") + TwoPSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) + , pcKrSwCurve_("SpatialParams") { - permeability_ = getParam<Scalar>("Darcy.SpatialParams.Permeability"); - porosity_ = getParam<Scalar>("Darcy.SpatialParams.Porosity"); - alphaBJ_ = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph"); + permeability_ = getParam<Scalar>("SpatialParams.Permeability"); + porosity_ = getParam<Scalar>("SpatialParams.Porosity"); + alphaBJ_ = getParam<Scalar>("SpatialParams.AlphaBeaversJoseph"); + temperature_ = getParam<Scalar>("SpatialParams.PorousMediumTemperature"); } /*! @@ -103,10 +104,18 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::phase0Idx; } + /*! \brief Defines the temperature in [K]. + * + * \param globalPos The global position + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { return temperature_; } + private: Scalar permeability_; Scalar porosity_; Scalar alphaBJ_; + Scalar temperature_; const PcKrSwCurve pcKrSwCurve_; static constexpr Scalar eps_ = 1.0e-7; }; diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh index b1aa3c87ddd048f62de11343ead97560f670976c..dc6ee8c8cf6bf9ada5481a86467c28f65254a24d 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/freeflowsubproblem.hh @@ -72,14 +72,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - * - * This problem assumes a temperature of 10 degrees Celsius. - */ - Scalar temperature() const - { return 273.15 + 10; } // 10°C - /*! * \brief Return the sources within the domain. * @@ -260,9 +252,9 @@ public: using std::sqrt; const Scalar dPdX = -deltaP_ / (this->gridGeometry().bBoxMax()[0] - this->gridGeometry().bBoxMin()[0]); - static const Scalar mu = FluidSystem::viscosity(temperature(), 1e5); - static const Scalar alpha = getParam<Scalar>("Darcy.SpatialParams.AlphaBeaversJoseph"); - static const Scalar K = getParam<Scalar>("Darcy.SpatialParams.Permeability"); + static const Scalar mu = FluidSystem::viscosity(this->spatialParams().temperatureAtPos({}), 1e5); + static const Scalar alpha = getParam<Scalar>("SpatialParams.AlphaBeaversJoseph"); + static const Scalar K = getParam<Scalar>("SpatialParams.Permeability"); static const Scalar sqrtK = sqrt(K); const Scalar sigma = (this->gridGeometry().bBoxMax()[1] - this->gridGeometry().bBoxMin()[1])/sqrtK; diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc index c4ca97b17800968ef5499d5b605936d3015499bd..d9e53dc70db2acdc320337dddcc633cd1b6921be 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/interface/main.cc @@ -130,10 +130,8 @@ int main(int argc, char** argv) // create the finite volume grid geometry using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - stokesFvGridGeometry->update(); using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); - darcyFvGridGeometry->update(); using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/params.input b/exercises/solution/exercise-coupling-ff-pm/interface/params.input index 4117b7f17c501817b738dfdb6836cc2c3223e4a8..6935e9946b93abd3c903b08b32c3cb15151c6b84 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/params.input +++ b/exercises/solution/exercise-coupling-ff-pm/interface/params.input @@ -33,10 +33,12 @@ EnableInertiaTerms = false [Darcy.Problem] Name = darcy -[Darcy.SpatialParams] +[SpatialParams] Permeability = 1e-6 # m^2 Porosity = 0.4 AlphaBeaversJoseph = 1.0 +PorousMediumTemperature = 283.15 +Temperature = 283.15 [Problem] Name = ex_ff-pm-interface diff --git a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh index af0ae080b41d4bc749445ee65cc0231b788bcf5f..3f3248c6f077c99a21d6fcbed42c690fff91250d 100644 --- a/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/interface/porousmediumsubproblem.hh @@ -69,12 +69,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - * - */ - Scalar temperature() const - { return 273.15 + 10; } // 10°C // \} /*! diff --git a/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh index 0d8647b7777bc90134fd55811f5ab4efdb84e8c5..a94c6a05a15398c4809ea10241fef98f7144f07e 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/freeflowsubproblem.hh @@ -85,12 +85,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - */ - Scalar temperature() const - { return 293.15; } - /*! * \brief Return the sources within the domain. * @@ -276,7 +270,7 @@ private: //! \brief updates the fluid state to obtain required quantities for IC/BC void updateFluidStateForBC_(FluidState& fluidState, const Scalar pressure) const { - fluidState.setTemperature(temperature()); + fluidState.setTemperature(this->spatialParams().temperatureAtPos({})); fluidState.setPressure(0, pressure); fluidState.setSaturation(0, 1.0); fluidState.setMoleFraction(0, 1, moleFraction_); diff --git a/exercises/solution/exercise-coupling-ff-pm/models/main.cc b/exercises/solution/exercise-coupling-ff-pm/models/main.cc index 7b1adffa52bff3948f0020ef853804b50bd0cc41..a6ed0a0249e5a02a81b3cd103fc91706ebb7349a 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/models/main.cc @@ -86,10 +86,8 @@ int main(int argc, char** argv) // create the finite volume grid geometry using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - stokesFvGridGeometry->update(); using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); - darcyFvGridGeometry->update(); using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; diff --git a/exercises/solution/exercise-coupling-ff-pm/models/params.input b/exercises/solution/exercise-coupling-ff-pm/models/params.input index 428750e4229d67cb71ef7641c4bcc2bb1a215d6f..d2c30bd98bbd476126938af001f4b4c733e19a41 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/params.input +++ b/exercises/solution/exercise-coupling-ff-pm/models/params.input @@ -27,7 +27,7 @@ Saturation = 0.1 # - MoleFraction = 0.1 # - Pressure = 1e5 # Pa -[Darcy.SpatialParams] +[SpatialParams] Permeability = 2.65e-10 # m^2 Porosity = 0.4 # - AlphaBeaversJoseph = 1.0 # - @@ -38,6 +38,8 @@ Swr = 0.005 Snr = 0.01 PcLowSw = Swr * 5.0 PcHighSw = 1.0 - Snr * 5.0 +PorousMediumTemperature = 293.15 +Temperature = 293.15 [Problem] Name = ex_models_coupling diff --git a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh index ebf4103753ffa146f72681c8d3af5d2960fbd795..0fd807fb2d49a4087eff688a1542ce6eaf7e5043 100644 --- a/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/models/porousmediumsubproblem.hh @@ -244,19 +244,6 @@ public: } } - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Return the temperature within the domain in [K]. - * - */ - Scalar temperature() const - { return 293.15; } - // \} - /*! * \name Boundary conditions */ diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh index b2cbb64dd1297e80271d8bae8c410e81321e09c0..b79c81622904e54250345787465a7e675e9dd71a 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/freeflowsubproblem.hh @@ -25,6 +25,7 @@ #if EXNUMBER >= 1 #include <dumux/freeflow/rans/problem.hh> +#include <dumux/freeflow/rans/boundarytypes.hh> #else #include <dumux/freeflow/navierstokes/problem.hh> #endif @@ -56,8 +57,13 @@ class FreeFlowSubProblem : public NavierStokesProblem<TypeTag> using Scalar = GetPropType<TypeTag, Properties::Scalar>; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - using BoundaryTypes = Dumux::NavierStokesBoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - + using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; +#if EXNUMBER >= 1 + using BoundaryTypes = Dumux::RANSBoundaryTypes<ModelTraits, ModelTraits::numEq()>; +#else + using BoundaryTypes = Dumux::NavierStokesBoundaryTypes<GetPropType<TypeTag, + Properties::ModelTraits>::numEq()>; +#endif using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; @@ -96,12 +102,6 @@ public: */ // \{ - /*! - * \brief Return the temperature within the domain in [K]. - */ - Scalar temperature() const - { return refTemperature_; } - /*! * \brief Return the sources within the domain. * @@ -145,12 +145,22 @@ public: values.setNeumann(Indices::conti0EqIdx); values.setNeumann(Indices::conti0EqIdx + 1); values.setNeumann(Indices::energyEqIdx); +#if EXNUMBER >=1 + values.setWall(); +#endif } if (onUpperBoundary_(globalPos)) { #if EXNUMBER >=2 values.setAllSymmetry(); +#elif EXNUMBER >= 1 + values.setWall(); + values.setDirichlet(Indices::velocityXIdx); + values.setDirichlet(Indices::velocityYIdx); + values.setNeumann(Indices::conti0EqIdx); + values.setNeumann(Indices::conti0EqIdx + 1); + values.setNeumann(Indices::energyEqIdx); #else values.setDirichlet(Indices::velocityXIdx); values.setDirichlet(Indices::velocityYIdx); @@ -234,18 +244,6 @@ public: const CouplingManager& couplingManager() const { return *couplingManager_; } -#if EXNUMBER >= 2 - bool isOnWallAtPos(const GlobalPosition& globalPos) const - { - return (onLowerBoundary_(globalPos)); - } -#elif EXNUMBER >= 1 - bool isOnWallAtPos(const GlobalPosition& globalPos) const - { - return (onLowerBoundary_(globalPos) || onUpperBoundary_(globalPos)); - } -#endif - /*! * \name Volume terms */ diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc index 880c3c29ae680767b9b097546156460d8bd48d3b..668e08b21668e00efe9c24c7b037d14313953e8c 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/main.cc @@ -86,10 +86,8 @@ int main(int argc, char** argv) // create the finite volume grid geometry using StokesFVGridGeometry = GetPropType<StokesTypeTag, Properties::GridGeometry>; auto stokesFvGridGeometry = std::make_shared<StokesFVGridGeometry>(stokesGridView); - stokesFvGridGeometry->update(); using DarcyFVGridGeometry = GetPropType<DarcyTypeTag, Properties::GridGeometry>; auto darcyFvGridGeometry = std::make_shared<DarcyFVGridGeometry>(darcyGridView); - darcyFvGridGeometry->update(); using Traits = StaggeredMultiDomainTraits<StokesTypeTag, StokesTypeTag, DarcyTypeTag>; diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input b/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input index 47d2331c69cf2fbbd9a4a7e4647b1352186b53f2..5ab29c8c810135af206cd4bf210e223cb28eaab7 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/params.input @@ -36,7 +36,7 @@ Saturation = 0.5 # initial Sw Temperature = 298.15 # [K] InitPhasePresence = 3 # bothPhases -[Darcy.SpatialParams] +[SpatialParams] Porosity = 0.41 Permeability = 2.65e-10 AlphaBeaversJoseph = 1.0 @@ -46,6 +46,8 @@ Swr = 0.005 Snr = 0.01 PcLowSw = Swr * 5.0 PcHighSw = 1.0 - Snr * 5.0 +PorousMediumTemperature = 298.15 # [K] + [Problem] Name = ex_coupling_turbulence_ff-pm EnableGravity = true @@ -67,3 +69,6 @@ NumericDifference.BaseEpsilon = 1e-8 SolidDensity = 2700 SolidThermalConductivity = 2.8 SolidHeatCapacity = 790 + +[RANS] +IsFlatWallBounded = True diff --git a/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh b/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh index ba4fe99d13015f6058379621bc1aa2f97e331555..eec4de6b0cd23864bc6619b1830efbe8cd570129 100644 --- a/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh +++ b/exercises/solution/exercise-coupling-ff-pm/turbulence/porousmediumsubproblem.hh @@ -126,11 +126,6 @@ public: std::cout << "mass of water is: " << massWater << std::endl; } - /*! - * \brief Return the temperature within the domain in [K]. - */ - Scalar temperature() const - { return temperature_; } // \} /*!