Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux-course
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux-course
Commits
28203b71
Commit
28203b71
authored
8 months ago
by
Leon Keim
Committed by
Timo Koch
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[properties][slides] Use concrete Dumux example for Motivation
parent
46a50854
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!270
[properties][slides] Renew properties slides
Pipeline
#47204
passed
8 months ago
Stage: trigger pipelines
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/properties.md
+34
-42
34 additions, 42 deletions
slides/properties.md
with
34 additions
and
42 deletions
slides/properties.md
+
34
−
42
View file @
28203b71
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment