Commit 5628e2fd authored by Ned Coltman's avatar Ned Coltman
Browse files

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

Grids Exercise with separate properties header

See merge request !94
parents 806028ec f1f151c3
Pipeline #1824 passed with stage
in 34 seconds
......@@ -11,7 +11,8 @@ Here we will expand on what we've covered in the basics exercise, and the proble
We'll be editing the following files during this exercise:
* The __input file__: `params.input` ,
* and the __problem file__: `problem.hh`
* the __problem file__: `problem.hh` ,
* and the __properties file__: `properties.hh`.
Currently our grid is defined using the following input parameters in the input file:
......@@ -41,7 +42,7 @@ The simulation should take much more time. Luckily there are other ways to resol
Up until now, we have used a basic uniform structured grid. This grid is provided in the Dune environment and is called the YASP grid (Yet Another Structured Parallel Grid).
In the Problem file, the grid properties are defined using the following command.
In the properties file, the grid properties are defined using the following command.
```c++
// Set the grid type
......@@ -62,7 +63,7 @@ GridManager<Dune::YaspGrid<dim, Dune::TensorProductCoordinates<ctype, dim> >>
A YaspGrid, of dimension `dim` is used, and the coordinate system `Dune::TensorProductCoordinates`, with arguments coordinate type `ctype` and dimension `dim`, is provided as a secondary argument. This allows us to switch to a grid format that allows for more cells in certain zones, and a cell grading.
To use this format, we need to set the grid property in our problem file accordingly. Our problem dimension is 2 (`dim`), and we will provide the coordinates as doubles (`ctype`).
To use this format, we need to set the grid property in our properties file accordingly. Our problem dimension is 2 (`dim`), and we will provide the coordinates as doubles (`ctype`).
To switch the property we should replace the `Dune::YaspGrid<2>` argument with `Dune::YaspGrid<dim, Dune::TensorProductCoordinates<ctype, dim> >`, and the `dim` and `ctype` with `2` and `double`
In our input file, we can now specify more specific Grid sizing directions: Positions, Cells, and Grading, each of which can be defined per direction.
......
......@@ -47,8 +47,8 @@
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
// The problem file, where setup-specific boundary and initial conditions are defined.
#include "problem.hh"
// The properties file, where the compile time options are defined.
#include "properties.hh"
////////////////////////
// the main function
......
......@@ -19,67 +19,17 @@
/*!
* \file
*
* \brief The two-phase porousmediumflow problem for exercise-runtimeparams
* \brief The two-phase porousmediumflow problem for exercise-grids
*/
#ifndef DUMUX_EXGRIDS_INJECTION_PROBLEM_2P_HH
#define DUMUX_EXGRIDS_INJECTION_PROBLEM_2P_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include "spatialparams.hh"
#include <dumux/common/properties.hh>
namespace Dumux {
// forward declare problem
template <class TypeTag>
class InjectionProblem2P;
namespace Properties {
// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization.
// Create new type tags
namespace TTag {
struct Injection2p { using InheritsFrom = std::tuple<TwoP>; };
struct Injection2pCC { using InheritsFrom = std::tuple<Injection2p, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2>; };
// TODO: dumux-course-task 2
//Replace the above Grid Property definition with a more flexible grid (Use Dune::TensorProductCoordinates)
// TODO: dumux-course-task 4
// Replace the above Grid Property definition to read in a external structured grid via a .msh file (Use Dune::ALUGrid and Dune:cube)
// TODO: dumux-course-task 5
// Replace the above Grid Property definition to read in a external unstructured grid via a .msh file (Use Dune::ALUGrid and Dune::simplex)
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2p> { using type = InjectionProblem2P<TypeTag>; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Injection2p>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = InjectionSpatialParams<FVGridGeometry, Scalar>;
};
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2p> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
} // end namespace Properties
/*!
* \ingroup TwoPModel
* \ingroup ImplicitTestProblems
......
// -*- 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
*
* \brief The properties file for exercise-grids
*/
#ifndef DUMUX_EX_GRIDS_PROPERTIES_HH
#define DUMUX_EX_GRIDS_PROPERTIES_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include "spatialparams.hh"
// The problem file, where setup-specific boundary and initial conditions are defined.
#include "problem.hh"
namespace Dumux::Properties {
// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization.
// Create new type tags
namespace TTag {
struct Injection2p { using InheritsFrom = std::tuple<TwoP>; };
struct Injection2pCC { using InheritsFrom = std::tuple<Injection2p, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2>; };
// TODO: dumux-course-task 2
//Replace the above Grid Property definition with a more flexible grid (Use Dune::TensorProductCoordinates)
// TODO: dumux-course-task 4
// Replace the above Grid Property definition to read in a external structured grid via a .msh file (Use Dune::ALUGrid and Dune:cube)
// TODO: dumux-course-task 5
// Replace the above Grid Property definition to read in a external unstructured grid via a .msh file (Use Dune::ALUGrid and Dune::simplex)
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2p> { using type = InjectionProblem2P<TypeTag>; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Injection2p>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = InjectionSpatialParams<FVGridGeometry, Scalar>;
};
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2p> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
} // end namespace Dumux::Properties
#endif
......@@ -47,8 +47,8 @@
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
// The problem file, where setup-specific boundary and initial conditions are defined.
#include "problem.hh"
// The properties file, where the compile time options are defined.
#include "properties.hh"
////////////////////////
// the main function
......
......@@ -19,70 +19,17 @@
/*!
* \file
*
* \brief The two-phase porousmediumflow problem for exercise Grids
* \brief The two-phase porousmediumflow problem for exercise-grids
*/
#ifndef DUMUX_EXGRIDS_INJECTION_PROBLEM_2P_HH
#define DUMUX_EXGRIDS_INJECTION_PROBLEM_2P_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include "spatialparams.hh"
#include <dumux/common/properties.hh>
namespace Dumux {
// forward declare problem
template <class TypeTag>
class InjectionProblem2P;
namespace Properties {
// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization.
// Create new type tags
namespace TTag {
struct Injection2p { using InheritsFrom = std::tuple<TwoP>; };
struct Injection2pCC { using InheritsFrom = std::tuple<Injection2p, CCTpfaModel>; };
} // end namespace TTag
//Set the grid type
// template<class TypeTag>
// struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2>; };
// TODO: Task 2: Replace the above Grid Property definition with a more flexible grid (Use Dune::TensorProductCoordinates)
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<double, 2> >; };
// TODO: Task 4: Replace the above Grid Property definition to read in a external structured grid via a .msh file (Use Dune::ALUGrid and Dune:cube)
// template<class TypeTag>
// struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; };
// TODO: Task 5: Replace the above Grid Property definition to read in a external unstructured grid via a .msh file (Use Dune::ALUGrid and Dune::simplex)
// template<class TypeTag>
// struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2p> { using type = InjectionProblem2P<TypeTag>; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Injection2p>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = InjectionSpatialParams<FVGridGeometry, Scalar>;
};
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2p> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
} // end namespace Properties
/*!
* \ingroup TwoPModel
* \ingroup ImplicitTestProblems
......
// -*- 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
*
* \brief The two-phase porousmediumflow properties file for exercise-grids
*/
#ifndef DUMUX_EX_GRIDS_PROPERTIES_HH
#define DUMUX_EX_GRIDS_PROPERTIES_HH
#include <dune/grid/yaspgrid.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
#include "spatialparams.hh"
// The problem file, where setup-specific boundary and initial conditions are defined.
#include "problem.hh"
namespace Dumux::Properties {
// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization.
// Create new type tags
namespace TTag {
struct Injection2p { using InheritsFrom = std::tuple<TwoP>; };
struct Injection2pCC { using InheritsFrom = std::tuple<Injection2p, CCTpfaModel>; };
} // end namespace TTag
//Set the grid type
// template<class TypeTag>
// struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2>; };
// TODO: Task 2: Replace the above Grid Property definition with a more flexible grid (Use Dune::TensorProductCoordinates)
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::YaspGrid<2, Dune::TensorProductCoordinates<double, 2> >; };
// TODO: Task 4: Replace the above Grid Property definition to read in a external structured grid via a .msh file (Use Dune::ALUGrid and Dune:cube)
// template<class TypeTag>
// struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming>; };
// TODO: Task 5: Replace the above Grid Property definition to read in a external unstructured grid via a .msh file (Use Dune::ALUGrid and Dune::simplex)
// template<class TypeTag>
// struct Grid<TypeTag, TTag::Injection2p> { using type = Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming>; };
// Set the problem property
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2p> { using type = InjectionProblem2P<TypeTag>; };
// Set the spatial parameters
template<class TypeTag>
struct SpatialParams<TypeTag, TTag::Injection2p>
{
private:
using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
public:
using type = InjectionSpatialParams<FVGridGeometry, Scalar>;
};
// Set fluid configuration
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2p> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
} // end namespace Dumux::Properties
#endif
Markdown is supported
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