Skip to content
Snippets Groups Projects
Commit 28203b71 authored by Leon Keim's avatar Leon Keim Committed by Timo Koch
Browse files

[properties][slides] Use concrete Dumux example for Motivation

parent 46a50854
No related branches found
No related tags found
1 merge request!270[properties][slides] Renew properties slides
Pipeline #47204 passed
......@@ -76,7 +76,6 @@ using GOF0 = Dune::GridOperator<
CF, CF
>;
DGGO2 dggo2(gfs, cd, gfs, cf, lop, mbe);
```
## Traits classes
......@@ -84,7 +83,7 @@ DGGO2 dggo2(gfs, cd, gfs, cf, lop, mbe);
A usual way to group template parameters
```cpp
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class SR>
template<class PV, class FSY, class FST, class SSY,...>
struct TwoPVolumeVariablesTraits
{
using PrimaryVariables = PV;
......@@ -97,31 +96,42 @@ struct TwoPVolumeVariablesTraits
using SaturationReconstruction = SR;
};
```
## Traits classes
Making it usable using a single template parameter
```c++
template<class TypeTag>
struct VolumeVariables<TypeTag, TTag::TwoP>
## Type traits
Why do we need the type?
```cpp
// Type trait template declaration
template<typename T> struct ValueType;
// Specialization for vectors of T
template<typename T, typename Allocator>
struct ValueType<std::vector<T, Allocator>> { using type = T; };
// Specialization for Dune::FieldVector
template<typename T, int size>
struct ValueType<Dune::FieldVector<T, size>> { using type = T; };
```
## Type traits
```cpp
template <class Traits>
class TwoPVolumeVariables
{
private:
using PV = GetPropType<TypeTag, Properties::PrimaryVariables>;
using FSY = GetPropType<TypeTag, Properties::FluidSystem>;
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using DM = typename GetPropType<TypeTag, Properties::GridGeometry>::DiscretizationMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of nonwetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using Traits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
public:
using type = TwoPVolumeVariables<Traits>;
};
...
using FluidSystem = typename Traits::FluidSystem
...
```
Usage: these VolumeVariables will work for various FluidSystems:
```cpp
Scalar mu = FluidSystem::viscosity(fluidState, paramCache, phaseIdx);
```
## Inheriting from traits classes
......@@ -143,24 +153,6 @@ struct MyDoubleTraits : public MyBaseTraits
// this is a vector of ints!
typename MyDoubleTraits::Vector v{1.14142, 1.73205};
```
## Type traits
Based on template specialization
```cpp
// Type trait template declaration
template<typename T> struct ValueType;
// Specialization for vectors of T
template<typename T, typename Allocator>
struct ValueType<std::vector<T, Allocator>> { using type = T; };
// Specialization for Dune::FieldVector
template<typename T, int size>
struct ValueType<Dune::FieldVector<T, size>> { using type = T; };
```
# The DuMuX Property System
## Property System Design
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment