Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dumux-repositories
dumux
Commits
812027d4
Commit
812027d4
authored
Apr 03, 2018
by
Timo Koch
Committed by
Dennis Gläser
Apr 05, 2018
Browse files
[disc][cc] Free grid/element volvars from TypeTag
parent
fb309f0b
Changes
15
Hide whitespace changes
Inline
Side-by-side
dumux/discretization/box/elementsolution.hh
View file @
812027d4
...
...
@@ -124,8 +124,8 @@ auto elementSolution(const Element& element, const SolutionVector& sol, const FV
template
<
class
Element
,
class
ElementVolumeVariables
,
class
FVElementGeometry
>
auto
elementSolution
(
const
Element
&
element
,
const
ElementVolumeVariables
&
elemVolVars
,
const
FVElementGeometry
&
gg
)
->
std
::
enable_if_t
<
FVElementGeometry
::
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
box
,
BoxElementSolution
<
typename
FVElementGeometry
::
FVGrid
Geometry
,
typename
ElementVolumeVariables
::
S
olu
tionVector
>>
BoxElementSolution
<
FVElement
Geometry
,
typename
ElementVolumeVariables
::
V
olu
meVariables
::
PrimaryVariables
>>
{
return
BoxElementSolution
<
typename
FVElementGeometry
::
FVGridGeometry
,
typename
ElementVolumeVariables
::
SolutionVector
>
(
element
,
elemVolVars
,
gg
);
...
...
dumux/discretization/cellcentered/elementsolution.hh
View file @
812027d4
...
...
@@ -35,37 +35,33 @@ namespace Dumux {
* \ingroup CCDiscretization
* \brief The element solution vector
*/
template
<
class
FV
Grid
Geometry
,
class
SolutionVector
>
template
<
class
FV
Element
Geometry
,
class
PV
>
class
CCElementSolution
{
using
FVGridGeometry
=
typename
FVElementGeometry
::
FVGridGeometry
;
using
GridView
=
typename
FVGridGeometry
::
GridView
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
FVElementGeometry
=
typename
FVGridGeometry
::
LocalView
;
public:
using
PrimaryVariables
=
std
::
decay_t
<
decltype
(
std
::
declval
<
SolutionVector
>
()[
0
])
>
;
//! export the primary variables type
using
PrimaryVariables
=
PV
;
//! default constructor
CCElementSolution
()
=
default
;
//! Constructor with element and solution
//! Constructor with element, solution vector and grid geometry
template
<
class
SolutionVector
>
CCElementSolution
(
const
Element
&
element
,
const
SolutionVector
&
sol
,
const
FVGridGeometry
&
fvGridGeometry
)
:
CCElementSolution
(
sol
[
fvGridGeometry
.
elementMapper
().
index
(
element
)])
{}
//! Constructor with element and solution and element geometry
CCElementSolution
(
const
Element
&
element
,
const
SolutionVector
&
sol
,
const
FVElementGeometry
&
fvGeometry
)
:
CCElementSolution
(
sol
[
fvGeometry
.
fvGridGeometry
().
elementMapper
().
index
(
element
)])
{}
//! Constructor with element and elemVolVars and fvGeometry
//! Constructor with element, element volume variables and fv element geometry
template
<
class
ElementVolumeVariables
>
CCElementSolution
(
const
Element
&
element
,
const
ElementVolumeVariables
&
elemVolVars
,
const
FVElementGeometry
&
fvGeometry
)
{
for
(
const
auto
&
scv
:
scvs
(
fvGeometry
))
for
(
const
auto
&
scv
:
scvs
(
fvGeometry
))
priVars_
=
elemVolVars
[
scv
].
priVars
();
}
...
...
@@ -78,6 +74,7 @@ public:
:
priVars_
(
priVars
)
{}
//! extract the element solution from the solution vector using a mapper
template
<
class
SolutionVector
>
void
update
(
const
Element
&
element
,
const
SolutionVector
&
sol
,
const
FVGridGeometry
&
fvGridGeometry
)
{
...
...
@@ -112,9 +109,12 @@ template<class Element, class SolutionVector, class FVGridGeometry>
auto
elementSolution
(
const
Element
&
element
,
const
SolutionVector
&
sol
,
const
FVGridGeometry
&
gg
)
->
std
::
enable_if_t
<
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
cctpfa
||
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
ccmpfa
,
CCElementSolution
<
FVGridGeometry
,
SolutionVector
>>
CCElementSolution
<
typename
FVGridGeometry
::
LocalView
,
std
::
decay_t
<
decltype
(
std
::
declval
<
SolutionVector
>
()[
0
])
>>
>
{
return
CCElementSolution
<
FVGridGeometry
,
SolutionVector
>
(
element
,
sol
,
gg
);
using
PrimaryVariables
=
std
::
decay_t
<
decltype
(
std
::
declval
<
SolutionVector
>
()[
0
])
>
;
return
CCElementSolution
<
typename
FVGridGeometry
::
LocalView
,
PrimaryVariables
>
(
element
,
sol
,
gg
);
}
/*!
...
...
@@ -125,11 +125,10 @@ template<class Element, class ElementVolumeVariables, class FVElementGeometry>
auto
elementSolution
(
const
Element
&
element
,
const
ElementVolumeVariables
&
elemVolVars
,
const
FVElementGeometry
&
gg
)
->
std
::
enable_if_t
<
FVElementGeometry
::
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
cctpfa
||
FVElementGeometry
::
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
ccmpfa
,
CCElementSolution
<
typename
FVElementGeometry
::
FVGridGeometry
,
typename
ElementVolumeVariables
::
SolutionVector
>>
CCElementSolution
<
FVElementGeometry
,
typename
ElementVolumeVariables
::
VolumeVariables
::
PrimaryVariables
>>
{
return
CCElementSolution
<
typename
FV
Element
Geometry
::
FVGridGeometry
,
typename
Element
V
olu
meVariables
::
SolutionVector
>
(
element
,
elemVolVars
,
gg
);
using
PrimaryVariables
=
typename
Element
VolumeVariables
::
VolumeVariables
::
PrimaryVariables
;
return
CC
Element
S
olu
tion
<
FVElementGeometry
,
PrimaryVariables
>
(
element
,
elemVolVars
,
gg
);
}
/*!
...
...
@@ -137,13 +136,13 @@ auto elementSolution(const Element& element, const ElementVolumeVariables& elemV
* \brief Make an element solution for cell-centered schemes
* \note This is e.g. used to contruct an element solution at Dirichlet boundaries
*/
template
<
class
SolutionVector
,
class
FVGrid
Geometry
,
class
PrimaryVariables
>
template
<
class
FVElement
Geometry
,
class
PrimaryVariables
>
auto
elementSolution
(
PrimaryVariables
&&
priVars
)
->
std
::
enable_if_t
<
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
cctpfa
||
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
ccmpfa
,
CCElementSolution
<
FV
Grid
Geometry
,
SolutionVector
>>
->
std
::
enable_if_t
<
FVElementGeometry
::
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
cctpfa
||
FVElementGeometry
::
FVGridGeometry
::
discMethod
==
DiscretizationMethod
::
ccmpfa
,
CCElementSolution
<
FV
Element
Geometry
,
PrimaryVariables
>>
{
return
CCElementSolution
<
FV
Grid
Geometry
,
SolutionVector
>
(
std
::
move
(
priVars
));
return
CCElementSolution
<
FV
Element
Geometry
,
PrimaryVariables
>
(
std
::
move
(
priVars
));
}
}
// end namespace Dumux
...
...
dumux/discretization/cellcentered/gridvolumevariables.hh
View file @
812027d4
...
...
@@ -24,7 +24,7 @@
#ifndef DUMUX_DISCRETIZATION_CC_GRID_VOLUMEVARIABLES_HH
#define DUMUX_DISCRETIZATION_CC_GRID_VOLUMEVARIABLES_HH
#include
<
dumux/common/properties.hh
>
#include
<
type_traits
>
//! make the local view function available whenever we use this class
#include
<dumux/discretization/localview.hh>
...
...
@@ -36,38 +36,32 @@ namespace Dumux {
* \ingroup CCDiscretization
* \brief Base class for the grid volume variables
* \note This class has a cached version and a non-cached version
* \tparam T
ypeTag the TypeTag
* \tparam
enableGridVolVarsCache
if the cache is enabled
* \tparam T
raits the traits class injecting the problem, volVar and elemVolVars type
* \tparam
cachingEnabled
if the cache is enabled
*/
template
<
class
TypeTag
,
bool
enableGridVolVarsCache
>
class
CCGridVolumeVariables
{};
template
<
class
Traits
,
bool
cachingEnabled
=
false
>
class
CCGridVolumeVariables
{};
//! specialization in case of storing the volume variables
template
<
class
T
ypeTag
>
class
CCGridVolumeVariables
<
T
ypeTag
,
/*enableGridVolVarsCache
*/
true
>
template
<
class
T
raits
>
class
CCGridVolumeVariables
<
T
raits
,
/*cachingEnabled
*/
true
>
{
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
);
using
SolutionVector
=
typename
GET_PROP_TYPE
(
TypeTag
,
SolutionVector
);
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
using
VolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
VolumeVariables
);
using
FVElementGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
)
::
LocalView
;
using
SubControlVolume
=
typename
FVElementGeometry
::
SubControlVolume
;
using
IndexType
=
typename
GridView
::
IndexSet
::
IndexType
;
static
const
int
dim
=
GridView
::
dimension
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
ThisType
=
CCGridVolumeVariables
<
Traits
,
true
>
;
using
Problem
=
typename
Traits
::
Problem
;
public:
//! export the
type of the local view
using
LocalView
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
VolumeVariables
)
;
//! export the
volume variables type
using
VolumeVariables
=
typename
Traits
::
VolumeVariables
;
//! make it possible to query if caching is enabled
static
constexpr
bool
cachingEnabled
=
true
;
//! export the type of the local view
using
LocalView
=
typename
Traits
::
template
LocalView
<
ThisType
,
cachingEnabled
>;
CCGridVolumeVariables
(
const
Problem
&
problem
)
:
problemPtr_
(
&
problem
)
{}
template
<
class
FVGridGeometry
,
class
SolutionVector
>
void
update
(
const
FVGridGeometry
&
fvGridGeometry
,
const
SolutionVector
&
sol
)
{
const
auto
numScv
=
fvGridGeometry
.
numScv
();
...
...
@@ -98,7 +92,7 @@ public:
{
const
auto
insideScvIdx
=
scvf
.
insideScvIdx
();
const
auto
&
insideScv
=
fvGeometry
.
scv
(
insideScvIdx
);
const
auto
dirichletPriVars
=
elementSolution
<
SolutionVector
,
FVGridGeometry
>
(
problem
().
dirichlet
(
element
,
scvf
));
const
auto
dirichletPriVars
=
elementSolution
<
typename
FVGridGeometry
::
LocalView
>
(
problem
().
dirichlet
(
element
,
scvf
));
volumeVariables_
[
scvf
.
outsideScvIdx
()].
update
(
dirichletPriVars
,
problem
(),
...
...
@@ -109,24 +103,26 @@ public:
}
}
const
VolumeVariables
&
volVars
(
const
IndexType
scvIdx
)
const
const
VolumeVariables
&
volVars
(
const
std
::
size_t
scvIdx
)
const
{
return
volumeVariables_
[
scvIdx
];
}
VolumeVariables
&
volVars
(
const
IndexType
scvIdx
)
VolumeVariables
&
volVars
(
const
std
::
size_t
scvIdx
)
{
return
volumeVariables_
[
scvIdx
];
}
template
<
class
SubControlVolume
,
typename
std
::
enable_if_t
<!
std
::
is_integral
<
SubControlVolume
>
::
value
,
int
>
=
0
>
const
VolumeVariables
&
volVars
(
const
SubControlVolume
scv
)
const
{
return
volumeVariables_
[
scv
.
dofIndex
()];
}
template
<
class
SubControlVolume
,
typename
std
::
enable_if_t
<!
std
::
is_integral
<
SubControlVolume
>
::
value
,
int
>
=
0
>
VolumeVariables
&
volVars
(
const
SubControlVolume
scv
)
{
return
volumeVariables_
[
scv
.
dofIndex
()];
}
// required for compatibility with the box method
const
VolumeVariables
&
volVars
(
const
IndexType
scvIdx
,
const
IndexType
localIdx
)
const
const
VolumeVariables
&
volVars
(
const
std
::
size_t
scvIdx
,
const
std
::
size_t
localIdx
)
const
{
return
volumeVariables_
[
scvIdx
];
}
// required for compatibility with the box method
VolumeVariables
&
volVars
(
const
IndexType
scvIdx
,
const
IndexType
localIdx
)
VolumeVariables
&
volVars
(
const
std
::
size_t
scvIdx
,
const
std
::
size_t
localIdx
)
{
return
volumeVariables_
[
scvIdx
];
}
//! The problem we are solving
...
...
@@ -140,22 +136,25 @@ private:
//! Specialization when the current volume variables are not stored globally
template
<
class
T
ypeTag
>
class
CCGridVolumeVariables
<
T
ypeTag
,
/*enableGridVolVarsCache
*/
false
>
template
<
class
T
raits
>
class
CCGridVolumeVariables
<
T
raits
,
/*cachingEnabled
*/
false
>
{
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
SolutionVector
=
typename
GET_PROP_TYPE
(
TypeTag
,
SolutionVector
);
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
using
ThisType
=
CCGridVolumeVariables
<
Traits
,
false
>
;
using
Problem
=
typename
Traits
::
Problem
;
public:
//! export the
type of the local view
using
LocalView
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
VolumeVariables
)
;
//! export the
volume variables type
using
VolumeVariables
=
typename
Traits
::
VolumeVariables
;
//! make it possible to query if caching is enabled
static
constexpr
bool
cachingEnabled
=
false
;
//! export the type of the local view
using
LocalView
=
typename
Traits
::
template
LocalView
<
ThisType
,
cachingEnabled
>;
CCGridVolumeVariables
(
const
Problem
&
problem
)
:
problemPtr_
(
&
problem
)
{}
template
<
class
FVGridGeometry
,
class
SolutionVector
>
void
update
(
const
FVGridGeometry
&
fvGridGeometry
,
const
SolutionVector
&
sol
)
{}
//! The problem we are solving
...
...
@@ -166,6 +165,6 @@ private:
const
Problem
*
problemPtr_
;
};
}
// end namespace
}
// end namespace
Dumux
#endif
dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
View file @
812027d4
...
...
@@ -25,7 +25,8 @@
#define DUMUX_DISCRETIZATION_CCMPFA_ELEMENT_VOLUMEVARIABLES_HH
#include
<utility>
#include
<dumux/common/properties.hh>
#include
<type_traits>
#include
<dumux/discretization/cellcentered/elementsolution.hh>
namespace
Dumux
{
...
...
@@ -34,8 +35,10 @@ namespace Dumux {
* \ingroup CCMpfaDiscretization
* \brief The local (stencil) volume variables class for cell centered mpfa models
* \note The class is specilized for versions with and without caching
* \tparam GVV the grid volume variables type
* \tparam cachingEnabled if the cache is enabled
*/
template
<
class
TypeTag
,
bool
enableGridVolVarsCache
>
template
<
class
GVV
,
bool
cachingEnabled
>
class
CCMpfaElementVolumeVariables
;
/*!
...
...
@@ -43,42 +46,39 @@ class CCMpfaElementVolumeVariables;
* \brief The local (stencil) volume variables class for cell centered mpfa models with caching
* \note the volume variables are stored for the whole grid view in the corresponding GridVolumeVariables class
*/
template
<
class
TypeTag
>
class
CCMpfaElementVolumeVariables
<
TypeTag
,
/*enableGridVolVarsCache
*/
true
>
template
<
class
GVV
>
class
CCMpfaElementVolumeVariables
<
GVV
,
/*cachingEnabled
*/
true
>
{
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
);
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
FVElementGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
)
::
LocalView
;
using
VolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
VolumeVariables
);
using
GridVolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridVolumeVariables
);
using
SubControlVolume
=
typename
FVElementGeometry
::
SubControlVolume
;
using
GridIndexType
=
typename
GridView
::
IndexSet
::
IndexType
;
public:
//! Export type of the solution vector
using
SolutionVector
=
typename
GET_PROP_TYPE
(
TypeTag
,
SolutionVector
);
//! export type of the grid volume variables
using
GridVolumeVariables
=
GVV
;
//! export type of the volume variables
using
VolumeVariables
=
typename
GridVolumeVariables
::
VolumeVariables
;
//! Constructor
CCMpfaElementVolumeVariables
(
const
GridVolumeVariables
&
gridVolVars
)
:
gridVolVarsPtr_
(
&
gridVolVars
)
{}
//! operator for the access with an scv
template
<
class
SubControlVolume
,
typename
std
::
enable_if_t
<!
std
::
is_integral
<
SubControlVolume
>
::
value
,
int
>
=
0
>
const
VolumeVariables
&
operator
[](
const
SubControlVolume
&
scv
)
const
{
return
gridVolVars
().
volVars
(
scv
.
dofIndex
());
}
//! operator for the access with an index
const
VolumeVariables
&
operator
[](
const
GridIndexType
scvIdx
)
const
const
VolumeVariables
&
operator
[](
const
std
::
size_t
scvIdx
)
const
{
return
gridVolVars
().
volVars
(
scvIdx
);
}
//! precompute all volume variables in a stencil of an element - do nothing volVars: are cached
void
bind
(
const
Element
&
element
,
template
<
class
FVElementGeometry
,
class
SolutionVector
>
void
bind
(
const
typename
FVElementGeometry
::
FVGridGeometry
::
GridView
::
template
Codim
<
0
>
::
Entity
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
{}
//! precompute the volume variables of an element - do nothing: volVars are cached
void
bindElement
(
const
Element
&
element
,
template
<
class
FVElementGeometry
,
class
SolutionVector
>
void
bindElement
(
const
typename
FVElementGeometry
::
FVGridGeometry
::
GridView
::
template
Codim
<
0
>
::
Entity
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
{}
...
...
@@ -96,29 +96,23 @@ private:
* \ingroup CCMpfaDiscretization
* \brief The local (stencil) volume variables class for cell centered tpfa models with caching
*/
template
<
class
TypeTag
>
class
CCMpfaElementVolumeVariables
<
TypeTag
,
/*enableGridVolVarsCache
*/
false
>
template
<
class
GVV
>
class
CCMpfaElementVolumeVariables
<
GVV
,
/*cachingEnabled
*/
false
>
{
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
);
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
VolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
VolumeVariables
);
using
GridVolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridVolumeVariables
);
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
using
FVElementGeometry
=
typename
FVGridGeometry
::
LocalView
;
using
SubControlVolume
=
typename
FVElementGeometry
::
SubControlVolume
;
using
GridIndexType
=
typename
GridView
::
IndexSet
::
IndexType
;
public:
//! Export type of the solution vector
using
SolutionVector
=
typename
GET_PROP_TYPE
(
TypeTag
,
SolutionVector
);
//! export type of the grid volume variables
using
GridVolumeVariables
=
GVV
;
//! export type of the volume variables
using
VolumeVariables
=
typename
GridVolumeVariables
::
VolumeVariables
;
//! Constructor
CCMpfaElementVolumeVariables
(
const
GridVolumeVariables
&
gridVolVars
)
:
gridVolVarsPtr_
(
&
gridVolVars
)
{}
//! Prepares the volume variables within the element stencil
void
bind
(
const
Element
&
element
,
template
<
class
FVElementGeometry
,
class
SolutionVector
>
void
bind
(
const
typename
FVElementGeometry
::
FVGridGeometry
::
GridView
::
template
Codim
<
0
>
::
Entity
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
{
...
...
@@ -182,8 +176,7 @@ public:
{
// boundary volume variables
VolumeVariables
dirichletVolVars
;
dirichletVolVars
.
update
(
elementSolution
<
SolutionVector
,
FVGridGeometry
>
(
problem
.
dirichlet
(
element
,
scvf
)),
dirichletVolVars
.
update
(
elementSolution
<
FVElementGeometry
>
(
problem
.
dirichlet
(
element
,
scvf
)),
problem
,
element
,
scvI
);
...
...
@@ -238,7 +231,8 @@ public:
}
//! Prepares the volume variables of an element
void
bindElement
(
const
Element
&
element
,
template
<
class
FVElementGeometry
,
class
SolutionVector
>
void
bindElement
(
const
typename
FVElementGeometry
::
FVGridGeometry
::
GridView
::
template
Codim
<
0
>
::
Entity
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
{
...
...
@@ -259,19 +253,21 @@ public:
}
//! access operator with scv
template
<
class
SubControlVolume
,
typename
std
::
enable_if_t
<!
std
::
is_integral
<
SubControlVolume
>
::
value
,
int
>
=
0
>
const
VolumeVariables
&
operator
[](
const
SubControlVolume
&
scv
)
const
{
return
volumeVariables_
[
getLocalIdx_
(
scv
.
dofIndex
())];
}
//! access operator with scv
template
<
class
SubControlVolume
,
typename
std
::
enable_if_t
<!
std
::
is_integral
<
SubControlVolume
>
::
value
,
int
>
=
0
>
VolumeVariables
&
operator
[](
const
SubControlVolume
&
scv
)
{
return
volumeVariables_
[
getLocalIdx_
(
scv
.
dofIndex
())];
}
//! access operator with scv index
const
VolumeVariables
&
operator
[](
GridIndexType
scvIdx
)
const
const
VolumeVariables
&
operator
[](
std
::
size_t
scvIdx
)
const
{
return
volumeVariables_
[
getLocalIdx_
(
scvIdx
)];
}
//! access operator with scv index
VolumeVariables
&
operator
[](
GridIndexType
scvIdx
)
VolumeVariables
&
operator
[](
std
::
size_t
scvIdx
)
{
return
volumeVariables_
[
getLocalIdx_
(
scvIdx
)];
}
//! The global volume variables object we are a restriction of
...
...
@@ -293,6 +289,7 @@ private:
// needed number of volume variables. However, memory is not an issue for the global
// caching being deactivated and we want to make sure we reserve enough memory here.
// TODO: What about non-symmetric schemes? Is there a better way for estimating this?
template
<
class
FVElementGeometry
>
std
::
size_t
maxNumBoundaryVolVars_
(
const
FVElementGeometry
&
fvGeometry
)
{
const
auto
&
fvGridGeometry
=
fvGeometry
.
fvGridGeometry
();
...
...
@@ -311,7 +308,7 @@ private:
}
//! adds the volume variables from a given nodal index set to the local containers
template
<
class
NodalIndexSet
>
template
<
class
Problem
,
class
FVElementGeometry
,
class
NodalIndexSet
>
void
addBoundaryVolVars_
(
const
Problem
&
problem
,
const
FVElementGeometry
&
fvGeometry
,
const
NodalIndexSet
&
nodalIndexSet
)
{
// check each scvf in the index set for boundary presence
...
...
@@ -333,8 +330,7 @@ private:
{
VolumeVariables
dirichletVolVars
;
const
auto
&
ivScv
=
fvGeometry
.
scv
(
insideScvIdx
);
dirichletVolVars
.
update
(
elementSolution
<
SolutionVector
,
FVGridGeometry
>
(
problem
.
dirichlet
(
insideElement
,
ivScvf
)),
dirichletVolVars
.
update
(
elementSolution
<
FVElementGeometry
>
(
problem
.
dirichlet
(
insideElement
,
ivScvf
)),
problem
,
insideElement
,
ivScv
);
...
...
@@ -353,7 +349,7 @@ private:
return
std
::
distance
(
volVarIndices_
.
begin
(),
it
);
}
std
::
vector
<
GridIndexType
>
volVarIndices_
;
std
::
vector
<
std
::
size_t
>
volVarIndices_
;
std
::
vector
<
VolumeVariables
>
volumeVariables_
;
};
...
...
dumux/discretization/cellcentered/mpfa/gridvolumevariables.hh
0 → 100644
View file @
812027d4
// -*- 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 CCMpfaDiscretization
* \brief The grid volume variables class for cell centered mpfa models
*/
#ifndef DUMUX_DISCRETIZATION_CC_MPFA_GRID_VOLUMEVARIABLES_HH
#define DUMUX_DISCRETIZATION_CC_MPFA_GRID_VOLUMEVARIABLES_HH
#include
<dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh>
#include
<dumux/discretization/cellcentered/gridvolumevariables.hh>
namespace
Dumux
{
template
<
class
P
,
class
VV
>
struct
CCMpfaDefaultGridVolumeVariablesTraits
{
using
Problem
=
P
;
using
VolumeVariables
=
VV
;
template
<
class
GridVolumeVariables
,
bool
cachingEnabled
>
using
LocalView
=
CCMpfaElementVolumeVariables
<
GridVolumeVariables
,
cachingEnabled
>
;
};
/*!
* \ingroup CCMpfaDiscretization
* \brief Base class for the grid volume variables
* \note This class has a cached version and a non-cached version
* \tparam Problem the type of problem we are solving
* \tparam VolumeVariables the type of volume variables we are using for the model
* \tparam Traits the traits class injecting the problem, volVar and elemVolVars type
* \tparam cachingEnabled if the cache is enabled
*/
template
<
class
Problem
,
class
VolumeVariables
,
bool
cachingEnabled
=
false
,
class
Traits
=
CCMpfaDefaultGridVolumeVariablesTraits
<
Problem
,
VolumeVariables
>
>
class
CCMpfaGridVolumeVariables
:
public
CCGridVolumeVariables
<
Traits
,
cachingEnabled
>
{
public:
using
ParentType
=
CCGridVolumeVariables
<
Traits
,
cachingEnabled
>
;
using
ParentType
::
ParentType
;
};
}
// end namespace Dumux
#endif
dumux/discretization/cellcentered/mpfa/properties.hh
View file @
812027d4
...
...
@@ -34,24 +34,22 @@
#include
<dumux/discretization/fvproperties.hh>
#include
<dumux/discretization/cellcentered/gridvolumevariables.hh>
#include
<dumux/discretization/cellcentered/elementsolution.hh>
#include
<dumux/discretization/cellcentered/elementboundarytypes.hh>
#include
<dumux/discretization/cellcentered/mpfa/methods.hh>
#include
<dumux/discretization/cellcentered/mpfa/fvgridgeometrytraits.hh>
#include
<dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh>
#include
<dumux/discretization/cellcentered/mpfa/gridvolumevariables.hh>
#include
<dumux/discretization/cellcentered/mpfa/gridfluxvariablescache.hh>
#include
<dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh>
#include
<dumux/discretization/cellcentered/mpfa/elementfluxvariablescache.hh>
#include
<dumux/discretization/cellcentered/mpfa/dualgridindexset.hh>
#include
<dumux/discretization/cellcentered/mpfa/omethod/interactionvolume.hh>
namespace
Dumux
{
namespace
Properties
{
namespace
Dumux
{
namespace
Properties
{
//! Type tag for the cell-centered mpfa scheme.
NEW_TYPE_TAG
(
CCMpfaModel
,
INHERITS_FROM
(
FiniteVolumeModel
));
...
...
@@ -99,6 +97,20 @@ public:
using
type
=
CCMpfaFVGridGeometry
<
GridView
,
Traits
,
GET_PROP_VALUE
(
TypeTag
,
EnableFVGridGeometryCache
)
>
;
};
//! The grid volume variables vector class
SET_PROP
(
CCMpfaModel
,
GridVolumeVariables
)
{
private:
static
constexpr
bool
enableCache
=
GET_PROP_VALUE
(
TypeTag
,
EnableGridVolumeVariablesCache
);
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
VolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
VolumeVariables
);
public:
using
type
=
CCMpfaGridVolumeVariables
<
Problem
,
VolumeVariables
,
enableCache
>
;
};
//! The element volume variables vector class
SET_TYPE_PROP
(
CCMpfaModel
,
ElementVolumeVariables
,
typename
GET_PROP_TYPE
(
TypeTag
,
GridVolumeVariables
)
::
LocalView
);
//! The global flux variables cache vector class
SET_TYPE_PROP
(
CCMpfaModel
,
GridFluxVariablesCache
,
...
...
@@ -109,15 +121,6 @@ SET_TYPE_PROP(CCMpfaModel,
ElementFluxVariablesCache
,
CCMpfaElementFluxVariablesCache
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
EnableGridFluxVariablesCache
)
>
);
//! The global previous volume variables vector class
SET_TYPE_PROP
(
CCMpfaModel
,
ElementVolumeVariables
,
CCMpfaElementVolumeVariables
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
EnableGridVolumeVariablesCache
)
>
);
//! The global current volume variables vector class
SET_TYPE_PROP
(
CCMpfaModel
,
GridVolumeVariables
,
CCGridVolumeVariables
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
EnableGridVolumeVariablesCache
)
>
);
//! Set the default for the ElementBoundaryTypes
SET_TYPE_PROP
(
CCMpfaModel
,
ElementBoundaryTypes
,
CCElementBoundaryTypes
);
...
...
dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh
View file @
812027d4
...
...
@@ -24,7 +24,8 @@
#ifndef DUMUX_DISCRETIZATION_CCTPFA_ELEMENT_VOLUMEVARIABLES_HH