From 4f36bbd43137ef340fcdd04b6e25cf4bffb1db9a Mon Sep 17 00:00:00 2001 From: heck <katharina.heck@iws.uni-stuttgart.de> Date: Wed, 23 Feb 2022 15:47:09 +0100 Subject: [PATCH] [exercises] remove deprecated stuff for dumux 3.5, move temperature in spatialparams --- exercises/exercise-basic/2p2cmain.cc | 15 +++-- exercises/exercise-basic/2pmain.cc | 15 +++-- .../exercise-basic/injection2p2cproblem.hh | 18 ++---- .../exercise-basic/injection2pniproblem.hh | 6 +- .../exercise-basic/injection2pproblem.hh | 16 ++---- exercises/exercise-basic/properties2p.hh | 4 +- exercises/exercise-basic/properties2p2c.hh | 4 +- exercises/exercise-basic/properties2pni.hh | 4 +- exercises/exercise-basic/spatialparams.hh | 21 +++++-- .../biominproblem.hh | 23 +++----- .../biominspatialparams.hh | 55 ++++++++++-------- exercises/exercise-biomineralization/main.cc | 21 ++++--- exercises/exercise-fluidsystem/2p2cproblem.hh | 17 +----- .../exercise-fluidsystem/2p2cproperties.hh | 4 +- exercises/exercise-fluidsystem/2pproblem.hh | 19 ++----- .../exercise-fluidsystem/2pproperties.hh | 4 +- exercises/exercise-fluidsystem/main.cc | 17 +++--- .../exercise-fluidsystem/spatialparams.hh | 27 ++++++--- .../exercise-fractures/fractureproblem.hh | 26 ++------- .../fracturespatialparams.hh | 42 ++++++++++---- exercises/exercise-fractures/main.cc | 12 ++-- exercises/exercise-fractures/matrixproblem.hh | 18 +++--- .../exercise-fractures/matrixspatialparams.hh | 29 ++++++---- exercises/exercise-grids/main.cc | 15 +++-- exercises/exercise-grids/problem.hh | 16 ++---- exercises/exercise-grids/properties.hh | 4 +- exercises/exercise-grids/spatialparams.hh | 33 +++++++---- exercises/exercise-mainfile/1pproblem.hh | 17 +----- .../exercise-mainfile/1pspatialparams.hh | 25 +++++--- .../exercise-mainfile/exercise1pamain.cc | 13 ++--- .../exercise-mainfile/exercise1pbmain.cc | 13 ++--- .../exercise-mainfile/exercise1pcmain.cc | 13 ++--- exercises/exercise-properties/main.cc | 15 +++-- exercises/exercise-properties/problem.hh | 22 ++----- exercises/exercise-properties/properties.hh | 4 +- .../exercise-properties/spatialparams.hh | 27 ++++++--- exercises/exercise-runtimeparams/main.cc | 15 +++-- exercises/exercise-runtimeparams/problem.hh | 16 ++---- .../exercise-runtimeparams/properties.hh | 4 +- .../exercise-runtimeparams/spatialparams.hh | 33 +++++++---- exercises/solution/exercise-basic/2pnimain.cc | 15 +++-- .../exercise-basic/injection2pniproblem.hh | 6 +- .../solution/exercise-basic/properties2pni.hh | 4 +- .../solution/exercise-basic/spatialparams.hh | 24 ++++---- .../biominproblem.hh | 24 +++----- .../biominspatialparams.hh | 57 +++++++++++-------- .../exercise-biomineralization/main.cc | 21 ++++--- .../exercise-fluidsystem/2p2cproblem.hh | 17 +----- .../exercise-fluidsystem/2p2cproperties.hh | 4 +- .../exercise-fluidsystem/2pproblem.hh | 19 ++----- .../exercise-fluidsystem/2pproperties.hh | 4 +- .../solution/exercise-fluidsystem/main.cc | 17 +++--- .../exercise-fluidsystem/spatialparams.hh | 33 +++++++---- .../exercise-fractures/fractureproblem.hh | 25 ++------ .../fracturespatialparams.hh | 38 ++++++++++--- exercises/solution/exercise-fractures/main.cc | 12 ++-- .../exercise-fractures/matrixproblem.hh | 18 +++--- .../exercise-fractures/matrixspatialparams.hh | 29 ++++++---- exercises/solution/exercise-grids/main.cc | 15 +++-- exercises/solution/exercise-grids/problem.hh | 16 ++---- .../solution/exercise-grids/properties.hh | 4 +- .../solution/exercise-grids/spatialparams.hh | 33 +++++++---- .../solution/exercise-mainfile/1pproblem.hh | 18 +----- .../exercise-mainfile/1pspatialparams.hh | 25 +++++--- .../exercise1pa_solution_main.cc | 13 ++--- .../solution/exercise-properties/main.cc | 15 +++-- .../solution/exercise-properties/problem.hh | 24 ++------ .../exercise-properties/properties.hh | 4 +- .../exercise-properties/spatialparams.hh | 27 ++++++--- .../solution/exercise-runtimeparams/main.cc | 15 +++-- .../exercise-runtimeparams/problem.hh | 16 ++---- .../exercise-runtimeparams/properties.hh | 4 +- .../exercise-runtimeparams/spatialparams.hh | 33 +++++++---- scripts/install.sh | 2 +- 74 files changed, 647 insertions(+), 686 deletions(-) diff --git a/exercises/exercise-basic/2p2cmain.cc b/exercises/exercise-basic/2p2cmain.cc index 9bac0255..5467f9a7 100644 --- a/exercises/exercise-basic/2p2cmain.cc +++ b/exercises/exercise-basic/2p2cmain.cc @@ -81,13 +81,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -97,7 +96,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -120,11 +119,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver // using PrimaryVariableSwitch = GetPropType<TypeTag, Properties::PrimaryVariableSwitch>; diff --git a/exercises/exercise-basic/2pmain.cc b/exercises/exercise-basic/2pmain.cc index 16d628b5..fb0fb484 100644 --- a/exercises/exercise-basic/2pmain.cc +++ b/exercises/exercise-basic/2pmain.cc @@ -82,13 +82,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -98,7 +97,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -125,11 +124,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/exercise-basic/injection2p2cproblem.hh b/exercises/exercise-basic/injection2p2cproblem.hh index 1a4a0ee9..745d6925 100644 --- a/exercises/exercise-basic/injection2p2cproblem.hh +++ b/exercises/exercise-basic/injection2p2cproblem.hh @@ -63,7 +63,7 @@ class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -73,8 +73,8 @@ class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - Injection2p2cProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + Injection2p2cProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, @@ -107,14 +107,6 @@ public: std::string name() const { return name_+"-2p2c"; } - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { - return 273.15 + 30; // [K] - } - // \} /*! @@ -206,7 +198,7 @@ public: PrimaryVariables values(0.0); values.setState(Indices::firstPhaseOnly); // get the water density at atmospheric conditions - const Scalar densityW = FluidSystem::H2O::liquidDensity(temperature(), 1.0e5); + const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative @@ -215,7 +207,7 @@ public: // initially we have some nitrogen dissolved // saturation mole fraction would be // moleFracLiquidN2 = (pw + pc + p_vap^sat)/henry; - const Scalar moleFracLiquidN2 = pw*0.95/BinaryCoeff::H2O_N2::henry(temperature()); + const Scalar moleFracLiquidN2 = pw*0.95/BinaryCoeff::H2O_N2::henry(this->spatialParams().temperatureAtPos(globalPos)); // note that because we start with a single phase system the primary variables // are pl and x^w_N2. This will switch as soon after we start injecting to a two diff --git a/exercises/exercise-basic/injection2pniproblem.hh b/exercises/exercise-basic/injection2pniproblem.hh index 50508fca..b70ad5ad 100644 --- a/exercises/exercise-basic/injection2pniproblem.hh +++ b/exercises/exercise-basic/injection2pniproblem.hh @@ -62,7 +62,7 @@ class Injection2PNIProblem : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,8 +72,8 @@ class Injection2PNIProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - Injection2PNIProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + Injection2PNIProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, diff --git a/exercises/exercise-basic/injection2pproblem.hh b/exercises/exercise-basic/injection2pproblem.hh index 154519bc..2d247776 100644 --- a/exercises/exercise-basic/injection2pproblem.hh +++ b/exercises/exercise-basic/injection2pproblem.hh @@ -62,7 +62,7 @@ class Injection2PProblem : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,8 +72,8 @@ class Injection2PProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - Injection2PProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + Injection2PProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, @@ -106,14 +106,6 @@ public: std::string name() const { return name_+"-2p"; } - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { - return 273.15 + 30; // [K] - } - // \} /*! @@ -206,7 +198,7 @@ public: PrimaryVariables values(0.0); // get the water density at atmospheric conditions - const Scalar densityW = FluidSystem::H2O::liquidDensity(temperature(), 1.0e5); + const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative diff --git a/exercises/exercise-basic/properties2p.hh b/exercises/exercise-basic/properties2p.hh index 13164ccd..7f6b15eb 100644 --- a/exercises/exercise-basic/properties2p.hh +++ b/exercises/exercise-basic/properties2p.hh @@ -56,10 +56,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2p> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/exercise-basic/properties2p2c.hh b/exercises/exercise-basic/properties2p2c.hh index 0db24a19..997a8158 100644 --- a/exercises/exercise-basic/properties2p2c.hh +++ b/exercises/exercise-basic/properties2p2c.hh @@ -55,10 +55,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2p2c> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/exercise-basic/properties2pni.hh b/exercises/exercise-basic/properties2pni.hh index 95af6a6c..a7ddf5c6 100644 --- a/exercises/exercise-basic/properties2pni.hh +++ b/exercises/exercise-basic/properties2pni.hh @@ -59,10 +59,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2pNITypeTag> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/exercise-basic/spatialparams.hh b/exercises/exercise-basic/spatialparams.hh index e3dac534..df90c7e5 100644 --- a/exercises/exercise-basic/spatialparams.hh +++ b/exercises/exercise-basic/spatialparams.hh @@ -27,7 +27,7 @@ #ifndef DUMUX_EX_BASIC_SPATIAL_PARAMS_HH #define DUMUX_EX_BASIC_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/io/gnuplotinterface.hh> @@ -43,10 +43,10 @@ namespace Dumux { */ template<class FVGridGeometry, class Scalar> class InjectionSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> { using ThisType = InjectionSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<FVGridGeometry, Scalar, ThisType>; using GridView = typename FVGridGeometry::GridView; // get the dimensions of the simulation domain from GridView @@ -112,10 +112,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); } /*! @@ -128,6 +128,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::H2OIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 273.15 + 30; // [K] + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/exercise-biomineralization/biominproblem.hh b/exercises/exercise-biomineralization/biominproblem.hh index 943a941e..b0a0d0d4 100644 --- a/exercises/exercise-biomineralization/biominproblem.hh +++ b/exercises/exercise-biomineralization/biominproblem.hh @@ -50,7 +50,7 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; // Grid dimension @@ -95,11 +95,11 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ public: - BioMinProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + BioMinProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { name_ = getParam<std::string>("Problem.Name"); //initial values @@ -114,9 +114,9 @@ public: concCa_ = getParam<Scalar>("Injection.ConcCa"); concUrea_ = getParam<Scalar>("Injection.ConcUrea"); - unsigned int codim = GetPropType<TypeTag, Properties::GridGeometry>::discMethod == DiscretizationMethod::box ? dim : 0; - Kxx_.resize(fvGridGeometry->gridView().size(codim)); - Kyy_.resize(fvGridGeometry->gridView().size(codim)); + unsigned int codim = GetPropType<TypeTag, Properties::GridGeometry>::discMethod == DiscretizationMethods::box ? dim : 0; + Kxx_.resize(gridGeometry->gridView().size(codim)); + Kyy_.resize(gridGeometry->gridView().size(codim)); //initialize the fluidsystem FluidSystem::init(/*startTemp=*/288, @@ -144,15 +144,6 @@ public: const std::string name() const { return name_; } - /*! - * \brief Returns the temperature within the domain. - * - * This problem assumes a temperature of 300 degrees Kelvin. - */ - Scalar temperature() const - { - return 300; // [K] - } // \} diff --git a/exercises/exercise-biomineralization/biominspatialparams.hh b/exercises/exercise-biomineralization/biominspatialparams.hh index ab63115c..a2eb8e65 100644 --- a/exercises/exercise-biomineralization/biominspatialparams.hh +++ b/exercises/exercise-biomineralization/biominspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_BIOMIN_SPATIAL_PARAMETERS_HH #define DUMUX_BIOMIN_SPATIAL_PARAMETERS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/material/fluidmatrixinteractions/porosityprecipitation.hh> @@ -38,15 +38,15 @@ namespace Dumux { * \brief Definition of the spatial parameters for the biomineralisation problem * with geostatistically distributed initial permeability. */ -template<class FVGridGeometry, class Scalar, int numFluidComps, int numActiveSolidComps> +template<class GridGeometry, class Scalar, int numFluidComps, int numActiveSolidComps> class BioMinSpatialparams -: public FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, BioMinSpatialparams<GridGeometry, Scalar, numFluidComps, numActiveSolidComps>> { - using FVElementGeometry = typename FVGridGeometry::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, BioMinSpatialparams<GridGeometry, Scalar, numFluidComps, numActiveSolidComps>>; - using GridView = typename FVGridGeometry::GridView; + using GridView = typename GridGeometry::GridView; using CoordScalar = typename GridView::ctype; enum { dimWorld=GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; @@ -66,8 +66,8 @@ public: * * \param gridView The grid view */ - BioMinSpatialparams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + BioMinSpatialparams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , pcKrSwCurve_("SpatialParams") , aquitardPcKrSwCurve_("SpatialParams.Aquitard") { @@ -119,22 +119,22 @@ public: * * \f[referencePorosity = 2 \cdot initialPorosity - evaluatePorosity() \f] * - * \param fvGridGeometry The fvGridGeometry + * \param gridGeometry The gridGeometry * \param sol The (initial) solution vector */ template<class SolutionVector> - void computeReferencePorosity(const FVGridGeometry& fvGridGeometry, + void computeReferencePorosity(const GridGeometry& gridGeometry, const SolutionVector& sol) { - referencePorosity_.resize(fvGridGeometry.gridView().size(0)); - for (const auto& element : elements(fvGridGeometry.gridView())) + referencePorosity_.resize(gridGeometry.gridView().size(0)); + for (const auto& element : elements(gridGeometry.gridView())) { - auto fvGeometry = localView(fvGridGeometry); + auto fvGeometry = localView(gridGeometry); fvGeometry.bindElement(element); const auto eIdx = this->gridGeometry().elementMapper().index(element); - auto elemSol = elementSolution(element, sol, fvGridGeometry); + auto elemSol = elementSolution(element, sol, gridGeometry); referencePorosity_[eIdx].resize(fvGeometry.numScv()); for (const auto& scv : scvs(fvGeometry)) { @@ -191,22 +191,22 @@ public: * * \f[referencePermeability = initialPermeability^2 / evaluatePermeability() \f] * - * \param fvGridGeometry The fvGridGeometry + * \param gridGeometry The gridGeometry * \param sol The (initial) solution vector */ template<class SolutionVector> - void computeReferencePermeability(const FVGridGeometry& fvGridGeometry, + void computeReferencePermeability(const GridGeometry& gridGeometry, const SolutionVector& sol) { - referencePermeability_.resize(fvGridGeometry.gridView().size(0)); - for (const auto& element : elements(fvGridGeometry.gridView())) + referencePermeability_.resize(gridGeometry.gridView().size(0)); + for (const auto& element : elements(gridGeometry.gridView())) { - auto fvGeometry = localView(fvGridGeometry); + auto fvGeometry = localView(gridGeometry); fvGeometry.bindElement(element); const auto eIdx = this->gridGeometry().elementMapper().index(element); - auto elemSol = elementSolution(element, sol, fvGridGeometry); + auto elemSol = elementSolution(element, sol, gridGeometry); referencePermeability_[eIdx].resize(fvGeometry.numScv()); for (const auto& scv : scvs(fvGeometry)) { @@ -249,10 +249,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(pcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(pcKrSwCurve_); } // define which phase is to be considered as the wetting phase @@ -260,6 +260,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::liquidPhaseIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 300; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/exercise-biomineralization/main.cc b/exercises/exercise-biomineralization/main.cc index 9aa45302..dcef5a0e 100644 --- a/exercises/exercise-biomineralization/main.cc +++ b/exercises/exercise-biomineralization/main.cc @@ -83,27 +83,26 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; // initialize the spatialParams separately to compute the referencePorosity and referencePermeability - problem->spatialParams().computeReferencePorosity(*fvGridGeometry, x); - problem->spatialParams().computeReferencePermeability(*fvGridGeometry, x); + problem->spatialParams().computeReferencePorosity(*gridGeometry, x); + problem->spatialParams().computeReferencePermeability(*gridGeometry, x); // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -130,11 +129,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/exercise-fluidsystem/2p2cproblem.hh b/exercises/exercise-fluidsystem/2p2cproblem.hh index 48d43b2d..e28394cb 100644 --- a/exercises/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/exercise-fluidsystem/2p2cproblem.hh @@ -55,14 +55,14 @@ class ExerciseFluidsystemProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTa using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; public: - ExerciseFluidsystemProblemTwoPTwoC(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + ExerciseFluidsystemProblemTwoPTwoC(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , eps_(3e-6) { @@ -73,17 +73,6 @@ public: depthBOR_ = this->gridGeometry().bBoxMax()[dimWorld-1]; } - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { return 283.15; } - /*! * \name Boundary conditions */ diff --git a/exercises/exercise-fluidsystem/2p2cproperties.hh b/exercises/exercise-fluidsystem/2p2cproperties.hh index e39bf9b3..18e45d9c 100644 --- a/exercises/exercise-fluidsystem/2p2cproperties.hh +++ b/exercises/exercise-fluidsystem/2p2cproperties.hh @@ -59,10 +59,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; + using type = ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>; }; // Set grid and the grid creator to be used diff --git a/exercises/exercise-fluidsystem/2pproblem.hh b/exercises/exercise-fluidsystem/2pproblem.hh index c80d471d..2a59fc42 100644 --- a/exercises/exercise-fluidsystem/2pproblem.hh +++ b/exercises/exercise-fluidsystem/2pproblem.hh @@ -61,7 +61,7 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using FluidState = GetPropType<TypeTag, Properties::FluidState>; @@ -75,8 +75,8 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> }; public: - ExerciseFluidsystemProblemTwoP(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + ExerciseFluidsystemProblemTwoP(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , eps_(3e-6) { @@ -96,17 +96,6 @@ public: plotDensity_(); } - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { return 283.15; } - /*! * \name Boundary conditions */ @@ -218,7 +207,7 @@ private: void plotDensity_() { FluidState fluidState; - fluidState.setTemperature(temperature()); + fluidState.setTemperature(283.15); int numberOfPoints = 100; Scalar xMin = 1e4; Scalar xMax = 1e7; diff --git a/exercises/exercise-fluidsystem/2pproperties.hh b/exercises/exercise-fluidsystem/2pproperties.hh index b70da83b..f924b70e 100644 --- a/exercises/exercise-fluidsystem/2pproperties.hh +++ b/exercises/exercise-fluidsystem/2pproperties.hh @@ -71,10 +71,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; + using type = ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>; }; // Set grid to be used diff --git a/exercises/exercise-fluidsystem/main.cc b/exercises/exercise-fluidsystem/main.cc index ddbb05f6..c89c8182 100644 --- a/exercises/exercise-fluidsystem/main.cc +++ b/exercises/exercise-fluidsystem/main.cc @@ -89,23 +89,22 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); @@ -128,11 +127,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric, /*implicit?*/true>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/exercise-fluidsystem/spatialparams.hh b/exercises/exercise-fluidsystem/spatialparams.hh index e4f41812..c85b7649 100644 --- a/exercises/exercise-fluidsystem/spatialparams.hh +++ b/exercises/exercise-fluidsystem/spatialparams.hh @@ -26,7 +26,7 @@ #define DUMUX_EXERCISE_FLUIDSYSTEM_SPATIAL_PARAMS_HH // include parent spatialparameters -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> //inlclude fluid matrix interaction relationship #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> @@ -40,13 +40,13 @@ namespace Dumux { * \brief The spatial parameters for the exercise-fluidsystem problem * which uses the two-phase and two-phase two-component box model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class ExerciseFluidsystemSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>> { - using ThisType = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; @@ -62,10 +62,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - ExerciseFluidsystemSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + ExerciseFluidsystemSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , K_(0) , KLens_(0) , pcKrSwCurve_("SpatialParams") @@ -145,6 +145,15 @@ public: (x < 50 + eps_ && x > 30 - eps_ && y < 30 + eps_ && y > 15 - eps_); } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/exercise-fractures/fractureproblem.hh b/exercises/exercise-fractures/fractureproblem.hh index 141ee88f..df925bae 100644 --- a/exercises/exercise-fractures/fractureproblem.hh +++ b/exercises/exercise-fractures/fractureproblem.hh @@ -53,10 +53,10 @@ class FractureSubProblem : public PorousMediumFlowProblem<TypeTag> using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView; using Scalar = typename GridVariables::Scalar; - using FVGridGeometry = typename GridVariables::GridGeometry; - using FVElementGeometry = typename FVGridGeometry::LocalView; - using SubControlVolume = typename FVGridGeometry::SubControlVolume; - using GridView = typename FVGridGeometry::GridView; + using GridGeometry = typename GridVariables::GridGeometry; + using FVElementGeometry = typename GridGeometry::LocalView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -70,11 +70,10 @@ class FractureSubProblem : public PorousMediumFlowProblem<TypeTag> public: //! The constructor - FractureSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + FractureSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<typename ParentType::SpatialParams> spatialParams, const std::string& paramGroup) - : ParentType(fvGridGeometry, spatialParams, paramGroup) - , aperture_(getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Aperture")) + : ParentType(gridGeometry, spatialParams, paramGroup) { // initialize the fluid system, i.e. the tabulation // of water properties. Use the default p/T ranges. @@ -116,15 +115,6 @@ public: return source; } - //! Set the aperture as extrusion factor. - Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const - { - // We treat the fractures as lower-dimensional in the grid, - // but we have to give it the aperture as extrusion factor - // such that the dimensions are correct in the end. - return aperture_; - } - //! evaluates the Dirichlet boundary condition for a given position PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const { return initialAtPos(globalPos); } @@ -145,10 +135,6 @@ public: return values; } - //! returns the temperature in \f$\mathrm{[K]}\f$ in the domain - Scalar temperature() const - { return 283.15; /*10°*/ } - //! sets the pointer to the coupling manager. void setCouplingManager(std::shared_ptr<CouplingManager> cm) { couplingManagerPtr_ = cm; } diff --git a/exercises/exercise-fractures/fracturespatialparams.hh b/exercises/exercise-fractures/fracturespatialparams.hh index 61bdf4fc..1874ce70 100644 --- a/exercises/exercise-fractures/fracturespatialparams.hh +++ b/exercises/exercise-fractures/fracturespatialparams.hh @@ -29,7 +29,7 @@ #include <dumux/io/grid/griddata.hh> -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> namespace Dumux { @@ -40,15 +40,15 @@ namespace Dumux { * \ingroup TwoPTests * \brief The spatial params the two-phase facet coupling test */ -template< class FVGridGeometry, class Scalar > +template< class GridGeometry, class Scalar > class FractureSpatialParams -: public FVSpatialParams< FVGridGeometry, Scalar, FractureSpatialParams<FVGridGeometry, Scalar> > +: public FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, FractureSpatialParams<GridGeometry, Scalar> > { - using ThisType = FractureSpatialParams< FVGridGeometry, Scalar >; - using ParentType = FVSpatialParams< FVGridGeometry, Scalar, ThisType >; + using ThisType = FractureSpatialParams< GridGeometry, Scalar >; + using ParentType = FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, ThisType >; - using SubControlVolume = typename FVGridGeometry::SubControlVolume; - using GridView = typename FVGridGeometry::GridView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using GridView = typename GridGeometry::GridView; using Grid = typename GridView::Grid; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -64,10 +64,10 @@ public: using PermeabilityType = Scalar; //! the constructor - FractureSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + FractureSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<const Dumux::GridData<Grid>> gridData, const std::string& paramGroup) - : ParentType(fvGridGeometry) + : ParentType(gridGeometry) , gridDataPtr_(gridData) , pcKrSwCurve_("Fracture.SpatialParams") , barrierPcKrSwCurve_("Fracture.SpatialParams.Barrier") @@ -76,6 +76,7 @@ public: porosityBarrier_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.PorosityBarrier"); permeability_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Permeability"); permeabilityBarrier_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.PermeabilityBarrier"); + aperture_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Aperture"); } //! Function for defining the (intrinsic) permeability \f$[m^2]\f$. @@ -111,10 +112,10 @@ public: auto fluidMatrixInteraction(const Element& element, const SubControlVolume& scv, const ElementSolution& elemSol) const - { + { // TODO dumux-course-task B // Change fracture properties - return makeFluidMatrixInteraction(pcKrSwCurve_); + return makeFluidMatrixInteraction(pcKrSwCurve_); } //! Water is the wetting phase @@ -126,6 +127,24 @@ public: return FluidSystem::phase0Idx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + + //! Set the aperture as extrusion factor. + Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const + { + // We treat the fractures as lower-dimensional in the grid, + // but we have to give it the aperture as extrusion factor + // such that the dimensions are correct in the end. + return aperture_; + } + //! returns the domain marker for an element int getElementDomainMarker(const Element& element) const { return gridDataPtr_->getElementDomainMarker(element); } @@ -136,6 +155,7 @@ private: Scalar porosity_; Scalar porosityBarrier_; + Scalar aperture_; PermeabilityType permeability_; PermeabilityType permeabilityBarrier_; const PcKrSwCurve pcKrSwCurve_; diff --git a/exercises/exercise-fractures/main.cc b/exercises/exercise-fractures/main.cc index 12485ac9..2b4bba69 100644 --- a/exercises/exercise-fractures/main.cc +++ b/exercises/exercise-fractures/main.cc @@ -50,10 +50,10 @@ // reuse them again in the main function with only one single definition of them here using MatrixTypeTag = Dumux::Properties::TTag::MatrixProblem; using FractureTypeTag = Dumux::Properties::TTag::FractureProblem; -using MatrixFVGridGeometry = Dumux::GetPropType<MatrixTypeTag, Dumux::Properties::GridGeometry>; -using FractureFVGridGeometry = Dumux::GetPropType<FractureTypeTag, Dumux::Properties::GridGeometry>; +using MatrixGridGeometry = Dumux::GetPropType<MatrixTypeTag, Dumux::Properties::GridGeometry>; +using FractureGridGeometry = Dumux::GetPropType<FractureTypeTag, Dumux::Properties::GridGeometry>; using TheMultiDomainTraits = Dumux::MultiDomainTraits<MatrixTypeTag, FractureTypeTag>; -using TheCouplingMapper = Dumux::FacetCouplingMapper<MatrixFVGridGeometry, FractureFVGridGeometry>; +using TheCouplingMapper = Dumux::FacetCouplingMapper<MatrixGridGeometry, FractureGridGeometry>; using TheCouplingManager = Dumux::FacetCouplingManager<TheMultiDomainTraits, TheCouplingMapper>; // set the coupling manager property in the sub-problems @@ -111,10 +111,8 @@ int main(int argc, char** argv) const auto& fractureGridView = gridManager.template grid<fractureGridId>().leafGridView(); // create the finite volume grid geometries - auto matrixFvGridGeometry = std::make_shared<MatrixFVGridGeometry>(matrixGridView); - auto fractureFvGridGeometry = std::make_shared<FractureFVGridGeometry>(fractureGridView); - matrixFvGridGeometry->update(); - fractureFvGridGeometry->update(); + auto matrixFvGridGeometry = std::make_shared<MatrixGridGeometry>(matrixGridView); + auto fractureFvGridGeometry = std::make_shared<FractureGridGeometry>(fractureGridView); // the problems (boundary/initial conditions etc) using MatrixProblem = GetPropType<MatrixTypeTag, Properties::Problem>; diff --git a/exercises/exercise-fractures/matrixproblem.hh b/exercises/exercise-fractures/matrixproblem.hh index 1da40a74..4a9ca805 100644 --- a/exercises/exercise-fractures/matrixproblem.hh +++ b/exercises/exercise-fractures/matrixproblem.hh @@ -56,11 +56,11 @@ class MatrixSubProblem : public PorousMediumFlowProblem<TypeTag> using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; using Scalar = typename GridVariables::Scalar; - using FVGridGeometry = typename GridVariables::GridGeometry; - using FVElementGeometry = typename FVGridGeometry::LocalView; - using SubControlVolume = typename FVGridGeometry::SubControlVolume; - using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; - using GridView = typename FVGridGeometry::GridView; + using GridGeometry = typename GridVariables::GridGeometry; + using FVElementGeometry = typename GridGeometry::LocalView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -74,10 +74,10 @@ class MatrixSubProblem : public PorousMediumFlowProblem<TypeTag> public: //! The constructor - MatrixSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + MatrixSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<typename ParentType::SpatialParams> spatialParams, const std::string& paramGroup = "") - : ParentType(fvGridGeometry, spatialParams, paramGroup) + : ParentType(gridGeometry, spatialParams, paramGroup) , boundaryOverPressure_(getParamFromGroup<Scalar>(paramGroup, "Problem.BoundaryOverPressure")) , boundarySaturation_(getParamFromGroup<Scalar>(paramGroup, "Problem.BoundarySaturation")) { @@ -160,10 +160,6 @@ public: return values; } - //! returns the temperature in \f$\mathrm{[K]}\f$ in the domain - Scalar temperature() const - { return 283.15; /*10°*/ } - //! sets the pointer to the coupling manager. void setCouplingManager(std::shared_ptr<CouplingManager> cm) { couplingManagerPtr_ = cm; } diff --git a/exercises/exercise-fractures/matrixspatialparams.hh b/exercises/exercise-fractures/matrixspatialparams.hh index 939e488d..219bf8bf 100644 --- a/exercises/exercise-fractures/matrixspatialparams.hh +++ b/exercises/exercise-fractures/matrixspatialparams.hh @@ -29,7 +29,7 @@ #include <dumux/io/grid/griddata.hh> -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> namespace Dumux { @@ -40,14 +40,14 @@ namespace Dumux { * \ingroup TwoPTests * \brief The spatial params the two-phase facet coupling test */ -template< class FVGridGeometry, class Scalar > +template< class GridGeometry, class Scalar > class MatrixSpatialParams -: public FVSpatialParams< FVGridGeometry, Scalar, MatrixSpatialParams<FVGridGeometry, Scalar> > +: public FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, MatrixSpatialParams<GridGeometry, Scalar> > { - using ThisType = MatrixSpatialParams< FVGridGeometry, Scalar >; - using ParentType = FVSpatialParams< FVGridGeometry, Scalar, ThisType >; + using ThisType = MatrixSpatialParams< GridGeometry, Scalar >; + using ParentType = FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, ThisType >; - using GridView = typename FVGridGeometry::GridView; + using GridView = typename GridGeometry::GridView; using Grid = typename GridView::Grid; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -59,10 +59,10 @@ public: using PermeabilityType = Scalar; //! the constructor - MatrixSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + MatrixSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<const Dumux::GridData<Grid>> gridData, const std::string& paramGroup) - : ParentType(fvGridGeometry) + : ParentType(gridGeometry) , gridDataPtr_(gridData) , pcKrSwCurve_("Matrix.SpatialParams") { @@ -83,8 +83,8 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { - return makeFluidMatrixInteraction(pcKrSwCurve_); + { + return makeFluidMatrixInteraction(pcKrSwCurve_); } //! Water is the wetting phase @@ -96,6 +96,15 @@ public: return FluidSystem::phase0Idx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + //! returns the domain marker for an element int getElementDomainMarker(const Element& element) const { return gridDataPtr_->getElementDomainMarker(element); } diff --git a/exercises/exercise-grids/main.cc b/exercises/exercise-grids/main.cc index ab18bc53..cd12fcd8 100644 --- a/exercises/exercise-grids/main.cc +++ b/exercises/exercise-grids/main.cc @@ -82,13 +82,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -98,7 +97,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -123,11 +122,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/exercise-grids/problem.hh b/exercises/exercise-grids/problem.hh index 6b03c509..fe9b6bde 100644 --- a/exercises/exercise-grids/problem.hh +++ b/exercises/exercise-grids/problem.hh @@ -62,7 +62,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,8 +72,8 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - InjectionProblem2P(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionProblem2P(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, @@ -106,14 +106,6 @@ public: std::string name() const { return name_+"-2p"; } - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { - return 273.15 + 30; // [K] - } - // \} /*! @@ -195,7 +187,7 @@ public: PrimaryVariables values(0.0); // get the water density at atmospheric conditions - const Scalar densityW = FluidSystem::H2O::liquidDensity(temperature(), 1.0e5); + const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative diff --git a/exercises/exercise-grids/properties.hh b/exercises/exercise-grids/properties.hh index 81227d89..4e2e0e7b 100644 --- a/exercises/exercise-grids/properties.hh +++ b/exercises/exercise-grids/properties.hh @@ -65,10 +65,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2p> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/exercise-grids/spatialparams.hh b/exercises/exercise-grids/spatialparams.hh index 433e3f6b..0160b1a6 100644 --- a/exercises/exercise-grids/spatialparams.hh +++ b/exercises/exercise-grids/spatialparams.hh @@ -27,7 +27,7 @@ #ifndef DUMUX_EXGRIDS_INJECTION_SPATIAL_PARAMS_HH #define DUMUX_EXGRIDS_INJECTION_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/io/gnuplotinterface.hh> @@ -41,13 +41,13 @@ namespace Dumux { * which uses the isothermal two-phase two-component * fully implicit model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class InjectionSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, InjectionSpatialParams<GridGeometry, Scalar>> { - using ThisType = InjectionSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = InjectionSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; // get the dimensions of the simulation domain from GridView static const int dimWorld = GridView::dimensionworld; @@ -63,10 +63,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - InjectionSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , aquitardPcKrSwCurve_("SpatialParams.Aquitard") , aquiferPcKrSwCurve_("SpatialParams.Aquifer") { @@ -113,10 +113,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); } /*! @@ -129,6 +129,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::H2OIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 273.15 + 30; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/exercise-mainfile/1pproblem.hh b/exercises/exercise-mainfile/1pproblem.hh index 81c18c9d..3e03c831 100644 --- a/exercises/exercise-mainfile/1pproblem.hh +++ b/exercises/exercise-mainfile/1pproblem.hh @@ -45,15 +45,15 @@ class OnePTestProblem : public PorousMediumFlowProblem<TypeTag> using Element = typename GridView::template Codim<0>::Entity; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; public: - OnePTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { FluidSystem::Component::init(/*tempMin=*/272.15, /*tempMax=*/294.15, @@ -105,17 +105,6 @@ public: return PrimaryVariables(1.0e5); } - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem. - * - * This is not specific to the discretization. By default it just - * throws an exception so it must be overloaded by the problem if - * no energy equation is used. - */ - Scalar temperature() const - { - return 283.15; // 10°C - } }; } // end namespace Dumux diff --git a/exercises/exercise-mainfile/1pspatialparams.hh b/exercises/exercise-mainfile/1pspatialparams.hh index a7df1fd5..09d19d2a 100644 --- a/exercises/exercise-mainfile/1pspatialparams.hh +++ b/exercises/exercise-mainfile/1pspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH #define DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv1p.hh> +#include <dumux/porousmediumflow/fvspatialparams1p.hh> namespace Dumux { @@ -33,23 +33,23 @@ namespace Dumux { * \brief The spatial parameters class for the test problem using the * compressible 1p model */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class OnePTestSpatialParams -: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePTestSpatialParams<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 = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>>; + using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePTestSpatialParams<GridGeometry, Scalar>>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: using PermeabilityType = Scalar; - OnePTestSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + OnePTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { permeability_ = getParam<Scalar>("SpatialParams.Permeability"); permeabilityLens_ = getParam<Scalar>("SpatialParams.PermeabilityLens"); @@ -85,6 +85,15 @@ public: Scalar porosityAtPos(const GlobalPosition& globalPos) const { return 0.4; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + private: bool isInLens_(const GlobalPosition &globalPos) const { diff --git a/exercises/exercise-mainfile/exercise1pamain.cc b/exercises/exercise-mainfile/exercise1pamain.cc index d3b3b5d5..0d749a91 100644 --- a/exercises/exercise-mainfile/exercise1pamain.cc +++ b/exercises/exercise-mainfile/exercise1pamain.cc @@ -81,21 +81,20 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // intialize the vtk output module @@ -113,7 +112,7 @@ int main(int argc, char** argv) // the assembler for stationary problems using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables); // the linear solver using LinearSolver = ILU0BiCGSTABBackend; diff --git a/exercises/exercise-mainfile/exercise1pbmain.cc b/exercises/exercise-mainfile/exercise1pbmain.cc index eadf97ac..47db200f 100644 --- a/exercises/exercise-mainfile/exercise1pbmain.cc +++ b/exercises/exercise-mainfile/exercise1pbmain.cc @@ -82,21 +82,20 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // intialize the vtk output module @@ -110,7 +109,7 @@ int main(int argc, char** argv) Dune::Timer timer; // the assembler for stationary problems using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables); // the linear solver using LinearSolver = ILU0BiCGSTABBackend; diff --git a/exercises/exercise-mainfile/exercise1pcmain.cc b/exercises/exercise-mainfile/exercise1pcmain.cc index 003677cb..44203d74 100644 --- a/exercises/exercise-mainfile/exercise1pcmain.cc +++ b/exercises/exercise-mainfile/exercise1pcmain.cc @@ -82,23 +82,22 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // intialize the vtk output module @@ -121,7 +120,7 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver using LinearSolver = ILU0BiCGSTABBackend; diff --git a/exercises/exercise-properties/main.cc b/exercises/exercise-properties/main.cc index 2f4b3774..4195142f 100644 --- a/exercises/exercise-properties/main.cc +++ b/exercises/exercise-properties/main.cc @@ -112,13 +112,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -128,7 +127,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -151,11 +150,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/exercise-properties/problem.hh b/exercises/exercise-properties/problem.hh index 655789eb..e0c15fd8 100644 --- a/exercises/exercise-properties/problem.hh +++ b/exercises/exercise-properties/problem.hh @@ -43,7 +43,7 @@ class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag> using Scalar = GetPropType<TypeTag, Properties::Scalar>; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -57,8 +57,8 @@ class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag> }; public: - TwoPTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) {} + TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) {} /*! * \brief Specifies which kind of boundary condition should be @@ -89,7 +89,7 @@ public: { PrimaryVariables values; GetPropType<TypeTag, Properties::FluidState> fluidState; - fluidState.setTemperature(temperature()); + fluidState.setTemperature(this->spatialParams().temperatureAtPos(globalPos)); fluidState.setPressure(waterPhaseIdx, /*pressure=*/1e5); fluidState.setPressure(dnaplPhaseIdx, /*pressure=*/1e5); @@ -140,7 +140,7 @@ public: { PrimaryVariables values; GetPropType<TypeTag, Properties::FluidState> fluidState; - fluidState.setTemperature(temperature()); + fluidState.setTemperature(this->spatialParams().temperatureAtPos(globalPos)); fluidState.setPressure(waterPhaseIdx, /*pressure=*/1e5); fluidState.setPressure(dnaplPhaseIdx, /*pressure=*/1e5); @@ -154,18 +154,6 @@ public: return values; } - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem. - * - * This is not specific to the discretization. By default it just - * throws an exception so it must be overloaded by the problem if - * no energy equation is used. - */ - Scalar temperature() const - { - return 293.15; // 10°C - } - private: bool onLeftBoundary_(const GlobalPosition &globalPos) const { diff --git a/exercises/exercise-properties/properties.hh b/exercises/exercise-properties/properties.hh index d8beb946..7b818f39 100644 --- a/exercises/exercise-properties/properties.hh +++ b/exercises/exercise-properties/properties.hh @@ -78,10 +78,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::TwoPIncompressible> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = TwoPTestSpatialParams<FVGridGeometry, Scalar>; + using type = TwoPTestSpatialParams<GridGeometry, Scalar>; }; } // end namespace Dumux::Properties diff --git a/exercises/exercise-properties/spatialparams.hh b/exercises/exercise-properties/spatialparams.hh index 90af3c6f..045c4f98 100644 --- a/exercises/exercise-properties/spatialparams.hh +++ b/exercises/exercise-properties/spatialparams.hh @@ -23,7 +23,7 @@ #ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH #define DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> namespace Dumux { @@ -32,16 +32,16 @@ namespace Dumux { * \ingroup TwoPTests * \brief The spatial params for the incompressible 2p test */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class TwoPTestSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, TwoPTestSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, TwoPTestSpatialParams<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 ThisType = TwoPTestSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; + using ThisType = TwoPTestSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -51,8 +51,8 @@ class TwoPTestSpatialParams public: using PermeabilityType = Scalar; - TwoPTestSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + TwoPTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , lensPcKrSwCurve_("SpatialParams.Lens") , outerPcKrSwCurve_("SpatialParams.OuterDomain") { @@ -114,6 +114,15 @@ public: return FluidSystem::phase0Idx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 293.15; + } + private: bool isInLens_(const GlobalPosition &globalPos) const { diff --git a/exercises/exercise-runtimeparams/main.cc b/exercises/exercise-runtimeparams/main.cc index c16c2bd6..b8038770 100644 --- a/exercises/exercise-runtimeparams/main.cc +++ b/exercises/exercise-runtimeparams/main.cc @@ -82,13 +82,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -98,7 +97,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -123,11 +122,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/exercise-runtimeparams/problem.hh b/exercises/exercise-runtimeparams/problem.hh index f5ebbea1..54a1ddf2 100644 --- a/exercises/exercise-runtimeparams/problem.hh +++ b/exercises/exercise-runtimeparams/problem.hh @@ -62,7 +62,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,8 +72,8 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - InjectionProblem2P(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionProblem2P(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, @@ -114,14 +114,6 @@ public: std::string name() const { return name_+"-2p"; } - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { - return 273.15 + 30; // [K] - } - // \} /*! @@ -204,7 +196,7 @@ public: PrimaryVariables values(0.0); // get the water density at atmospheric conditions - const Scalar densityW = FluidSystem::H2O::liquidDensity(temperature(), 1.0e5); + const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative diff --git a/exercises/exercise-runtimeparams/properties.hh b/exercises/exercise-runtimeparams/properties.hh index 6b3f3110..5cb1c0bc 100644 --- a/exercises/exercise-runtimeparams/properties.hh +++ b/exercises/exercise-runtimeparams/properties.hh @@ -56,10 +56,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2p> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/exercise-runtimeparams/spatialparams.hh b/exercises/exercise-runtimeparams/spatialparams.hh index a6b67613..e92f90b7 100644 --- a/exercises/exercise-runtimeparams/spatialparams.hh +++ b/exercises/exercise-runtimeparams/spatialparams.hh @@ -27,7 +27,7 @@ #ifndef DUMUX_EXRUNTIMEPARAMS_INJECTION_SPATIAL_PARAMS_HH #define DUMUX_EXRUNTIMEPARAMS_INJECTION_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/io/gnuplotinterface.hh> @@ -41,13 +41,13 @@ namespace Dumux { * which uses the isothermal two-phase two-component * fully implicit model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class InjectionSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, InjectionSpatialParams<GridGeometry, Scalar>> { - using ThisType = InjectionSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = InjectionSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; // get the dimensions of the simulation domain from GridView static const int dimWorld = GridView::dimensionworld; @@ -63,10 +63,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - InjectionSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , aquitardPcKrSwCurve_("SpatialParams.Aquitard") , aquiferPcKrSwCurve_("SpatialParams.Aquifer") { @@ -113,10 +113,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); } /*! @@ -129,6 +129,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::H2OIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 273.15 + 30; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/solution/exercise-basic/2pnimain.cc b/exercises/solution/exercise-basic/2pnimain.cc index df321e50..671dc6a2 100644 --- a/exercises/solution/exercise-basic/2pnimain.cc +++ b/exercises/solution/exercise-basic/2pnimain.cc @@ -82,13 +82,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -98,7 +97,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -121,11 +120,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/solution/exercise-basic/injection2pniproblem.hh b/exercises/solution/exercise-basic/injection2pniproblem.hh index 79d398d6..4d387896 100644 --- a/exercises/solution/exercise-basic/injection2pniproblem.hh +++ b/exercises/solution/exercise-basic/injection2pniproblem.hh @@ -61,7 +61,7 @@ class Injection2PNIProblem : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -71,8 +71,8 @@ class Injection2PNIProblem : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - Injection2PNIProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + Injection2PNIProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, diff --git a/exercises/solution/exercise-basic/properties2pni.hh b/exercises/solution/exercise-basic/properties2pni.hh index dd6f0375..4f367702 100644 --- a/exercises/solution/exercise-basic/properties2pni.hh +++ b/exercises/solution/exercise-basic/properties2pni.hh @@ -55,10 +55,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2pNITypeTag> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/solution/exercise-basic/spatialparams.hh b/exercises/solution/exercise-basic/spatialparams.hh index b6c1e80d..a03c6ccb 100644 --- a/exercises/solution/exercise-basic/spatialparams.hh +++ b/exercises/solution/exercise-basic/spatialparams.hh @@ -27,7 +27,7 @@ #ifndef DUMUX_EX_BASIC_SPATIAL_PARAMS_HH #define DUMUX_EX_BASIC_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/io/gnuplotinterface.hh> @@ -41,13 +41,13 @@ namespace Dumux { * which uses the isothermal two-phase two-component * fully implicit model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class InjectionSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, InjectionSpatialParams<GridGeometry, Scalar>> { - using ThisType = InjectionSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = InjectionSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; // get the dimensions of the simulation domain from GridView static const int dimWorld = GridView::dimensionworld; @@ -63,10 +63,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - InjectionSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , aquitardPcKrSwCurve_("SpatialParams.Aquitard") , aquiferPcKrSwCurve_("SpatialParams.Aquifer") { @@ -112,10 +112,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); } /*! diff --git a/exercises/solution/exercise-biomineralization/biominproblem.hh b/exercises/solution/exercise-biomineralization/biominproblem.hh index 9eddf020..a51759ce 100644 --- a/exercises/solution/exercise-biomineralization/biominproblem.hh +++ b/exercises/solution/exercise-biomineralization/biominproblem.hh @@ -52,7 +52,7 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; // Grid dimension @@ -98,11 +98,11 @@ class BioMinProblem : public PorousMediumFlowProblem<TypeTag> /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ public: - BioMinProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + BioMinProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { name_ = getParam<std::string>("Problem.Name"); //initial values @@ -117,9 +117,9 @@ public: concCa_ = getParam<Scalar>("Injection.ConcCa"); concUrea_ = getParam<Scalar>("Injection.ConcUrea"); - unsigned int codim = GetPropType<TypeTag, Properties::GridGeometry>::discMethod == DiscretizationMethod::box ? dim : 0; - Kxx_.resize(fvGridGeometry->gridView().size(codim)); - Kyy_.resize(fvGridGeometry->gridView().size(codim)); + unsigned int codim = GetPropType<TypeTag, Properties::GridGeometry>::discMethod == DiscretizationMethods::box ? dim : 0; + Kxx_.resize(gridGeometry->gridView().size(codim)); + Kyy_.resize(gridGeometry->gridView().size(codim)); //initialize the fluidsystem FluidSystem::init(/*startTemp=*/288, @@ -147,16 +147,6 @@ public: const std::string name() const { return name_; } - /*! - * \brief Returns the temperature within the domain. - * - * This problem assumes a temperature of 300 degrees Kelvin. - */ - Scalar temperature() const - { - return 300; // [K] - } - // \} /*! diff --git a/exercises/solution/exercise-biomineralization/biominspatialparams.hh b/exercises/solution/exercise-biomineralization/biominspatialparams.hh index fed4a8d6..a2eb8e65 100644 --- a/exercises/solution/exercise-biomineralization/biominspatialparams.hh +++ b/exercises/solution/exercise-biomineralization/biominspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_BIOMIN_SPATIAL_PARAMETERS_HH #define DUMUX_BIOMIN_SPATIAL_PARAMETERS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/linearmaterial.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/material/fluidmatrixinteractions/porosityprecipitation.hh> @@ -38,15 +38,15 @@ namespace Dumux { * \brief Definition of the spatial parameters for the biomineralisation problem * with geostatistically distributed initial permeability. */ -template<class FVGridGeometry, class Scalar, int numFluidComps, int numActiveSolidComps> +template<class GridGeometry, class Scalar, int numFluidComps, int numActiveSolidComps> class BioMinSpatialparams -: public FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, BioMinSpatialparams<GridGeometry, Scalar, numFluidComps, numActiveSolidComps>> { - using FVElementGeometry = typename FVGridGeometry::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, BioMinSpatialparams<FVGridGeometry, Scalar, numFluidComps, numActiveSolidComps>>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, BioMinSpatialparams<GridGeometry, Scalar, numFluidComps, numActiveSolidComps>>; - using GridView = typename FVGridGeometry::GridView; + using GridView = typename GridGeometry::GridView; using CoordScalar = typename GridView::ctype; enum { dimWorld=GridView::dimensionworld }; using Element = typename GridView::template Codim<0>::Entity; @@ -66,8 +66,8 @@ public: * * \param gridView The grid view */ - BioMinSpatialparams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + BioMinSpatialparams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , pcKrSwCurve_("SpatialParams") , aquitardPcKrSwCurve_("SpatialParams.Aquitard") { @@ -77,7 +77,7 @@ public: // set main diagonal entries of the permeability tensor to a value // setting to one value means: isotropic, homogeneous - + //! hard code specific params for aquitard layer aquitardPorosity_ = 0.1; aquitardPermeability_ = 1e-15; @@ -119,22 +119,22 @@ public: * * \f[referencePorosity = 2 \cdot initialPorosity - evaluatePorosity() \f] * - * \param fvGridGeometry The fvGridGeometry + * \param gridGeometry The gridGeometry * \param sol The (initial) solution vector */ template<class SolutionVector> - void computeReferencePorosity(const FVGridGeometry& fvGridGeometry, + void computeReferencePorosity(const GridGeometry& gridGeometry, const SolutionVector& sol) { - referencePorosity_.resize(fvGridGeometry.gridView().size(0)); - for (const auto& element : elements(fvGridGeometry.gridView())) + referencePorosity_.resize(gridGeometry.gridView().size(0)); + for (const auto& element : elements(gridGeometry.gridView())) { - auto fvGeometry = localView(fvGridGeometry); + auto fvGeometry = localView(gridGeometry); fvGeometry.bindElement(element); const auto eIdx = this->gridGeometry().elementMapper().index(element); - auto elemSol = elementSolution(element, sol, fvGridGeometry); + auto elemSol = elementSolution(element, sol, gridGeometry); referencePorosity_[eIdx].resize(fvGeometry.numScv()); for (const auto& scv : scvs(fvGeometry)) { @@ -191,22 +191,22 @@ public: * * \f[referencePermeability = initialPermeability^2 / evaluatePermeability() \f] * - * \param fvGridGeometry The fvGridGeometry + * \param gridGeometry The gridGeometry * \param sol The (initial) solution vector */ template<class SolutionVector> - void computeReferencePermeability(const FVGridGeometry& fvGridGeometry, + void computeReferencePermeability(const GridGeometry& gridGeometry, const SolutionVector& sol) { - referencePermeability_.resize(fvGridGeometry.gridView().size(0)); - for (const auto& element : elements(fvGridGeometry.gridView())) + referencePermeability_.resize(gridGeometry.gridView().size(0)); + for (const auto& element : elements(gridGeometry.gridView())) { - auto fvGeometry = localView(fvGridGeometry); + auto fvGeometry = localView(gridGeometry); fvGeometry.bindElement(element); const auto eIdx = this->gridGeometry().elementMapper().index(element); - auto elemSol = elementSolution(element, sol, fvGridGeometry); + auto elemSol = elementSolution(element, sol, gridGeometry); referencePermeability_[eIdx].resize(fvGeometry.numScv()); for (const auto& scv : scvs(fvGeometry)) { @@ -249,10 +249,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(pcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(pcKrSwCurve_); } // define which phase is to be considered as the wetting phase @@ -260,6 +260,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::liquidPhaseIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 300; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/solution/exercise-biomineralization/main.cc b/exercises/solution/exercise-biomineralization/main.cc index 9aa45302..dcef5a0e 100644 --- a/exercises/solution/exercise-biomineralization/main.cc +++ b/exercises/solution/exercise-biomineralization/main.cc @@ -83,27 +83,26 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; // initialize the spatialParams separately to compute the referencePorosity and referencePermeability - problem->spatialParams().computeReferencePorosity(*fvGridGeometry, x); - problem->spatialParams().computeReferencePermeability(*fvGridGeometry, x); + problem->spatialParams().computeReferencePorosity(*gridGeometry, x); + problem->spatialParams().computeReferencePermeability(*gridGeometry, x); // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -130,11 +129,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh index ec47a18a..4b552abd 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproblem.hh @@ -55,14 +55,14 @@ class ExerciseFluidsystemProblemTwoPTwoC : public PorousMediumFlowProblem<TypeTa using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; public: - ExerciseFluidsystemProblemTwoPTwoC(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + ExerciseFluidsystemProblemTwoPTwoC(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , eps_(3e-6) { // initialize the fluid system @@ -72,17 +72,6 @@ public: depthBOR_ = this->gridGeometry().bBoxMax()[dimWorld-1]; } - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { return 283.15; } - /*! * \name Boundary conditions */ diff --git a/exercises/solution/exercise-fluidsystem/2p2cproperties.hh b/exercises/solution/exercise-fluidsystem/2p2cproperties.hh index e39bf9b3..18e45d9c 100644 --- a/exercises/solution/exercise-fluidsystem/2p2cproperties.hh +++ b/exercises/solution/exercise-fluidsystem/2p2cproperties.hh @@ -59,10 +59,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::ExerciseFluidsystemTwoPTwoC> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; + using type = ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>; }; // Set grid and the grid creator to be used diff --git a/exercises/solution/exercise-fluidsystem/2pproblem.hh b/exercises/solution/exercise-fluidsystem/2pproblem.hh index 5afaf6f2..3242e7b2 100644 --- a/exercises/solution/exercise-fluidsystem/2pproblem.hh +++ b/exercises/solution/exercise-fluidsystem/2pproblem.hh @@ -61,7 +61,7 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using FluidState = GetPropType<TypeTag, Properties::FluidState>; @@ -75,8 +75,8 @@ class ExerciseFluidsystemProblemTwoP : public PorousMediumFlowProblem<TypeTag> }; public: - ExerciseFluidsystemProblemTwoP(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + ExerciseFluidsystemProblemTwoP(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , eps_(3e-6) { // initialize the tables for the water properties @@ -96,17 +96,6 @@ public: plotDensity_(); } - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { return 283.15; } - /*! * \name Boundary conditions */ @@ -223,7 +212,7 @@ private: void plotDensity_() { FluidState fluidState; - fluidState.setTemperature(temperature()); + fluidState.setTemperature(283.15); int numberOfPoints = 100; Scalar xMin = 1e4; Scalar xMax = 1e7; diff --git a/exercises/solution/exercise-fluidsystem/2pproperties.hh b/exercises/solution/exercise-fluidsystem/2pproperties.hh index 66aaf11b..02626300 100644 --- a/exercises/solution/exercise-fluidsystem/2pproperties.hh +++ b/exercises/solution/exercise-fluidsystem/2pproperties.hh @@ -66,10 +66,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::ExerciseFluidsystemTwoP> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; + using type = ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>; }; // Set grid to be used diff --git a/exercises/solution/exercise-fluidsystem/main.cc b/exercises/solution/exercise-fluidsystem/main.cc index 60058a58..4fc27192 100644 --- a/exercises/solution/exercise-fluidsystem/main.cc +++ b/exercises/solution/exercise-fluidsystem/main.cc @@ -88,23 +88,22 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); problem->applyInitialSolution(x); auto xOld = x; // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -125,11 +124,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric, /*implicit?*/true>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/solution/exercise-fluidsystem/spatialparams.hh b/exercises/solution/exercise-fluidsystem/spatialparams.hh index 48f87a50..5949547b 100644 --- a/exercises/solution/exercise-fluidsystem/spatialparams.hh +++ b/exercises/solution/exercise-fluidsystem/spatialparams.hh @@ -26,7 +26,7 @@ #define DUMUX_EXERCISE_FLUIDSYSTEM_SPATIAL_PARAMS_HH // include parent spatialparameters -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> //inlclude fluid matrix interaction relationship #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> @@ -40,13 +40,13 @@ namespace Dumux { * \brief The spatial parameters for the exercise-fluidsystem problem * which uses the two-phase and two-phase two-component box model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class ExerciseFluidsystemSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>> { - using ThisType = ExerciseFluidsystemSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = ExerciseFluidsystemSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; static constexpr int dim = GridView::dimension; static constexpr int dimWorld = GridView::dimensionworld; @@ -62,10 +62,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - ExerciseFluidsystemSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + ExerciseFluidsystemSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , K_(0) , KLens_(0) , pcKrSwCurve_("SpatialParams") @@ -110,10 +110,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInLens(globalPos)) - return makeFluidMatrixInteraction(pcKrSwCurve_); - return makeFluidMatrixInteraction(lensPcKrSwCurve_); + return makeFluidMatrixInteraction(pcKrSwCurve_); + return makeFluidMatrixInteraction(lensPcKrSwCurve_); } /*! @@ -147,6 +147,15 @@ public: (x < 50 + eps_ && x > 30 - eps_ && y < 30 + eps_ && y > 15 - eps_); } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/solution/exercise-fractures/fractureproblem.hh b/exercises/solution/exercise-fractures/fractureproblem.hh index 4422aa68..ba3dbd70 100644 --- a/exercises/solution/exercise-fractures/fractureproblem.hh +++ b/exercises/solution/exercise-fractures/fractureproblem.hh @@ -53,10 +53,10 @@ class FractureSubProblem : public PorousMediumFlowProblem<TypeTag> using ElementVolumeVariables = typename GridVariables::GridVolumeVariables::LocalView; using Scalar = typename GridVariables::Scalar; - using FVGridGeometry = typename GridVariables::GridGeometry; - using FVElementGeometry = typename FVGridGeometry::LocalView; - using SubControlVolume = typename FVGridGeometry::SubControlVolume; - using GridView = typename FVGridGeometry::GridView; + using GridGeometry = typename GridVariables::GridGeometry; + using FVElementGeometry = typename GridGeometry::LocalView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -70,10 +70,10 @@ class FractureSubProblem : public PorousMediumFlowProblem<TypeTag> public: //! The constructor - FractureSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + FractureSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<typename ParentType::SpatialParams> spatialParams, const std::string& paramGroup) - : ParentType(fvGridGeometry, spatialParams, paramGroup) + : ParentType(gridGeometry, spatialParams, paramGroup) , aperture_(getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Aperture")) , isExercisePartA_(getParamFromGroup<bool>(paramGroup, "Problem.IsExercisePartA")) , isExercisePartB_(getParamFromGroup<bool>(paramGroup, "Problem.IsExercisePartB")) @@ -119,15 +119,6 @@ public: return source; } - //! Set the aperture as extrusion factor. - Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const - { - // We treat the fractures as lower-dimensional in the grid, - // but we have to give it the aperture as extrusion factor - // such that the dimensions are correct in the end. - return aperture_; - } - //! evaluates the Dirichlet boundary condition for a given position PrimaryVariables dirichletAtPos(const GlobalPosition& globalPos) const { return initialAtPos(globalPos); } @@ -148,10 +139,6 @@ public: return values; } - //! returns the temperature in \f$\mathrm{[K]}\f$ in the domain - Scalar temperature() const - { return 283.15; /*10°*/ } - //! sets the pointer to the coupling manager. void setCouplingManager(std::shared_ptr<CouplingManager> cm) { couplingManagerPtr_ = cm; } diff --git a/exercises/solution/exercise-fractures/fracturespatialparams.hh b/exercises/solution/exercise-fractures/fracturespatialparams.hh index 713c1682..93c87d3e 100644 --- a/exercises/solution/exercise-fractures/fracturespatialparams.hh +++ b/exercises/solution/exercise-fractures/fracturespatialparams.hh @@ -29,7 +29,7 @@ #include <dumux/io/grid/griddata.hh> -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> namespace Dumux { @@ -40,15 +40,15 @@ namespace Dumux { * \ingroup TwoPTests * \brief The spatial params the two-phase facet coupling test */ -template< class FVGridGeometry, class Scalar > +template< class GridGeometry, class Scalar > class FractureSpatialParams -: public FVSpatialParams< FVGridGeometry, Scalar, FractureSpatialParams<FVGridGeometry, Scalar> > +: public FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, FractureSpatialParams<GridGeometry, Scalar> > { - using ThisType = FractureSpatialParams< FVGridGeometry, Scalar >; - using ParentType = FVSpatialParams< FVGridGeometry, Scalar, ThisType >; + using ThisType = FractureSpatialParams< GridGeometry, Scalar >; + using ParentType = FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, ThisType >; - using SubControlVolume = typename FVGridGeometry::SubControlVolume; - using GridView = typename FVGridGeometry::GridView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using GridView = typename GridGeometry::GridView; using Grid = typename GridView::Grid; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -65,10 +65,10 @@ public: using PermeabilityType = Scalar; //! the constructor - FractureSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + FractureSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<const Dumux::GridData<Grid>> gridData, const std::string& paramGroup) - : ParentType(fvGridGeometry) + : ParentType(gridGeometry) , gridDataPtr_(gridData) , isExercisePartA_(getParamFromGroup<bool>(paramGroup, "Problem.IsExercisePartA")) , isExercisePartB_(getParamFromGroup<bool>(paramGroup, "Problem.IsExercisePartB")) @@ -80,6 +80,7 @@ public: porosityBarrier_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.PorosityBarrier"); permeability_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Permeability"); permeabilityBarrier_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.PermeabilityBarrier"); + aperture_ = getParamFromGroup<Scalar>(paramGroup, "SpatialParams.Aperture"); } //! Function for defining the (intrinsic) permeability \f$[m^2]\f$. @@ -169,6 +170,24 @@ public: return FluidSystem::phase0Idx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + + //! Set the aperture as extrusion factor. + Scalar extrusionFactorAtPos(const GlobalPosition& globalPos) const + { + // We treat the fractures as lower-dimensional in the grid, + // but we have to give it the aperture as extrusion factor + // such that the dimensions are correct in the end. + return aperture_; + } + //! returns the domain marker for an element int getElementDomainMarker(const Element& element) const { return gridDataPtr_->getElementDomainMarker(element); } @@ -186,6 +205,7 @@ private: Scalar porosity_; Scalar porosityBarrier_; + Scalar aperture_; PermeabilityType permeability_; PermeabilityType permeabilityBarrier_; }; diff --git a/exercises/solution/exercise-fractures/main.cc b/exercises/solution/exercise-fractures/main.cc index f3d7e80a..c3e74540 100644 --- a/exercises/solution/exercise-fractures/main.cc +++ b/exercises/solution/exercise-fractures/main.cc @@ -50,10 +50,10 @@ // reuse them again in the main function with only one single definition of them here using MatrixTypeTag = Dumux::Properties::TTag::MatrixProblem; using FractureTypeTag = Dumux::Properties::TTag::FractureProblem; -using MatrixFVGridGeometry = Dumux::GetPropType<MatrixTypeTag, Dumux::Properties::GridGeometry>; -using FractureFVGridGeometry = Dumux::GetPropType<FractureTypeTag, Dumux::Properties::GridGeometry>; +using MatrixGridGeometry = Dumux::GetPropType<MatrixTypeTag, Dumux::Properties::GridGeometry>; +using FractureGridGeometry = Dumux::GetPropType<FractureTypeTag, Dumux::Properties::GridGeometry>; using TheMultiDomainTraits = Dumux::MultiDomainTraits<MatrixTypeTag, FractureTypeTag>; -using TheCouplingMapper = Dumux::FacetCouplingMapper<MatrixFVGridGeometry, FractureFVGridGeometry>; +using TheCouplingMapper = Dumux::FacetCouplingMapper<MatrixGridGeometry, FractureGridGeometry>; using TheCouplingManager = Dumux::FacetCouplingManager<TheMultiDomainTraits, TheCouplingMapper>; // set the coupling manager property in the sub-problems @@ -111,10 +111,8 @@ int main(int argc, char** argv) const auto& fractureGridView = gridManager.template grid<fractureGridId>().leafGridView(); // create the finite volume grid geometries - auto matrixFvGridGeometry = std::make_shared<MatrixFVGridGeometry>(matrixGridView); - auto fractureFvGridGeometry = std::make_shared<FractureFVGridGeometry>(fractureGridView); - matrixFvGridGeometry->update(); - fractureFvGridGeometry->update(); + auto matrixFvGridGeometry = std::make_shared<MatrixGridGeometry>(matrixGridView); + auto fractureFvGridGeometry = std::make_shared<FractureGridGeometry>(fractureGridView); // the problems (boundary/initial conditions etc) using MatrixProblem = GetPropType<MatrixTypeTag, Properties::Problem>; diff --git a/exercises/solution/exercise-fractures/matrixproblem.hh b/exercises/solution/exercise-fractures/matrixproblem.hh index 58f8e6f8..a4c5eda8 100644 --- a/exercises/solution/exercise-fractures/matrixproblem.hh +++ b/exercises/solution/exercise-fractures/matrixproblem.hh @@ -56,11 +56,11 @@ class MatrixSubProblem : public PorousMediumFlowProblem<TypeTag> using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; using Scalar = typename GridVariables::Scalar; - using FVGridGeometry = typename GridVariables::GridGeometry; - using FVElementGeometry = typename FVGridGeometry::LocalView; - using SubControlVolume = typename FVGridGeometry::SubControlVolume; - using SubControlVolumeFace = typename FVGridGeometry::SubControlVolumeFace; - using GridView = typename FVGridGeometry::GridView; + using GridGeometry = typename GridVariables::GridGeometry; + using FVElementGeometry = typename GridGeometry::LocalView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -74,10 +74,10 @@ class MatrixSubProblem : public PorousMediumFlowProblem<TypeTag> public: //! The constructor - MatrixSubProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + MatrixSubProblem(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<typename ParentType::SpatialParams> spatialParams, const std::string& paramGroup = "") - : ParentType(fvGridGeometry, spatialParams, paramGroup) + : ParentType(gridGeometry, spatialParams, paramGroup) , boundaryOverPressure_(getParamFromGroup<Scalar>(paramGroup, "Problem.BoundaryOverPressure")) , boundarySaturation_(getParamFromGroup<Scalar>(paramGroup, "Problem.BoundarySaturation")) , isExercisePartA_(getParamFromGroup<bool>(paramGroup, "Problem.IsExercisePartA")) @@ -209,10 +209,6 @@ public: return values; } - //! returns the temperature in \f$\mathrm{[K]}\f$ in the domain - Scalar temperature() const - { return 283.15; /*10°*/ } - //! sets the pointer to the coupling manager. void setCouplingManager(std::shared_ptr<CouplingManager> cm) { couplingManagerPtr_ = cm; } diff --git a/exercises/solution/exercise-fractures/matrixspatialparams.hh b/exercises/solution/exercise-fractures/matrixspatialparams.hh index 1f049007..49a689ee 100644 --- a/exercises/solution/exercise-fractures/matrixspatialparams.hh +++ b/exercises/solution/exercise-fractures/matrixspatialparams.hh @@ -29,7 +29,7 @@ #include <dumux/io/grid/griddata.hh> -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> namespace Dumux { @@ -40,14 +40,14 @@ namespace Dumux { * \ingroup TwoPTests * \brief The spatial params the two-phase facet coupling test */ -template< class FVGridGeometry, class Scalar > +template< class GridGeometry, class Scalar > class MatrixSpatialParams -: public FVSpatialParams< FVGridGeometry, Scalar, MatrixSpatialParams<FVGridGeometry, Scalar> > +: public FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, MatrixSpatialParams<GridGeometry, Scalar> > { - using ThisType = MatrixSpatialParams< FVGridGeometry, Scalar >; - using ParentType = FVSpatialParams< FVGridGeometry, Scalar, ThisType >; + using ThisType = MatrixSpatialParams< GridGeometry, Scalar >; + using ParentType = FVPorousMediumFlowSpatialParamsMP< GridGeometry, Scalar, ThisType >; - using GridView = typename FVGridGeometry::GridView; + using GridView = typename GridGeometry::GridView; using Grid = typename GridView::Grid; using Element = typename GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -60,10 +60,10 @@ public: using PermeabilityType = Scalar; //! the constructor - MatrixSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry, + MatrixSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry, std::shared_ptr<const Dumux::GridData<Grid>> gridData, const std::string& paramGroup) - : ParentType(fvGridGeometry) + : ParentType(gridGeometry) , gridDataPtr_(gridData) , pcKrSwCurve_("Matrix.SpatialParams") { @@ -84,8 +84,8 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { - return makeFluidMatrixInteraction(pcKrSwCurve_); + { + return makeFluidMatrixInteraction(pcKrSwCurve_); } //! Water is the wetting phase @@ -97,6 +97,15 @@ public: return FluidSystem::phase0Idx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + //! returns the domain marker for an element int getElementDomainMarker(const Element& element) const { return gridDataPtr_->getElementDomainMarker(element); } diff --git a/exercises/solution/exercise-grids/main.cc b/exercises/solution/exercise-grids/main.cc index 916d1e79..9d3e4d29 100644 --- a/exercises/solution/exercise-grids/main.cc +++ b/exercises/solution/exercise-grids/main.cc @@ -82,13 +82,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -98,7 +97,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -123,11 +122,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/solution/exercise-grids/problem.hh b/exercises/solution/exercise-grids/problem.hh index 368d246f..168ddc8a 100644 --- a/exercises/solution/exercise-grids/problem.hh +++ b/exercises/solution/exercise-grids/problem.hh @@ -62,7 +62,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,8 +72,8 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - InjectionProblem2P(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionProblem2P(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, @@ -106,14 +106,6 @@ public: std::string name() const { return name_+"-2p"; } - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { - return 273.15 + 30; // [K] - } - // \} /*! @@ -195,7 +187,7 @@ public: PrimaryVariables values(0.0); // get the water density at atmospheric conditions - const Scalar densityW = FluidSystem::H2O::liquidDensity(temperature(), 1.0e5); + const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative diff --git a/exercises/solution/exercise-grids/properties.hh b/exercises/solution/exercise-grids/properties.hh index 17872d5c..dc883b17 100644 --- a/exercises/solution/exercise-grids/properties.hh +++ b/exercises/solution/exercise-grids/properties.hh @@ -67,10 +67,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2p> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/solution/exercise-grids/spatialparams.hh b/exercises/solution/exercise-grids/spatialparams.hh index 433e3f6b..0160b1a6 100644 --- a/exercises/solution/exercise-grids/spatialparams.hh +++ b/exercises/solution/exercise-grids/spatialparams.hh @@ -27,7 +27,7 @@ #ifndef DUMUX_EXGRIDS_INJECTION_SPATIAL_PARAMS_HH #define DUMUX_EXGRIDS_INJECTION_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/io/gnuplotinterface.hh> @@ -41,13 +41,13 @@ namespace Dumux { * which uses the isothermal two-phase two-component * fully implicit model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class InjectionSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, InjectionSpatialParams<GridGeometry, Scalar>> { - using ThisType = InjectionSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = InjectionSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; // get the dimensions of the simulation domain from GridView static const int dimWorld = GridView::dimensionworld; @@ -63,10 +63,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - InjectionSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , aquitardPcKrSwCurve_("SpatialParams.Aquitard") , aquiferPcKrSwCurve_("SpatialParams.Aquifer") { @@ -113,10 +113,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); } /*! @@ -129,6 +129,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::H2OIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 273.15 + 30; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/exercises/solution/exercise-mainfile/1pproblem.hh b/exercises/solution/exercise-mainfile/1pproblem.hh index f5a5bdbb..4532e978 100644 --- a/exercises/solution/exercise-mainfile/1pproblem.hh +++ b/exercises/solution/exercise-mainfile/1pproblem.hh @@ -45,15 +45,15 @@ class OnePTestProblem : public PorousMediumFlowProblem<TypeTag> using Element = typename GridView::template Codim<0>::Entity; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; public: - OnePTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + OnePTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { FluidSystem::Component::init(/*tempMin=*/272.15, /*tempMax=*/294.15, @@ -104,18 +104,6 @@ public: { return PrimaryVariables(1.0e5); } - - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem. - * - * This is not specific to the discretization. By default it just - * throws an exception so it must be overloaded by the problem if - * no energy equation is used. - */ - Scalar temperature() const - { - return 283.15; // 10°C - } }; } // end namespace Dumux diff --git a/exercises/solution/exercise-mainfile/1pspatialparams.hh b/exercises/solution/exercise-mainfile/1pspatialparams.hh index a7df1fd5..09d19d2a 100644 --- a/exercises/solution/exercise-mainfile/1pspatialparams.hh +++ b/exercises/solution/exercise-mainfile/1pspatialparams.hh @@ -24,7 +24,7 @@ #ifndef DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH #define DUMUX_EX_MAINFILE_ONEP_TEST_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv1p.hh> +#include <dumux/porousmediumflow/fvspatialparams1p.hh> namespace Dumux { @@ -33,23 +33,23 @@ namespace Dumux { * \brief The spatial parameters class for the test problem using the * compressible 1p model */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class OnePTestSpatialParams -: public FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePTestSpatialParams<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 = FVSpatialParamsOneP<FVGridGeometry, Scalar, OnePTestSpatialParams<FVGridGeometry, Scalar>>; + using ParentType = FVPorousMediumFlowSpatialParamsOneP<GridGeometry, Scalar, OnePTestSpatialParams<GridGeometry, Scalar>>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: using PermeabilityType = Scalar; - OnePTestSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + OnePTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { permeability_ = getParam<Scalar>("SpatialParams.Permeability"); permeabilityLens_ = getParam<Scalar>("SpatialParams.PermeabilityLens"); @@ -85,6 +85,15 @@ public: Scalar porosityAtPos(const GlobalPosition& globalPos) const { return 0.4; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 283.15; + } + private: bool isInLens_(const GlobalPosition &globalPos) const { diff --git a/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc b/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc index fb8cb728..f320ccba 100644 --- a/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc +++ b/exercises/solution/exercise-mainfile/exercise1pa_solution_main.cc @@ -83,21 +83,20 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; - SolutionVector x(fvGridGeometry->numDofs()); + SolutionVector x(gridGeometry->numDofs()); // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // intialize the vtk output module @@ -115,7 +114,7 @@ int main(int argc, char** argv) // the assembler for stationary problems using Assembler = FVAssembler<TypeTag, DiffMethod::analytic>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables); // the linear solver using LinearSolver = ILU0BiCGSTABBackend; diff --git a/exercises/solution/exercise-properties/main.cc b/exercises/solution/exercise-properties/main.cc index b5616e68..ef218fe5 100644 --- a/exercises/solution/exercise-properties/main.cc +++ b/exercises/solution/exercise-properties/main.cc @@ -113,13 +113,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -129,7 +128,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -152,11 +151,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/solution/exercise-properties/problem.hh b/exercises/solution/exercise-properties/problem.hh index 62ba692a..c00acd02 100644 --- a/exercises/solution/exercise-properties/problem.hh +++ b/exercises/solution/exercise-properties/problem.hh @@ -44,7 +44,7 @@ class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag> using Scalar = GetPropType<TypeTag, Properties::Scalar>; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -58,8 +58,8 @@ class TwoPTestProblem : public PorousMediumFlowProblem<TypeTag> }; public: - TwoPTestProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) {} + TwoPTestProblem(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) {} /*! * \brief Specifies which kind of boundary condition should be @@ -90,7 +90,7 @@ public: { PrimaryVariables values; GetPropType<TypeTag, Properties::FluidState> fluidState; - fluidState.setTemperature(temperature()); + fluidState.setTemperature(this->spatialParams().temperatureAtPos(globalPos)); fluidState.setPressure(waterPhaseIdx, /*pressure=*/1e5); fluidState.setPressure(dnaplPhaseIdx, /*pressure=*/1e5); @@ -126,7 +126,7 @@ public: if (onInlet_(globalPos)) { using TCE = Components::Trichloroethene<Scalar>; - values[contiDNAPLEqIdx] = -0.04/TCE::liquidDensity(temperature(), /*pressure=*/1e5);// m/s + values[contiDNAPLEqIdx] = -0.04/TCE::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), /*pressure=*/1e5);// m/s } return values; @@ -143,7 +143,7 @@ public: { PrimaryVariables values; GetPropType<TypeTag, Properties::FluidState> fluidState; - fluidState.setTemperature(temperature()); + fluidState.setTemperature(this->spatialParams().temperatureAtPos(globalPos)); fluidState.setPressure(waterPhaseIdx, /*pressure=*/1e5); fluidState.setPressure(dnaplPhaseIdx, /*pressure=*/1e5); @@ -157,18 +157,6 @@ public: return values; } - /*! - * \brief Returns the temperature \f$\mathrm{[K]}\f$ for an isothermal problem. - * - * This is not specific to the discretization. By default it just - * throws an exception so it must be overloaded by the problem if - * no energy equation is used. - */ - Scalar temperature() const - { - return 293.15; // 10°C - } - private: bool onLeftBoundary_(const GlobalPosition &globalPos) const { diff --git a/exercises/solution/exercise-properties/properties.hh b/exercises/solution/exercise-properties/properties.hh index eed1a9fb..f4ea3272 100644 --- a/exercises/solution/exercise-properties/properties.hh +++ b/exercises/solution/exercise-properties/properties.hh @@ -75,10 +75,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::TwoPIncompressible> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = TwoPTestSpatialParams<FVGridGeometry, Scalar>; + using type = TwoPTestSpatialParams<GridGeometry, Scalar>; }; } // end namespace Dumux::Properties diff --git a/exercises/solution/exercise-properties/spatialparams.hh b/exercises/solution/exercise-properties/spatialparams.hh index 90af3c6f..045c4f98 100644 --- a/exercises/solution/exercise-properties/spatialparams.hh +++ b/exercises/solution/exercise-properties/spatialparams.hh @@ -23,7 +23,7 @@ #ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH #define DUMUX_INCOMPRESSIBLE_TWOP_TEST_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> namespace Dumux { @@ -32,16 +32,16 @@ namespace Dumux { * \ingroup TwoPTests * \brief The spatial params for the incompressible 2p test */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class TwoPTestSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, TwoPTestSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, TwoPTestSpatialParams<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 ThisType = TwoPTestSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; + using ThisType = TwoPTestSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; static constexpr int dimWorld = GridView::dimensionworld; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; @@ -51,8 +51,8 @@ class TwoPTestSpatialParams public: using PermeabilityType = Scalar; - TwoPTestSpatialParams(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + TwoPTestSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) , lensPcKrSwCurve_("SpatialParams.Lens") , outerPcKrSwCurve_("SpatialParams.OuterDomain") { @@ -114,6 +114,15 @@ public: return FluidSystem::phase0Idx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 293.15; + } + private: bool isInLens_(const GlobalPosition &globalPos) const { diff --git a/exercises/solution/exercise-runtimeparams/main.cc b/exercises/solution/exercise-runtimeparams/main.cc index c16c2bd6..b8038770 100644 --- a/exercises/solution/exercise-runtimeparams/main.cc +++ b/exercises/solution/exercise-runtimeparams/main.cc @@ -82,13 +82,12 @@ int main(int argc, char** argv) const auto& leafGridView = gridManager.grid().leafGridView(); // create the finite volume grid geometry - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; - auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView); - fvGridGeometry->update(); + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + auto gridGeometry = std::make_shared<GridGeometry>(leafGridView); // the problem (initial and boundary conditions) using Problem = GetPropType<TypeTag, Properties::Problem>; - auto problem = std::make_shared<Problem>(fvGridGeometry); + auto problem = std::make_shared<Problem>(gridGeometry); // the solution vector using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>; @@ -98,7 +97,7 @@ int main(int argc, char** argv) // the grid variables using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; - auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry); + auto gridVariables = std::make_shared<GridVariables>(problem, gridGeometry); gridVariables->init(x); // get some time loop parameters @@ -123,11 +122,11 @@ int main(int argc, char** argv) // the assembler with time loop for instationary problem using Assembler = FVAssembler<TypeTag, DiffMethod::numeric>; - auto assembler = std::make_shared<Assembler>(problem, fvGridGeometry, gridVariables, timeLoop, xOld); + auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld); // the linear solver - using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<FVGridGeometry>>; - auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper()); + using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>>; + auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper()); // the non-linear solver using NewtonSolver = Dumux::NewtonSolver<Assembler, LinearSolver>; diff --git a/exercises/solution/exercise-runtimeparams/problem.hh b/exercises/solution/exercise-runtimeparams/problem.hh index 78fae4c3..f5454f64 100644 --- a/exercises/solution/exercise-runtimeparams/problem.hh +++ b/exercises/solution/exercise-runtimeparams/problem.hh @@ -62,7 +62,7 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; using BoundaryTypes = Dumux::BoundaryTypes<GetPropType<TypeTag, Properties::ModelTraits>::numEq()>; - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; using NumEqVector = Dumux::NumEqVector<PrimaryVariables>; @@ -72,8 +72,8 @@ class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag> using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - InjectionProblem2P(std::shared_ptr<const FVGridGeometry> fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionProblem2P(std::shared_ptr<const GridGeometry> gridGeometry) + : ParentType(gridGeometry) { // initialize the tables of the fluid system FluidSystem::init(/*tempMin=*/273.15, @@ -115,14 +115,6 @@ public: std::string name() const { return name_+"-2p"; } - /*! - * \brief Returns the temperature \f$ K \f$ - */ - Scalar temperature() const - { - return 273.15 + 30; // [K] - } - // \} /*! @@ -204,7 +196,7 @@ public: PrimaryVariables values(0.0); // get the water density at atmospheric conditions - const Scalar densityW = FluidSystem::H2O::liquidDensity(temperature(), 1.0e5); + const Scalar densityW = FluidSystem::H2O::liquidDensity(this->spatialParams().temperatureAtPos(globalPos), 1.0e5); // assume an intially hydrostatic liquid pressure profile // note: we subtract rho_w*g*h because g is defined negative diff --git a/exercises/solution/exercise-runtimeparams/properties.hh b/exercises/solution/exercise-runtimeparams/properties.hh index 4c4524d8..3f7a2ae4 100644 --- a/exercises/solution/exercise-runtimeparams/properties.hh +++ b/exercises/solution/exercise-runtimeparams/properties.hh @@ -56,10 +56,10 @@ template<class TypeTag> struct SpatialParams<TypeTag, TTag::Injection2p> { private: - using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; public: - using type = InjectionSpatialParams<FVGridGeometry, Scalar>; + using type = InjectionSpatialParams<GridGeometry, Scalar>; }; // Set fluid configuration diff --git a/exercises/solution/exercise-runtimeparams/spatialparams.hh b/exercises/solution/exercise-runtimeparams/spatialparams.hh index 869a826b..ab72c284 100644 --- a/exercises/solution/exercise-runtimeparams/spatialparams.hh +++ b/exercises/solution/exercise-runtimeparams/spatialparams.hh @@ -27,7 +27,7 @@ #ifndef DUMUX_RUNTIMEPARAMS_INJECTION_SPATIAL_PARAMS_HH #define DUMUX_RUNTIMEPARAMS_INJECTION_SPATIAL_PARAMS_HH -#include <dumux/material/spatialparams/fv.hh> +#include <dumux/porousmediumflow/fvspatialparamsmp.hh> #include <dumux/material/fluidmatrixinteractions/2p/brookscorey.hh> #include <dumux/io/gnuplotinterface.hh> @@ -41,13 +41,13 @@ namespace Dumux { * which uses the isothermal two-phase two-component * fully implicit model. */ -template<class FVGridGeometry, class Scalar> +template<class GridGeometry, class Scalar> class InjectionSpatialParams -: public FVSpatialParams<FVGridGeometry, Scalar, InjectionSpatialParams<FVGridGeometry, Scalar>> +: public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, InjectionSpatialParams<GridGeometry, Scalar>> { - using ThisType = InjectionSpatialParams<FVGridGeometry, Scalar>; - using ParentType = FVSpatialParams<FVGridGeometry, Scalar, ThisType>; - using GridView = typename FVGridGeometry::GridView; + using ThisType = InjectionSpatialParams<GridGeometry, Scalar>; + using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; + using GridView = typename GridGeometry::GridView; // get the dimensions of the simulation domain from GridView static const int dimWorld = GridView::dimensionworld; @@ -63,10 +63,10 @@ public: /*! * \brief The constructor * - * \param fvGridGeometry The finite volume grid geometry + * \param gridGeometry The finite volume grid geometry */ - InjectionSpatialParams(std::shared_ptr<const FVGridGeometry>& fvGridGeometry) - : ParentType(fvGridGeometry) + InjectionSpatialParams(std::shared_ptr<const GridGeometry>& gridGeometry) + : ParentType(gridGeometry) , aquitardPcKrSwCurve_("SpatialParams.Aquitard") , aquiferPcKrSwCurve_("SpatialParams.Aquifer") { @@ -113,10 +113,10 @@ public: * \param globalPos The global coordinates for the given location */ auto fluidMatrixInteractionAtPos(const GlobalPosition& globalPos) const - { + { if (isInAquitard_(globalPos)) - return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); - return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); + return makeFluidMatrixInteraction(aquitardPcKrSwCurve_); + return makeFluidMatrixInteraction(aquiferPcKrSwCurve_); } /*! @@ -129,6 +129,15 @@ public: int wettingPhaseAtPos(const GlobalPosition& globalPos) const { return FluidSystem::H2OIdx; } + /*! + * \brief Returns the temperature at the domain at the given position + * \param globalPos The position in global coordinates where the temperature should be specified + */ + Scalar temperatureAtPos(const GlobalPosition& globalPos) const + { + return 273.15 + 30; + } + private: static constexpr Scalar eps_ = 1e-6; diff --git a/scripts/install.sh b/scripts/install.sh index 2ff22ae5..ca539cbd 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -98,7 +98,7 @@ done # dune-subgrid if [ ! -d "dune-subgrid" ]; then - git clone -b releases/$DUNE_VERSION https://git.imp.fu-berlin.de/agnumpde/dune-subgrid.git + git clone -b releases/$DUNE_VERSION https://gitlab.dune-project.org/extensions/dune-subgrid else echo "Skip cloning dune-subgrid because the folder already exists." git checkout releases/$DUNE_VERSION -- GitLab