diff --git a/exercises/solution/exercise-fractures/fractureproblem.hh b/exercises/solution/exercise-fractures/fractureproblem.hh index a0645b002071459aa8be60f59eee79ceea500f12..9bfe4312e3531fc94833db310a4297f254ba5b8d 100644 --- a/exercises/solution/exercise-fractures/fractureproblem.hh +++ b/exercises/solution/exercise-fractures/fractureproblem.hh @@ -26,59 +26,11 @@ #ifndef DUMUX_COURSE_FRACTURESEXERCISE_FRACTURE_PROBLEM_HH #define DUMUX_COURSE_FRACTURESEXERCISE_FRACTURE_PROBLEM_HH -// we use alu grid for the discretization of the fracture domain -// as this grid manager is able to represent network/surface grids -#include <dune/foamgrid/foamgrid.hh> - -// we want to simulate nitrogen gas transport in a water-saturated medium -#include <dumux/material/fluidsystems/h2on2.hh> - -// we use a cell-centered finite volume scheme with tpfa here -#include <dumux/discretization/cctpfa.hh> - -// include the base problem and the model we inherit from +// include the base problem and properties we inherit from #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/2p/model.hh> - -// the spatial parameters (permeabilities, material parameters etc.) -#include "fracturespatialparams.hh" +#include <dumux/common/properties.hh> namespace Dumux { -// forward declarations -template<class TypeTag> class FractureSubProblem; - -namespace Properties { - -// Create new type tag node -namespace TTag { -struct FractureProblem { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::FractureProblem> { using type = Dune::FoamGrid<1, 2>; }; - -// Set the problem type -template<class TypeTag> -struct Problem<TypeTag, TTag::FractureProblem> { using type = FractureSubProblem<TypeTag>; }; - -// set the spatial params -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::FractureProblem> -{ - using type = FractureSpatialParams< GetPropType<TypeTag, Properties::GridGeometry>, - GetPropType<TypeTag, Properties::Scalar> >; -}; - -// the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::FractureProblem> -{ - using type = Dumux::FluidSystems::H2ON2< GetPropType<TypeTag, Properties::Scalar>, - FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true> >; -}; - -} // end namespace Properties /*! * \ingroup MultiDomain @@ -216,4 +168,4 @@ private: } // end namespace Dumux -#endif +#endif // DUMUX_COURSE_FRACTURESEXERCISE_FRACTURE_PROBLEM_HH diff --git a/exercises/solution/exercise-fractures/main.cc b/exercises/solution/exercise-fractures/main.cc index cd8ba733eb26999d03b1fed1cba6f0f69ee89b85..c871fbee3c65d9228dd072b695a3714ef9d32271 100644 --- a/exercises/solution/exercise-fractures/main.cc +++ b/exercises/solution/exercise-fractures/main.cc @@ -25,10 +25,8 @@ #include <dune/common/parallel/mpihelper.hh> -// include the headers of the two sub-problems -// i.e. the problems for fractures and matrix -#include "matrixproblem.hh" -#include "fractureproblem.hh" +// include the properties header +#include "properties.hh" #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> diff --git a/exercises/solution/exercise-fractures/matrixproblem.hh b/exercises/solution/exercise-fractures/matrixproblem.hh index d0dad09c39f87b0f11704c04fe2c9bf062992772..f667626238bc600816c996cd52868022d289dba9 100644 --- a/exercises/solution/exercise-fractures/matrixproblem.hh +++ b/exercises/solution/exercise-fractures/matrixproblem.hh @@ -26,68 +26,16 @@ #ifndef DUMUX_COURSE_FRACTURESEXERCISE_MATRIX_PROBLEM_HH #define DUMUX_COURSE_FRACTURESEXERCISE_MATRIX_PROBLEM_HH -// we use alu grid for the discretization of the matrix domain -#include <dune/alugrid/grid.hh> - // we need this in this test in order to define the domain // id of the fracture problem (see function interiorBoundaryTypes()) #include <dune/common/indices.hh> -// we want to simulate nitrogen gas transport in a water-saturated medium -#include <dumux/material/fluidsystems/h2on2.hh> - -// We are using the framework for models that consider coupling -// across the element facets of the bulk domain. This has some -// properties defined, which we have to inherit here. In this -// exercise we want to use a cell-centered finite volume scheme -// with tpfa. -#include <dumux/multidomain/facet/cellcentered/tpfa/properties.hh> - -// include the base problem and the model we inherit from +// include the base problem and properties we inherit from #include <dumux/porousmediumflow/problem.hh> -#include <dumux/porousmediumflow/2p/model.hh> - -// the spatial parameters (permeabilities, material parameters etc.) -#include "matrixspatialparams.hh" +#include <dumux/common/properties.hh> namespace Dumux { -// forward declaration of the problem class -template<class TypeTag> class MatrixSubProblem; - -namespace Properties { - -// create the type tag node -namespace TTag { -struct MatrixProblem { using InheritsFrom = std::tuple<CCTpfaFacetCouplingModel, TwoP>; }; -} // end namespace TTag - -// Set the grid type -template<class TypeTag> -struct Grid<TypeTag, TTag::MatrixProblem> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; }; - -// Set the problem type -template<class TypeTag> -struct Problem<TypeTag, TTag::MatrixProblem> { using type = MatrixSubProblem<TypeTag>; }; - -// set the spatial params -template<class TypeTag> -struct SpatialParams<TypeTag, TTag::MatrixProblem> -{ - using type = MatrixSpatialParams< GetPropType<TypeTag, Properties::GridGeometry>, - GetPropType<TypeTag, Properties::Scalar> >; -}; - -// the fluid system -template<class TypeTag> -struct FluidSystem<TypeTag, TTag::MatrixProblem> -{ - using type = Dumux::FluidSystems::H2ON2< GetPropType<TypeTag, Properties::Scalar>, - FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true> >; -}; - -} // end namespace Properties - /*! * \ingroup MultiDomain * \ingroup MultiDomainFacet @@ -283,4 +231,4 @@ private: } // end namespace Dumux -#endif +#endif // DUMUX_COURSE_FRACTURESEXERCISE_MATRIX_PROBLEM_HH diff --git a/exercises/solution/exercise-fractures/properties.hh b/exercises/solution/exercise-fractures/properties.hh new file mode 100644 index 0000000000000000000000000000000000000000..515b0a7a49f018ba30a8f320034ff44f7d5c3872 --- /dev/null +++ b/exercises/solution/exercise-fractures/properties.hh @@ -0,0 +1,111 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see <http://www.gnu.org/licenses/>. * + *****************************************************************************/ +/*! + * \file + * \ingroup MultiDomain + * \ingroup MultiDomainFacet + * \ingroup TwoPTests + * \brief The properties file for exercise on two-phase flow in fractured porous media. + */ +#ifndef DUMUX_COURSE_FRACTURESEXERCISE_PROPERTIES_HH +#define DUMUX_COURSE_FRACTURESEXERCISE_PROPERTIES_HH + +// Both sub-problems +// include the model we inherit from +#include <dumux/porousmediumflow/2p/model.hh> +// we want to simulate nitrogen gas transport in a water-saturated medium +#include <dumux/material/fluidsystems/h2on2.hh> + +// Fracture sub-problem +// we use foam grid for the discretization of the fracture domain +// as this grid manager is able to represent network/surface grids +#include <dune/foamgrid/foamgrid.hh> +// we use a cell-centered finite volume scheme with tpfa here +#include <dumux/discretization/cctpfa.hh> +// the spatial parameters (permeabilities, material parameters etc.) +#include "fracturespatialparams.hh" +// the fracture sub-problem problem file +#include "fractureproblem.hh" + +// Matrix sub-problem +// the spatial parameters (permeabilities, material parameters etc.) +#include "matrixspatialparams.hh" +// the matrix sub-problem problem file +#include "matrixproblem.hh" +// we use alu grid for the discretization of the matrix domain +#include <dune/alugrid/grid.hh> +// We are using the framework for models that consider coupling +// across the element facets of the bulk domain. This has some +// properties defined, which we have to inherit here. In this +// exercise we want to use a cell-centered finite volume scheme +// with tpfa. +#include <dumux/multidomain/facet/cellcentered/tpfa/properties.hh> + + +namespace Dumux::Properties { + +// create the type tag node for the matrix and fracture sub-problems +namespace TTag { +struct MatrixProblem { using InheritsFrom = std::tuple<CCTpfaFacetCouplingModel, TwoP>; }; +struct FractureProblem { using InheritsFrom = std::tuple<TwoP, CCTpfaModel>; }; +} // end namespace TTag + +// Set the grid type for the matrix and fracture sub-domains +template<class TypeTag> +struct Grid<TypeTag, TTag::MatrixProblem> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>; }; +template<class TypeTag> +struct Grid<TypeTag, TTag::FractureProblem> { using type = Dune::FoamGrid<1, 2>; }; + +// Set the problem type for the matrix and fracture sub-domains +template<class TypeTag> +struct Problem<TypeTag, TTag::MatrixProblem> { using type = MatrixSubProblem<TypeTag>; }; +template<class TypeTag> +struct Problem<TypeTag, TTag::FractureProblem> { using type = FractureSubProblem<TypeTag>; }; + +// set the spatial params for the matrix and fracture sub-domains +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::MatrixProblem> +{ + using type = MatrixSpatialParams< GetPropType<TypeTag, Properties::GridGeometry>, + GetPropType<TypeTag, Properties::Scalar> >; +}; +template<class TypeTag> +struct SpatialParams<TypeTag, TTag::FractureProblem> +{ + using type = FractureSpatialParams< GetPropType<TypeTag, Properties::GridGeometry>, + GetPropType<TypeTag, Properties::Scalar> >; +}; + +// the fluid system for the matrix and fracture sub-domains +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::MatrixProblem> +{ + using type = Dumux::FluidSystems::H2ON2< GetPropType<TypeTag, Properties::Scalar>, + FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true> >; +}; +template<class TypeTag> +struct FluidSystem<TypeTag, TTag::FractureProblem> +{ + using type = Dumux::FluidSystems::H2ON2< GetPropType<TypeTag, Properties::Scalar>, + FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/true> >; +}; + +} // end namespace Dumux::Properties + +#endif // DUMUX_COURSE_FRACTURESEXERCISE_PROPERTIES_HH