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
679dcfa2
Commit
679dcfa2
authored
Mar 10, 2018
by
Kilian Weishaupt
Committed by
Dennis Gläser
Apr 05, 2018
Browse files
[staggered] Remove TypeTag from Grid/ElementFaceVariables
parent
8be74d63
Changes
10
Hide whitespace changes
Inline
Side-by-side
dumux/assembly/staggeredlocalassembler.hh
View file @
679dcfa2
...
...
@@ -93,7 +93,7 @@ class StaggeredLocalAssembler<TypeTag,
using
FacePrimaryVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FacePrimaryVariables
);
using
CellCenterPrimaryVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
CellCenterPrimaryVariables
);
using
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FaceVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
FaceVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Grid
FaceVariables
)
::
LocalView
;
using
SubControlVolumeFace
=
typename
FVElementGeometry
::
SubControlVolumeFace
;
static
constexpr
bool
enableGridFluxVarsCache
=
GET_PROP_VALUE
(
TypeTag
,
EnableGridFluxVariablesCache
);
...
...
dumux/assembly/staggeredlocalresidual.hh
View file @
679dcfa2
...
...
@@ -55,7 +55,7 @@ class StaggeredLocalResidual
using
CellCenterResidual
=
typename
GET_PROP_TYPE
(
TypeTag
,
CellCenterPrimaryVariables
);
using
FaceResidual
=
typename
GET_PROP_TYPE
(
TypeTag
,
FacePrimaryVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
FaceVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Grid
FaceVariables
)
::
LocalView
;
using
TimeLoop
=
TimeLoopBase
<
Scalar
>
;
...
...
dumux/common/properties.hh
View file @
679dcfa2
...
...
@@ -162,7 +162,6 @@ NEW_PROP_TAG(BaseEpsilon); //!< A base epsilon for numer
NEW_PROP_TAG
(
FaceVariables
);
//!< Class containing local face-related data
NEW_PROP_TAG
(
BoundaryValues
);
//!< Class containing local boundary data
NEW_PROP_TAG
(
StaggeredFaceSolution
);
//!< A vector containing the solution for a face (similar to ElementSolution)
NEW_PROP_TAG
(
ElementFaceVariables
);
//!< Face related varibles (similar to volume variables)
NEW_PROP_TAG
(
EnableGridFaceVariablesCache
);
//!< Switch on/off caching of face variables
/////////////////////////////////////////////////////////////
...
...
dumux/discretization/staggered/elementfacevariables.hh
View file @
679dcfa2
...
...
@@ -24,8 +24,6 @@
#ifndef DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
#define DUMUX_DISCRETIZATION_STAGGERED_ELEMENTFACEVARIABLES_HH
#include
<dumux/common/properties.hh>
namespace
Dumux
{
...
...
@@ -33,7 +31,7 @@ namespace Dumux
* \ingroup StaggeredDiscretization
* \brief Base class for the face variables vector
*/
template
<
class
TypeTag
,
bool
enableGridFaceVariablesCache
>
template
<
class
FVGridGeometry
,
class
GridFaceVariables
,
bool
enableGridFaceVariablesCache
>
class
StaggeredElementFaceVariables
{};
...
...
@@ -41,17 +39,15 @@ class StaggeredElementFaceVariables
* \ingroup StaggeredDiscretization
* \brief Class for the face variables vector. Specialization for the case of storing the face variables globally.
*/
template
<
class
TypeTag
>
class
StaggeredElementFaceVariables
<
TypeTag
,
/*enableGridFaceVariablesCache*/
true
>
template
<
class
FVGridGeometry
,
class
GridFaceVariables
>
class
StaggeredElementFaceVariables
<
FVGridGeometry
,
GridFaceVariables
,
/*enableGridFaceVariablesCache*/
true
>
{
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
)
;
using
GridView
=
typename
FVGridGeometry
::
GridView
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
SolutionVector
=
typename
GET_PROP_TYPE
(
TypeTag
,
SolutionVector
);
using
FVElementGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
)
::
LocalView
;
using
SubControlVolumeFace
=
typename
FVElementGeometry
::
SubControlVolumeFace
;
using
GridFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridFaceVariables
);
using
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FaceVariables
);
using
SubControlVolumeFace
=
typename
FVGridGeometry
::
SubControlVolumeFace
;
using
IndexType
=
typename
GridView
::
IndexSet
::
IndexType
;
using
FaceVariables
=
typename
GridFaceVariables
::
FaceVariables
;
using
FVElementGeometry
=
typename
FVGridGeometry
::
LocalView
;
public:
...
...
@@ -69,6 +65,7 @@ public:
//! For compatibility reasons with the case of not storing the face vars.
//! function to be called before assembling an element, preparing the vol vars within the stencil
template
<
class
SolutionVector
>
void
bind
(
const
Element
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
...
...
@@ -76,6 +73,7 @@ public:
//! Binding of an element, prepares only the face variables of the element
//! specialization for Staggered models
template
<
class
SolutionVector
>
void
bindElement
(
const
Element
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
...
...
@@ -95,21 +93,17 @@ private:
* \ingroup StaggeredDiscretization
* \brief Class for the face variables vector. Specialization for the case of not storing the face variables globally.
*/
template
<
class
TypeTag
>
class
StaggeredElementFaceVariables
<
TypeTag
,
/*enableGridFaceVariablesCache*/
false
>
template
<
class
FVGridGeometry
,
class
GridFaceVariables
>
class
StaggeredElementFaceVariables
<
FVGridGeometry
,
GridFaceVariables
,
/*enableGridFaceVariablesCache*/
false
>
{
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
)
;
using
GridView
=
typename
FVGridGeometry
::
GridView
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
SolutionVector
=
typename
GET_PROP_TYPE
(
TypeTag
,
SolutionVector
);
using
FVElementGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
)
::
LocalView
;
using
SubControlVolumeFace
=
typename
FVElementGeometry
::
SubControlVolumeFace
;
using
GridFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridFaceVariables
);
using
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FaceVariables
);
using
SubControlVolumeFace
=
typename
FVGridGeometry
::
SubControlVolumeFace
;
using
IndexType
=
typename
GridView
::
IndexSet
::
IndexType
;
using
FaceVariables
=
typename
GridFaceVariables
::
FaceVariables
;
using
FVElementGeometry
=
typename
FVGridGeometry
::
LocalView
;
using
DofTypeIndices
=
typename
GET_PROP
(
TypeTag
,
DofTypeIndices
);
typename
DofTypeIndices
::
CellCenterIdx
cellCenterIdx
;
typename
DofTypeIndices
::
FaceIdx
faceIdx
;
static
constexpr
auto
faceIdx
=
FVGridGeometry
::
faceIdx
();
public:
...
...
@@ -133,6 +127,7 @@ public:
//! For compatibility reasons with the case of not storing the vol vars.
//! function to be called before assembling an element, preparing the vol vars within the stencil
template
<
class
SolutionVector
>
void
bind
(
const
Element
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
...
...
@@ -149,6 +144,7 @@ public:
//! Binding of an element, prepares only the face variables of the element
//! specialization for Staggered models
template
<
class
SolutionVector
>
void
bindElement
(
const
Element
&
element
,
const
FVElementGeometry
&
fvGeometry
,
const
SolutionVector
&
sol
)
...
...
dumux/discretization/staggered/gridfacevariables.hh
View file @
679dcfa2
...
...
@@ -24,9 +24,6 @@
#ifndef DUMUX_DISCRETIZATION_STAGGERED_GRID_FACEVARIABLES_HH
#define DUMUX_DISCRETIZATION_STAGGERED_GRID_FACEVARIABLES_HH
#include
<dumux/common/properties.hh>
#include
<dumux/discretization/staggered/facesolution.hh>
//! make the local view function available whenever we use this class
#include
<dumux/discretization/localview.hh>
...
...
@@ -36,7 +33,7 @@ namespace Dumux {
* \ingroup StaggeredDiscretization
* \brief Face variables cache class for staggered models
*/
template
<
class
TypeTag
,
bool
enableGlobalFaceVarsCache
>
template
<
class
FVGridGeometry
,
class
Traits
,
bool
enableGlobalFaceVarsCache
>
class
StaggeredGridFaceVariables
;
/*!
...
...
@@ -44,29 +41,26 @@ class StaggeredGridFaceVariables;
* \brief Face variables cache class for staggered models.
Specialization in case of storing the face variables.
*/
template
<
class
TypeTag
>
class
StaggeredGridFaceVariables
<
TypeTag
,
/*enableGlobalFaceVarsCache*/
true
>
template
<
class
FVGridGeometry
,
class
Traits
>
class
StaggeredGridFaceVariables
<
FVGridGeometry
,
Traits
,
/*enableGlobalFaceVarsCache*/
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
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FaceVariables
);
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
using
IndexType
=
typename
GridView
::
IndexSet
::
IndexType
;
using
DofTypeIndices
=
typename
GET_PROP
(
TypeTag
,
DofTypeIndices
);
typename
DofTypeIndices
::
FaceIdx
faceIdx
;
using
ThisType
=
StaggeredGridFaceVariables
<
FVGridGeometry
,
Traits
,
true
>
;
using
IndexType
=
typename
FVGridGeometry
::
GridView
::
IndexSet
::
IndexType
;
using
Problem
=
typename
Traits
::
Problem
;
public:
//! export the type of the local view
using
LocalView
=
typename
GET_PROP_TYPE
(
TypeTag
,
ElementFaceVariables
);
using
LocalView
=
typename
Traits
::
template
LocalView
<
FVGridGeometry
,
ThisType
,
true
>;
//! export the type of the face variables
using
FaceVariables
=
typename
Traits
::
FaceVariables
;
StaggeredGridFaceVariables
(
const
Problem
&
problem
)
:
problemPtr_
(
&
problem
)
{}
//! Update all face variables
void
update
(
const
FVGridGeometry
&
fvGridGeometry
,
const
SolutionVector
&
sol
)
template
<
class
SolutionVector
>
void
update
(
const
FVGridGeometry
&
fvGridGeometry
,
const
SolutionVector
&
faceSol
)
{
const
auto
&
faceSol
=
sol
[
faceIdx
];
faceVariables_
.
resize
(
fvGridGeometry
.
numScvf
());
for
(
auto
&&
element
:
elements
(
fvGridGeometry
.
gridView
()))
...
...
@@ -102,20 +96,22 @@ private:
* \brief Face variables cache class for staggered models.
Specialization in case of not storing the face variables.
*/
template
<
class
TypeTag
>
class
StaggeredGridFaceVariables
<
TypeTag
,
/*enableGlobalFaceVarsCache*/
false
>
template
<
class
FVGridGeometry
,
class
Traits
>
class
StaggeredGridFaceVariables
<
FVGridGeometry
,
Traits
,
/*enableGlobalFaceVarsCache*/
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
=
StaggeredGridFaceVariables
<
FVGridGeometry
,
Traits
,
false
>
;
using
Problem
=
typename
Traits
::
Problem
;
public:
//! export the type of the local view
using
LocalView
=
typename
GET_PROP_TYPE
(
TypeTag
,
ElementFaceVariables
);
using
LocalView
=
typename
Traits
::
template
LocalView
<
FVGridGeometry
,
ThisType
,
false
>;
//! export the type of the face variables
using
FaceVariables
=
typename
Traits
::
FaceVariables
;
StaggeredGridFaceVariables
(
const
Problem
&
problem
)
:
problemPtr_
(
&
problem
)
{}
//! Do nothing here.
template
<
class
SolutionVector
>
void
update
(
const
FVGridGeometry
&
fvGridGeometry
,
const
SolutionVector
&
sol
)
{}
const
Problem
&
problem
()
const
...
...
dumux/discretization/staggered/gridvariables.hh
View file @
679dcfa2
...
...
@@ -41,11 +41,18 @@ class StaggeredGridVariables : public FVGridVariables<GG, GVV, GFVC>
{
using
ParentType
=
FVGridVariables
<
GG
,
GVV
,
GFVC
>
;
using
FVGridGeometry
=
GG
;
static
constexpr
auto
cellCenterIdx
=
FVGridGeometry
::
cellCenterIdx
();
static
constexpr
auto
faceIdx
=
FVGridGeometry
::
faceIdx
();
public:
//! export the type of the grid volume variables
using
GridVolumeVariables
=
GVV
;
//! export the type of the grid flux variables cache
using
GridFluxVariablesCache
=
GFVC
;
//! export the type of the grid face variables
using
GridFaceVariables
=
GFV
;
public:
//! Constructor
template
<
class
Problem
>
StaggeredGridVariables
(
std
::
shared_ptr
<
Problem
>
problem
,
...
...
@@ -60,7 +67,7 @@ public:
void
update
(
const
SolutionVector
&
curSol
)
{
ParentType
::
update
(
curSol
);
curGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
curSol
);
curGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
curSol
[
faceIdx
]
);
}
//! initialize all variables (stationary case)
...
...
@@ -68,7 +75,7 @@ public:
void
init
(
const
SolutionVector
&
curSol
)
{
ParentType
::
init
(
curSol
);
curGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
curSol
);
curGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
curSol
[
faceIdx
]
);
}
//! initialize all variables (instationary case)
...
...
@@ -76,8 +83,8 @@ public:
void
init
(
const
SolutionVector
&
curSol
,
const
SolutionVector
&
initSol
)
{
ParentType
::
init
(
curSol
,
initSol
);
curGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
curSol
);
prevGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
initSol
);
curGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
curSol
[
faceIdx
]
);
prevGridFaceVariables_
.
update
(
*
this
->
fvGridGeometry_
,
initSol
[
faceIdx
]
);
}
//! Sets the current state as the previous for next time step
...
...
dumux/discretization/staggered/properties.hh
View file @
679dcfa2
...
...
@@ -52,6 +52,8 @@
#include
<dune/istl/multitypeblockvector.hh>
#include
<dune/istl/multitypeblockmatrix.hh>
#include
<dumux/discretization/staggered/gridvariablestraits.hh>
namespace
Dumux
{
// forward declarations
...
...
@@ -63,10 +65,19 @@ namespace Properties
NEW_TYPE_TAG
(
StaggeredModel
,
INHERITS_FROM
(
FiniteVolumeModel
));
//! Set the default global face variables cache vector class
SET_TYPE_PROP
(
StaggeredModel
,
GridFaceVariables
,
StaggeredGridFaceVariables
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
EnableGridFaceVariablesCache
)
>
);
SET_PROP
(
StaggeredModel
,
GridFaceVariables
)
{
private:
using
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FaceVariables
);
using
FVGridGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
);
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
static
constexpr
auto
enableCache
=
GET_PROP_VALUE
(
TypeTag
,
EnableGridFaceVariablesCache
);
//! Set the default element face variables
SET_TYPE_PROP
(
StaggeredModel
,
ElementFaceVariables
,
StaggeredElementFaceVariables
<
TypeTag
,
GET_PROP_VALUE
(
TypeTag
,
EnableGridFaceVariablesCache
)
>
);
using
Traits
=
StaggeredGridFaceVariablesTraits
<
FaceVariables
,
Problem
>
;
public:
using
type
=
StaggeredGridFaceVariables
<
FVGridGeometry
,
Traits
,
enableCache
>
;
};
//! Cache the face variables per default
SET_BOOL_PROP
(
StaggeredModel
,
EnableGridFaceVariablesCache
,
true
);
...
...
dumux/freeflow/navierstokes/staggered/fluxvariables.hh
View file @
679dcfa2
...
...
@@ -58,8 +58,8 @@ class NavierStokesFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered>
using
CellCenterPrimaryVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
CellCenterPrimaryVariables
);
using
FacePrimaryVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FacePrimaryVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
FaceVariables
);
using
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FaceVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Grid
FaceVariables
)
::
LocalView
;
using
FaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Grid
FaceVariables
)
::
FaceVariables
;
static
constexpr
bool
enableInertiaTerms
=
GET_PROP_VALUE
(
TypeTag
,
EnableInertiaTerms
);
static
constexpr
bool
normalizePressure
=
GET_PROP_VALUE
(
TypeTag
,
NormalizePressure
);
...
...
dumux/freeflow/navierstokes/staggered/localresidual.hh
View file @
679dcfa2
...
...
@@ -63,7 +63,7 @@ class NavierStokesResidualImpl<TypeTag, DiscretizationMethod::staggered>
using
FacePrimaryVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FacePrimaryVariables
);
using
Indices
=
typename
GET_PROP_TYPE
(
TypeTag
,
Indices
);
using
FluxVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
FluxVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
FaceVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Grid
FaceVariables
)
::
LocalView
;
using
CellCenterResidual
=
typename
GET_PROP_TYPE
(
TypeTag
,
CellCenterPrimaryVariables
);
using
FaceResidual
=
typename
GET_PROP_TYPE
(
TypeTag
,
FacePrimaryVariables
);
...
...
dumux/freeflow/navierstokesnc/staggered/fluxvariables.hh
View file @
679dcfa2
...
...
@@ -51,7 +51,7 @@ class NavierStokesNCFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered>
using
FVElementGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVGridGeometry
)
::
LocalView
;
using
Indices
=
typename
GET_PROP_TYPE
(
TypeTag
,
Indices
);
using
ElementVolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridVolumeVariables
)
::
LocalView
;
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Element
FaceVariables
);
using
ElementFaceVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
Grid
FaceVariables
)
::
LocalView
;
using
SubControlVolumeFace
=
typename
FVElementGeometry
::
SubControlVolumeFace
;
using
FluxVariablesCache
=
typename
GET_PROP_TYPE
(
TypeTag
,
FluxVariablesCache
);
using
CellCenterPrimaryVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
CellCenterPrimaryVariables
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment