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
3bad1abf
Commit
3bad1abf
authored
Dec 04, 2018
by
Kilian Weishaupt
Browse files
[freeflow] Remove TypeTag from FluxOverSurface
parent
73931c42
Changes
3
Hide whitespace changes
Inline
Side-by-side
dumux/freeflow/navierstokes/staggered/fluxoversurface.hh
View file @
3bad1abf
...
...
@@ -27,15 +27,14 @@
#include
<numeric>
#include
<functional>
#include
<type_traits>
#include
<vector>
#include
<dune/common/exceptions.hh>
#include
<dune/common/fvector.hh>
#include
<dune/common/fmatrix.hh>
#include
<dune/geometry/type.hh>
#include
<dune/geometry/multilineargeometry.hh>
#include
<dune/geometry/referenceelements.hh>
#include
<dumux/common/properties.hh>
#include
<dumux/common/parameters.hh>
#include
<dumux/common/geometry/makegeometry.hh>
#include
<dumux/common/geometry/intersectspointgeometry.hh>
...
...
@@ -46,22 +45,19 @@ namespace Dumux {
* \ingroup NavierStokesModel
* \brief Class used to calculate fluxes over surfaces. This only works for the staggered grid discretization.
*/
template
<
class
TypeTag
>
template
<
class
GridVariables
,
class
SolutionVector
,
class
ModelTraits
,
class
LocalResidual
>
class
FluxOverSurface
{
using
Scalar
=
GetPropType
<
TypeTag
,
Properties
::
Scalar
>
;
using
GridView
=
GetPropType
<
TypeTag
,
Properties
::
GridView
>
;
using
Problem
=
GetPropType
<
TypeTag
,
Properties
::
Problem
>
;
using
FVElementGeometry
=
typename
GetPropType
<
TypeTag
,
Properties
::
FVGridGeometry
>::
LocalView
;
using
Scalar
=
typename
GridVariables
::
Scalar
;
using
FVGridGeometry
=
typename
GridVariables
::
GridGeometry
;
using
FVElementGeometry
=
typename
FVGridGeometry
::
LocalView
;
using
SubControlVolumeFace
=
typename
FVElementGeometry
::
SubControlVolumeFace
;
using
SolutionVector
=
GetPropType
<
TypeTag
,
Properties
::
SolutionVector
>
;
using
GridVariables
=
GetPropType
<
TypeTag
,
Properties
::
GridVariables
>
;
using
LocalResidual
=
GetPropType
<
TypeTag
,
Properties
::
LocalResidual
>
;
using
VolumeVariables
=
GetPropType
<
TypeTag
,
Properties
::
VolumeVariables
>
;
using
CellCenterPrimaryVariables
=
GetPropType
<
TypeTag
,
Properties
::
CellCenterPrimaryVariables
>
;
using
Indices
=
typename
GetPropType
<
TypeTag
,
Properties
::
ModelTraits
>::
Indices
;
using
GridView
=
typename
FVGridGeometry
::
GridView
;
using
VolumeVariables
=
typename
GridVariables
::
VolumeVariables
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
using
CellCenterPrimaryVariables
=
std
::
decay_t
<
decltype
(
std
::
declval
<
SolutionVector
>
()[
FVGridGeometry
::
cellCenterIdx
()][
0
])
>
;
enum
{
// Grid and world dimension
dim
=
GridView
::
dimension
,
...
...
@@ -140,7 +136,6 @@ class FluxOverSurface
std
::
vector
<
CellCenterPrimaryVariables
>
values_
;
};
public:
using
SurfaceList
=
std
::
vector
<
SurfaceGeometryType
>
;
...
...
@@ -148,14 +143,12 @@ public:
/*!
* \brief The constructor
*/
FluxOverSurface
(
const
Problem
&
problem
,
const
GridVariables
&
gridVariables
,
FluxOverSurface
(
const
GridVariables
&
gridVariables
,
const
SolutionVector
&
sol
)
:
problem_
(
problem
),
gridVariables_
(
gridVariables
),
:
gridVariables_
(
gridVariables
),
sol_
(
sol
)
{
verbose_
=
getParamFromGroup
<
bool
>
(
problem
.
paramGroup
(),
"FluxOverSurface.Verbose"
,
false
);
verbose_
=
getParamFromGroup
<
bool
>
(
problem
_
()
.
paramGroup
(),
"FluxOverSurface.Verbose"
,
false
);
}
/*!
...
...
@@ -233,8 +226,8 @@ public:
const
auto
&
scvf
,
const
auto
&
elemFluxVarsCache
)
{
LocalResidual
localResidual
(
&
problem_
);
return
localResidual
.
computeFluxForCellCenter
(
problem_
,
element
,
fvGeometry
,
elemVolVars
,
elemFaceVars
,
scvf
,
elemFluxVarsCache
);
LocalResidual
localResidual
(
&
problem_
()
);
return
localResidual
.
computeFluxForCellCenter
(
problem_
()
,
element
,
fvGeometry
,
elemVolVars
,
elemFaceVars
,
scvf
,
elemFluxVarsCache
);
};
calculateFluxes
(
fluxType
);
...
...
@@ -245,7 +238,7 @@ public:
*/
void
calculateVolumeFluxes
()
{
const
auto
isCompositional
=
std
::
integral_constant
<
bool
,
(
GetPropType
<
TypeTag
,
Properties
::
ModelTraits
>
::
numFluidComponents
()
>
1
)
>
();
const
auto
isCompositional
=
std
::
integral_constant
<
bool
,
(
ModelTraits
::
numFluidComponents
()
>
1
)
>
();
calculateVolumeFluxesImpl_
(
isCompositional
);
}
...
...
@@ -269,15 +262,15 @@ public:
surface
.
second
.
resetValues
();
// make sure not to iterate over the same dofs twice
std
::
vector
<
bool
>
dofVisited
(
problem_
.
fvGridGeometry
().
numFaceDofs
(),
false
);
std
::
vector
<
bool
>
dofVisited
(
problem_
()
.
fvGridGeometry
().
numFaceDofs
(),
false
);
auto
elemVolVars
=
localView
(
gridVariables_
.
curGridVolVars
());
auto
elemFluxVarsCache
=
localView
(
gridVariables_
.
gridFluxVarsCache
());
auto
elemFaceVars
=
localView
(
gridVariables_
.
curGridFaceVars
());
for
(
auto
&&
element
:
elements
(
problem_
.
fvGridGeometry
().
gridView
()))
for
(
auto
&&
element
:
elements
(
problem_
()
.
fvGridGeometry
().
gridView
()))
{
auto
fvGeometry
=
localView
(
problem_
.
fvGridGeometry
());
auto
fvGeometry
=
localView
(
problem_
()
.
fvGridGeometry
());
fvGeometry
.
bind
(
element
);
elemVolVars
.
bind
(
element
,
fvGeometry
,
sol_
);
...
...
@@ -344,6 +337,8 @@ public:
private:
const
auto
&
problem_
()
const
{
return
gridVariables_
.
curGridVolVars
().
problem
();
}
/*!
* \brief Calculate the volume fluxes over all surfaces for compositional models.
* This method simply averages the densities between two adjacent cells.
...
...
@@ -357,13 +352,13 @@ private:
const
auto
&
scvf
,
const
auto
&
elemFluxVarsCache
)
{
LocalResidual
localResidual
(
&
problem_
);
const
auto
massOrMoleFlux
=
localResidual
.
computeFluxForCellCenter
(
problem_
,
element
,
fvGeometry
,
elemVolVars
,
elemFaceVars
,
scvf
,
elemFluxVarsCache
);
LocalResidual
localResidual
(
&
problem_
()
);
const
auto
massOrMoleFlux
=
localResidual
.
computeFluxForCellCenter
(
problem_
()
,
element
,
fvGeometry
,
elemVolVars
,
elemFaceVars
,
scvf
,
elemFluxVarsCache
);
const
auto
&
insideVolVars
=
elemVolVars
[
scvf
.
insideScvIdx
()];
const
auto
&
outsideVolVars
=
elemVolVars
[
scvf
.
outsideScvIdx
()];
constexpr
bool
useMoles
=
getPropValue
<
TypeTag
,
Properties
::
UseMoles
>
();
constexpr
bool
useMoles
=
false
;
//
getPropValue<TypeTag, Properties::UseMoles>();
const
auto
density
=
[
useMoles
](
const
auto
&
volVars
)
{
return
useMoles
?
volVars
.
molarDensity
()
:
volVars
.
density
()
;
...
...
@@ -371,8 +366,8 @@ private:
const
auto
avgDensity
=
0.5
*
density
(
insideVolVars
)
+
0.5
*
density
(
outsideVolVars
);
constexpr
auto
replaceCompEqIdx
=
getPropValue
<
TypeTag
,
Propertie
s
::
ReplaceCompEqIdx
>
();
constexpr
auto
numComponents
=
GetPropType
<
TypeTag
,
Properties
::
ModelTraits
>
::
numFluidComponents
();
constexpr
auto
replaceCompEqIdx
=
ModelTrait
s
::
ReplaceCompEqIdx
();
constexpr
auto
numComponents
=
ModelTraits
::
numFluidComponents
();
const
Scalar
cumulativeFlux
=
[
replaceCompEqIdx
,
numComponents
,
&
massOrMoleFlux
]()
{
...
...
@@ -409,8 +404,8 @@ private:
const
auto
&
scvf
,
const
auto
&
elemFluxVarsCache
)
{
LocalResidual
localResidual
(
&
problem_
);
const
Scalar
totalMassFlux
=
localResidual
.
computeFluxForCellCenter
(
problem_
,
element
,
fvGeometry
,
elemVolVars
,
LocalResidual
localResidual
(
&
problem_
()
);
const
Scalar
totalMassFlux
=
localResidual
.
computeFluxForCellCenter
(
problem_
()
,
element
,
fvGeometry
,
elemVolVars
,
elemFaceVars
,
scvf
,
elemFluxVarsCache
)[
0
];
const
auto
&
insideVolVars
=
elemVolVars
[
scvf
.
insideScvIdx
()];
...
...
@@ -427,7 +422,6 @@ private:
}
std
::
map
<
std
::
string
,
SurfaceData
<
surfaceDim
,
dim
>
>
surfaces_
;
const
Problem
&
problem_
;
const
GridVariables
&
gridVariables_
;
const
SolutionVector
&
sol_
;
bool
verbose_
;
...
...
test/freeflow/navierstokes/channel/2d/main.cc
View file @
3bad1abf
...
...
@@ -129,7 +129,10 @@ int main(int argc, char** argv) try
NewtonSolver
nonLinearSolver
(
assembler
,
linearSolver
);
// set up two surfaces over which fluxes are calculated
FluxOverSurface
<
TypeTag
>
flux
(
*
problem
,
*
gridVariables
,
x
);
FluxOverSurface
<
GridVariables
,
SolutionVector
,
GetPropType
<
TypeTag
,
Properties
::
ModelTraits
>
,
GetPropType
<
TypeTag
,
Properties
::
LocalResidual
>>
flux
(
*
gridVariables
,
x
);
using
GridView
=
GetPropType
<
TypeTag
,
Properties
::
GridView
>
;
using
Element
=
typename
GridView
::
template
Codim
<
0
>
::
Entity
;
...
...
test/freeflow/navierstokes/channel/3d/main.cc
View file @
3bad1abf
...
...
@@ -113,7 +113,10 @@ int main(int argc, char** argv) try
NewtonSolver
nonLinearSolver
(
assembler
,
linearSolver
);
// set up two planes over which fluxes are calculated
FluxOverSurface
<
TypeTag
>
flux
(
*
problem
,
*
gridVariables
,
x
);
FluxOverSurface
<
GridVariables
,
SolutionVector
,
GetPropType
<
TypeTag
,
Properties
::
ModelTraits
>
,
GetPropType
<
TypeTag
,
Properties
::
LocalResidual
>>
flux
(
*
gridVariables
,
x
);
using
GridView
=
GetPropType
<
TypeTag
,
Properties
::
GridView
>
;
using
Scalar
=
GetPropType
<
TypeTag
,
Properties
::
Scalar
>
;
using
GlobalPosition
=
Dune
::
FieldVector
<
Scalar
,
GridView
::
dimensionworld
>
;
...
...
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