Commit 9e4105cc authored by Ned Coltman's avatar Ned Coltman
Browse files

Merge branch 'feature/propertiesheader_ex-fractures' into 'master'

Fractures exercise with separate properties header

See merge request !98
parents 1b19e3ba 031ccff3
Pipeline #1833 passed with stage
in 1 minute and 7 seconds
......@@ -20,6 +20,7 @@ Navigate to the directory `dumux/exercises/exercise-fractures` and familiarize y
* The __problem file__ for the fracture domain: `fractureproblem.hh`
* The __spatial parameters file__ for the matrix domain: `matrixspatialparams.hh`
* The __spatial parameters file__ for the matrix domain: `fracturespatialparams.hh`
* The __properties file__ for both domains: `properties.hh`
If you want to learn more about the program flow of coupled problems within the _DuMuX multidomain_ framework, take a closer look at the __main file__. Therein, you will find extensive comments above the key instructions that will help you to identify the main differences with respect to an uncoupled _DuMuX_ model. We will now briefly guide you through this, however, this is not necessary for this exercise. Feel free to continue with the section __Running the program__ and come back to this point later.
......@@ -54,7 +55,7 @@ matrixProblem->setCouplingManager(couplingManager);
fractureProblem->setCouplingManager(couplingManager);
```
From the matrix side, the coupling works a bit different. Since the fracture domain lives on the matrix domain's facets, the state inside the fracture (e.g. pressure, temperature etc.) will affect the fluxes computed across the respective element facets. However, flux assembly depends on the underlying finite-volume scheme and is not convenient to implement. We therefore created _TypeTag_ nodes for the matrix sub-problems in models considering facet coupling. By using these _TypeTags_, all necessary modifications for the flux computation on interior boundaries is done for you. For instance, in `matrixproblem.hh`, we define the _TypeTag_ for the matrix problem as follows (please read the provided comments):
From the matrix side, the coupling works a bit different. Since the fracture domain lives on the matrix domain's facets, the state inside the fracture (e.g. pressure, temperature etc.) will affect the fluxes computed across the respective element facets. However, flux assembly depends on the underlying finite-volume scheme and is not convenient to implement. We therefore created _TypeTag_ nodes for the matrix sub-problems in models considering facet coupling. By using these _TypeTags_, all necessary modifications for the flux computation on interior boundaries is done for you. For instance, in `properties.hh`, we define the _TypeTag_ for the matrix problem as follows (please read the provided comments):
```cpp
// We are using the framework for models that consider coupling
......@@ -64,13 +65,14 @@ From the matrix side, the coupling works a bit different. Since the fracture dom
// with tpfa.
#include <dumux/multidomain/facet/cellcentered/tpfa/properties.hh>
...
namespace Dumux::Properties {
// create the type tag node for the matrix sub-problem
// Create new type tags
// 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
```
Additionally, we need to provide access to the coupling manager in the matrix problem, so that the flux assembly engine of the matrix domain has access to the state inside the fracture (which the fluxes depend on):
......
......@@ -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
......@@ -140,7 +92,7 @@ public:
// However, there is one fracture reaching the top boundary. For this
// fracture tip we set Dirichlet Bcs as in the matrix domain
// TODO dumux-course-task A
// TODO dumux-course-task A
// Change boundary conditions
if (globalPos[1] > this->gridGeometry().bBoxMax()[1] - 1e-6)
values.setAllDirichlet();
......
......@@ -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>
......
......@@ -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
......
// -*- 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 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
......@@ -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
......@@ -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>
......
......@@ -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
// -*- 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment