Commit 742999c2 authored by Timo Koch's avatar Timo Koch

Merge branch 'feature/update_to_dumux_3.0' into 'master'

update dumux-course to dumux 3.0

See merge request !54
parents 5ed34bc7 a94f71b8
Pipeline #742 passed with stage
in 29 seconds
......@@ -25,7 +25,7 @@ Locate all the files you will need for this exercise
* The shared __spatial parameters file__: `injection2pspatialparams.hh`
* The shared __input file__: `exercise_basic.input`
<hr><br><br>
<hr><br>
### Task 2: Compiling and running an executable
<hr>
......@@ -54,13 +54,13 @@ make exercise_basic_2p exercise_basic_2p2c
paraview injection-2p2c.pvd
```
<hr><br><br>
<hr><br>
### Task 3: Setting up a new executable (for a non-isothermal simulation)
<hr>
* Copy the main file `exercise_basic_2p.cc` and rename it to `exercise_basic_2pni.cc`
* In `exercise_basic_2pni.cc`, include the header `injection2pniproblem.hh` instead of `injection2pproblem.hh`.
* In `exercise_basic_2pni.cc`, change `Injection2pCCTypeTag` to `Injection2pNICCTypeTag` in the line `using TypeTag = TTAG(Injection2pCCTypeTag);`
* In `exercise_basic_2pni.cc`, change `Injection2pCCTypeTag` to `Injection2pNICCTypeTag` in the line `using TypeTag = Properties::TTag::Injection2pNICCTypeTag;`
* Add a new executable in `CMakeLists.txt` by adding the lines
```cmake
......@@ -77,7 +77,7 @@ make # should rerun cmake
make exercise_basic_2pni # builds new executable
```
<hr><br><br>
<hr><br>
### Task 4: Setting up a non-isothermal __2pni__ test problem
<hr>
......
......@@ -41,10 +41,11 @@
#include <dumux/assembly/fvassembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/discretization/methods.hh>
#include <dumux/discretization/method.hh>
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2pproblem.hh"
......@@ -57,7 +58,7 @@ int main(int argc, char** argv) try
using namespace Dumux;
// define the type tag for this problem
using TypeTag = TTAG(Injection2pCCTypeTag);
using TypeTag = Properties::TTag::Injection2pCCTypeTag;
// initialize MPI, finalize is done automatically on exit
const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
......@@ -70,7 +71,7 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv);
// try to create a grid (from the given grid file or the input file)
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
......@@ -81,35 +82,57 @@ int main(int argc, char** argv) try
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView);
fvGridGeometry->update();
// the problem (initial and boundary conditions)
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs());
problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x;
// the grid variables
using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables);
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry);
gridVariables->init(x, xOld);
gridVariables->init(x);
// get some time loop parameters
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
const auto tEnd = getParam<Scalar>("TimeLoop.TEnd");
const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize");
auto dt = getParam<Scalar>("TimeLoop.DtInitial");
// intialize the vtk output module
using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields);
VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name());
VtkOutputFields::init(vtkWriter); //! Add model specific output fields
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
// use non-conforming output for the test with interface solver
const auto ncOutput = getParam<bool>("Problem.UseNonConformingOutput", false);
VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name(), "",
ncOutput ? Dune::VTK::nonconforming : Dune::VTK::conforming);
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime);
// instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
......
......@@ -36,15 +36,16 @@
#include <dumux/common/dumuxmessage.hh>
#include <dumux/linear/amgbackend.hh>
#include <dumux/nonlinear/privarswitchnewtonsolver.hh>
#include <dumux/nonlinear/newtonsolver.hh>
#include <dumux/assembly/fvassembler.hh>
#include <dumux/assembly/diffmethod.hh>
#include <dumux/discretization/methods.hh>
#include <dumux/discretization/method.hh>
#include <dumux/io/vtkoutputmodule.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/loadsolution.hh>
// The problem file, where setup-specific boundary and initial conditions are defined.
#include "injection2p2cproblem.hh"
......@@ -57,7 +58,7 @@ int main(int argc, char** argv) try
using namespace Dumux;
// define the type tag for this problem
using TypeTag = TTAG(Injection2p2cCCTypeTag);
using TypeTag = Properties::TTag::Injection2p2cCCTypeTag;
// initialize MPI, finalize is done automatically on exit
const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv);
......@@ -70,7 +71,7 @@ int main(int argc, char** argv) try
Parameters::init(argc, argv);
// try to create a grid (from the given grid file or the input file)
GridManager<typename GET_PROP_TYPE(TypeTag, Grid)> gridManager;
GridManager<GetPropType<TypeTag, Properties::Grid>> gridManager;
gridManager.init();
////////////////////////////////////////////////////////////
......@@ -81,38 +82,57 @@ int main(int argc, char** argv) try
const auto& leafGridView = gridManager.grid().leafGridView();
// create the finite volume grid geometry
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
auto fvGridGeometry = std::make_shared<FVGridGeometry>(leafGridView);
fvGridGeometry->update();
// the problem (initial and boundary conditions)
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using Problem = GetPropType<TypeTag, Properties::Problem>;
auto problem = std::make_shared<Problem>(fvGridGeometry);
// check if we are about to restart a previously interrupted simulation
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
Scalar restartTime = getParam<Scalar>("Restart.Time", 0);
// the solution vector
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
SolutionVector x(fvGridGeometry->numDofs());
problem->applyInitialSolution(x);
// problem->applyInitialSolution(x);
if (restartTime > 0)
{
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
const auto fileName = getParam<std::string>("Restart.File");
const auto pvName = createPVNameFunction<IOFields, PrimaryVariables, ModelTraits, FluidSystem>();
loadSolution(x, fileName, pvName, *fvGridGeometry);
}
else
problem->applyInitialSolution(x);
auto xOld = x;
// the grid variables
using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables);
using GridVariables = GetPropType<TypeTag, Properties::GridVariables>;
auto gridVariables = std::make_shared<GridVariables>(problem, fvGridGeometry);
gridVariables->init(x, xOld);
gridVariables->init(x);
// get some time loop parameters
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
const auto tEnd = getParam<Scalar>("TimeLoop.TEnd");
const auto maxDt = getParam<Scalar>("TimeLoop.MaxTimeStepSize");
auto dt = getParam<Scalar>("TimeLoop.DtInitial");
// intialize the vtk output module
using VtkOutputFields = typename GET_PROP_TYPE(TypeTag, VtkOutputFields);
VtkOutputModule<TypeTag> vtkWriter(*problem, *fvGridGeometry, *gridVariables, x, problem->name());
VtkOutputFields::init(vtkWriter); //! Add model specific output fields
using IOFields = GetPropType<TypeTag, Properties::IOFields>;
VtkOutputModule<GridVariables, SolutionVector> vtkWriter(*gridVariables, x, problem->name());
using VelocityOutput = GetPropType<TypeTag, Properties::VelocityOutput>;
vtkWriter.addVelocityOutput(std::make_shared<VelocityOutput>(*gridVariables));
IOFields::initOutputModule(vtkWriter); //!< Add model specific output fields
vtkWriter.write(restartTime);
// instantiate time loop
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(0.0, dt, tEnd);
auto timeLoop = std::make_shared<TimeLoop<Scalar>>(restartTime, dt, tEnd);
timeLoop->setMaxTimeStepSize(maxDt);
// the assembler with time loop for instationary problem
......@@ -124,8 +144,8 @@ int main(int argc, char** argv) try
auto linearSolver = std::make_shared<LinearSolver>(leafGridView, fvGridGeometry->dofMapper());
// the non-linear solver
using PrimaryVariableSwitch = typename GET_PROP_TYPE(TypeTag, PrimaryVariableSwitch);
using NewtonSolver = Dumux::PriVarSwitchNewtonSolver<Assembler, LinearSolver, PrimaryVariableSwitch>;
// using PrimaryVariableSwitch = GetPropType<TypeTag, Properties::PrimaryVariableSwitch>;
using NewtonSolver = NewtonSolver<Assembler, LinearSolver>;
NewtonSolver nonLinearSolver(assembler, linearSolver);
// time loop
......
......@@ -24,7 +24,7 @@
#ifndef DUMUX_EX_BASIC_PROBLEM_2P2C_HH
#define DUMUX_EX_BASIC_PROBLEM_2P2C_HH
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p2c/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
......@@ -38,25 +38,32 @@ template <class TypeTag>
class Injection2p2cProblem;
namespace Properties {
NEW_TYPE_TAG(Injection2p2cTypeTag, INHERITS_FROM(TwoPTwoC));
NEW_TYPE_TAG(Injection2p2cCCTypeTag, INHERITS_FROM(CCTpfaModel, Injection2p2cTypeTag));
// Create new type tags
namespace TTag {
struct Injection2p2cTypeTag { using InheritsFrom = std::tuple<TwoPTwoC>; };
struct Injection2p2cCCTypeTag { using InheritsFrom = std::tuple<CCTpfaModel, Injection2p2cTypeTag>; };
} // end namespace TTag
// Set the grid type
SET_TYPE_PROP(Injection2p2cTypeTag, Grid, Dune::YaspGrid<2>);
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2p2cTypeTag> { using type = Dune::YaspGrid<2>; };
// Set the problem property
SET_TYPE_PROP(Injection2p2cTypeTag, Problem, Injection2p2cProblem<TypeTag>);
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2p2cTypeTag> { using type = Injection2p2cProblem<TypeTag>; };
// Set the spatial parameters
SET_TYPE_PROP(Injection2p2cTypeTag, SpatialParams,
InjectionSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry),
typename GET_PROP_TYPE(TypeTag, Scalar)>);
InjectionSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>,
GetPropType<TypeTag, Properties::Scalar>>);
// Set fluid configuration
SET_TYPE_PROP(Injection2p2cTypeTag, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>);
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2p2cTypeTag> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
// Define whether mole(true) or mass (false) fractions are used
SET_BOOL_PROP(Injection2p2cTypeTag, UseMoles, true);
template<class TypeTag>
struct UseMoles<TypeTag, TTag::Injection2p2cTypeTag> { static constexpr bool value = true; };
} // end namespace Properties
/*!
......@@ -84,15 +91,15 @@ template<class TypeTag>
class Injection2p2cProblem : public PorousMediumFlowProblem<TypeTag>
{
using ParentType = PorousMediumFlowProblem<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
enum { dimWorld = GridView::dimensionworld };
using Element = typename GridView::template Codim<0>::Entity;
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_EX_BASIC_PROBLEM_2PNI_HH
#define DUMUX_EX_BASIC_PROBLEM_2PNI_HH
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
......@@ -44,22 +44,28 @@ namespace Properties
* TODO:dumux-course-task:
* inherit from the TwoPNI model instead of TwoP here
*/
NEW_TYPE_TAG(Injection2pNITypeTag, INHERITS_FROM(TwoP));
NEW_TYPE_TAG(Injection2pNICCTypeTag, INHERITS_FROM(CCTpfaModel, Injection2pNITypeTag));
// Create new type tags
namespace TTag {
struct Injection2pNITypeTag { using InheritsFrom = std::tuple<TwoP>; };
struct Injection2pNICCTypeTag { using InheritsFrom = std::tuple<Injection2pNITypeTag, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
SET_TYPE_PROP(Injection2pNITypeTag, Grid, Dune::YaspGrid<2>);
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2pNITypeTag> { using type = Dune::YaspGrid<2>; };
// Set the problem property
SET_TYPE_PROP(Injection2pNITypeTag, Problem, InjectionProblem2PNI<TypeTag>);
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2pNITypeTag> { using type = InjectionProblem2PNI<TypeTag>; };
// Set the spatial parameters
SET_TYPE_PROP(Injection2pNITypeTag, SpatialParams,
InjectionSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry),
typename GET_PROP_TYPE(TypeTag, Scalar)>);
InjectionSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>,
GetPropType<TypeTag, Properties::Scalar>>);
// Set fluid configuration
SET_TYPE_PROP(Injection2pNITypeTag, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>);
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2pNITypeTag> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
} // end namespace Properties
/*!
......@@ -87,15 +93,15 @@ template<class TypeTag>
class InjectionProblem2PNI : public PorousMediumFlowProblem<TypeTag>
{
using ParentType = PorousMediumFlowProblem<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
enum { dimWorld = GridView::dimensionworld };
using Element = typename GridView::template Codim<0>::Entity;
......
......@@ -25,7 +25,7 @@
#ifndef DUMUX_EX_BASIC_PROBLEM_2P_HH
#define DUMUX_EX_BASIC_PROBLEM_2P_HH
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2p/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include <dumux/material/fluidsystems/h2on2.hh>
......@@ -40,22 +40,28 @@ class InjectionProblem2P;
namespace Properties {
// define the TypeTag for this problem with a cell-centered two-point flux approximation spatial discretization.
NEW_TYPE_TAG(Injection2pTypeTag, INHERITS_FROM(TwoP));
NEW_TYPE_TAG(Injection2pCCTypeTag, INHERITS_FROM(CCTpfaModel, Injection2pTypeTag));
// Create new type tags
namespace TTag {
struct Injection2pTypeTag { using InheritsFrom = std::tuple<TwoP>; };
struct Injection2pCCTypeTag { using InheritsFrom = std::tuple<Injection2pTypeTag, CCTpfaModel>; };
} // end namespace TTag
// Set the grid type
SET_TYPE_PROP(Injection2pTypeTag, Grid, Dune::YaspGrid<2>);
template<class TypeTag>
struct Grid<TypeTag, TTag::Injection2pTypeTag> { using type = Dune::YaspGrid<2>; };
// Set the problem property
SET_TYPE_PROP(Injection2pTypeTag, Problem, InjectionProblem2P<TypeTag>);
template<class TypeTag>
struct Problem<TypeTag, TTag::Injection2pTypeTag> { using type = InjectionProblem2P<TypeTag>; };
// Set the spatial parameters
SET_TYPE_PROP(Injection2pTypeTag, SpatialParams,
InjectionSpatialParams<typename GET_PROP_TYPE(TypeTag, FVGridGeometry),
typename GET_PROP_TYPE(TypeTag, Scalar)>);
InjectionSpatialParams<GetPropType<TypeTag, Properties::FVGridGeometry>,
GetPropType<TypeTag, Properties::Scalar>>);
// Set fluid configuration
SET_TYPE_PROP(Injection2pTypeTag, FluidSystem, FluidSystems::H2ON2<typename GET_PROP_TYPE(TypeTag, Scalar), FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>);
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::Injection2pTypeTag> { using type = FluidSystems::H2ON2<GetPropType<TypeTag, Properties::Scalar>, FluidSystems::H2ON2DefaultPolicy</*fastButSimplifiedRelations=*/ true>>; };
} // end namespace Properties
/*!
......@@ -83,15 +89,15 @@ template<class TypeTag>
class InjectionProblem2P : public PorousMediumFlowProblem<TypeTag>
{
using ParentType = PorousMediumFlowProblem<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
enum { dimWorld = GridView::dimensionworld };
using Element = typename GridView::template Codim<0>::Entity;
......
......@@ -124,7 +124,7 @@ Run two simulations and compare them side by side by creating two input files, o
```bash
./exercisebiomin -Problem.Name biominNoUrea -Injection.ConcUrea 0
```
The result for the biomineralization process after the CO2 injection should look like this:
The result for the biomineralization process during the CO2 injection should look like this:
![](../extradoc/exercisebiomin_injectionFinal.png)
......@@ -133,13 +133,13 @@ The result for the biomineralization process after the CO2 injection should look
In the last step, the manual comparison of the results can be quite difficult. Paraview offers the option to use programmable python filters. To use them, make sure two result files with __different names__ are loaded. Mark both of them and click on `Filters --> Alphabetical --> Programmable Filter`. Now a new field opens on the left side. Copy the following lines there:
```python
Sn_0 = inputs[0].CellData['S_n'];
Sn_1 = inputs[1].CellData['S_n'];
output.CellData.append(abs(Sn_0-Sn_1),'diffSn');
S_gas_0 = inputs[0].CellData['S_gas'];
S_gas_1 = inputs[1].CellData['S_gas'];
output.CellData.append(abs(S_gas_0-S_gas_1),'diffS_gas');
```
Click `Apply` and select `diffSn` as new output. You should now see the difference between the two result files. You can also change the output to a not absolute value by changing the last line to:
Click `Apply` and select `diffS_gas` as new output. You should now see the difference between the two result files. You can also change the output to a not absolute value by changing the last line to:
```python
output.CellData.append((Sn_0-Sn_1),'diffSn');
output.CellData.append((S_gas_0-S_gas_1),'diffS_gas');
```
......@@ -24,7 +24,7 @@
#ifndef DUMUX_EXERCISE_FOUR_PROBLEM_HH
#define DUMUX_EXERCISE_FOUR_PROBLEM_HH
#include <dumux/discretization/cellcentered/tpfa/properties.hh>
#include <dumux/discretization/cctpfa.hh>
#include <dumux/porousmediumflow/2pncmin/model.hh>
#include <dumux/porousmediumflow/problem.hh>
#include "solidsystems/biominsolidphase.hh" // The biomineralization solid system
......@@ -51,42 +51,54 @@ class ExerciseFourBioMinProblem;
namespace Properties
{
//! Create new type tag for the problem
NEW_TYPE_TAG(ExerciseFourBioMinTypeTag, INHERITS_FROM(TwoPNCMin, BioMinSpatialparams));
NEW_TYPE_TAG(ExerciseFourBioMinCCTpfaTypeTag, INHERITS_FROM(CCTpfaModel, ExerciseFourBioMinTypeTag));
// Create new type tags
namespace TTag {
struct ExerciseFourBioMinTypeTag { using InheritsFrom = std::tuple<BioMinSpatialparams, TwoPNCMin>; };
struct ExerciseFourBioMinCCTpfaTypeTag { using InheritsFrom = std::tuple<ExerciseFourBioMinTypeTag, CCTpfaModel>; };
} // end namespace TTag
//! Set the problem property
SET_TYPE_PROP(ExerciseFourBioMinTypeTag, Problem, ExerciseFourBioMinProblem<TypeTag>);
template<class TypeTag>
struct Problem<TypeTag, TTag::ExerciseFourBioMinTypeTag> { using type = ExerciseFourBioMinProblem<TypeTag>; };
//! Set grid and the grid creator to be used
#if HAVE_DUNE_ALUGRID
SET_TYPE_PROP(ExerciseFourBioMinTypeTag, Grid, Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>);
template<class TypeTag>
struct Grid<TypeTag, TTag::ExerciseFourBioMinTypeTag> { using type = Dune::ALUGrid</*dim=*/2, 2, Dune::cube, Dune::nonconforming>; };
#elif HAVE_UG
SET_TYPE_PROP(ExerciseFourBioMinTypeTag, Grid, Dune::UGGrid<2>);
template<class TypeTag>
struct Grid<TypeTag, TTag::ExerciseFourBioMinTypeTag> { using type = Dune::UGGrid<2>; };
#else
SET_TYPE_PROP(ExerciseFourBioMinTypeTag, Grid, Dune::YaspGrid<2>);
template<class TypeTag>
struct Grid<TypeTag, TTag::ExerciseFourBioMinTypeTag> { using type = Dune::YaspGrid<2>; };
#endif // HAVE_DUNE_ALUGRID
//! Set the fluid system type
SET_PROP(ExerciseFourBioMinTypeTag, FluidSystem)
template<class TypeTag>
struct FluidSystem<TypeTag, TTag::ExerciseFourBioMinTypeTag>
{
private:
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using CO2Tables = Dumux::CO2Tables;
using H2OType = Components::TabulatedComponent<Components::H2O<Scalar>>;
public:
using type = FluidSystems::BioMin<Scalar, CO2Tables, H2OType>;
};
SET_PROP(ExerciseFourBioMinTypeTag, SolidSystem)
template<class TypeTag>
struct SolidSystem<TypeTag, TTag::ExerciseFourBioMinTypeTag>
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using type = SolidSystems::BiominSolidPhase<Scalar>;
};
SET_BOOL_PROP(ExerciseFourBioMinTypeTag, EnableFVGridGeometryCache, false);
SET_BOOL_PROP(ExerciseFourBioMinTypeTag, EnableGridVolumeVariablesCache, false);
SET_BOOL_PROP(ExerciseFourBioMinTypeTag, EnableGridFluxVariablesCache, false);
template<class TypeTag>
struct EnableFVGridGeometryCache<TypeTag, TTag::ExerciseFourBioMinTypeTag> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableGridVolumeVariablesCache<TypeTag, TTag::ExerciseFourBioMinTypeTag> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableGridFluxVariablesCache<TypeTag, TTag::ExerciseFourBioMinTypeTag> { static constexpr bool value = false; };
} // end namespace properties
/*!
......@@ -98,16 +110,16 @@ class ExerciseFourBioMinProblem : public PorousMediumFlowProblem<TypeTag>
{
using ParentType = PorousMediumFlowProblem<TypeTag>;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
using SolidSystem = typename GET_PROP_TYPE(TypeTag, SolidSystem);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using PrimaryVariables = typename GET_PROP_TYPE(TypeTag, PrimaryVariables);
using BoundaryTypes = typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
using VolumeVariables = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using SolidSystem = GetPropType<TypeTag, Properties::SolidSystem>;
using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices;
using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>;
using BoundaryTypes = GetPropType<TypeTag, Properties::BoundaryTypes>;
using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>;
using FVGridGeometry = GetPropType<TypeTag, Properties::FVGridGeometry>;
using FVElementGeometry = typename GetPropType<TypeTag, Properties::FVGridGeometry>::LocalView;
// Grid dimension
enum
......@@ -117,10 +129,10 @@ class ExerciseFourBioMinProblem : public PorousMediumFlowProblem<TypeTag>
};
using GlobalPosition = Dune::FieldVector<Scalar, GridView::dimension>;
using NumEqVector = typename GET_PROP_TYPE(TypeTag, NumEqVector);
using ElementVolumeVariables = typename GET_PROP_TYPE(TypeTag, GridVolumeVariables)::LocalView;
using NumEqVector = GetPropType<TypeTag, Properties::NumEqVector>;
using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView;
using Element = typename GridView::template Codim<0>::Entity;
using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector);
using SolutionVector = GetPropType<TypeTag, Properties::SolutionVector>;
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
// TODO: dumux-course-task
// set the chemistry TypeTag
......@@ -173,7 +185,7 @@ public:
concCa_ = getParam<Scalar>("Injection.ConcCa");
concUrea_ = getParam<Scalar>("Injection.ConcUrea");
unsigned int codim = GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod == DiscretizationMethod::box ? dim : 0;
unsigned int codim = GetPropType<TypeTag, Properties::FVGridGeometry>::discMethod == DiscretizationMethod::box ? dim : 0;
Kxx_.resize(fvGridGeometry->gridView().size(codim));
Kyy_.resize(fvGridGeometry->gridView().size(codim));
......@@ -268,7 +280,6 @@ public:
NumEqVector values(0.0);
Scalar waterFlux = injVolumeflux_; // divide by area if area not 1! [m/s]
Scalar gasFlux = injCO2_; // divide by area if area not 1! [m/s]