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
6a0a04e0
Commit
6a0a04e0
authored
Dec 09, 2017
by
Kilian Weishaupt
Browse files
[freeflow][fluxVars] Add generic advectiveFlux function
* similiar to PM flow, takes lambda to get transported quantity
parent
703fd745
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/freeflow/navierstokes/staggered/fluxvariables.hh
View file @
6a0a04e0
...
...
@@ -91,6 +91,30 @@ class NavierStokesFluxVariablesImpl<TypeTag, DiscretizationMethods::Staggered>
public:
template
<
class
UpwindTerm
>
static
Scalar
advectiveFluxForCellCenter
(
const
ElementVolumeVariables
&
elemVolVars
,
const
ElementFaceVariables
&
elemFaceVars
,
const
SubControlVolumeFace
&
scvf
,
UpwindTerm
upwindTerm
,
bool
isOutflow
=
false
)
{
const
Scalar
velocity
=
elemFaceVars
[
scvf
].
velocitySelf
();
const
bool
insideIsUpstream
=
sign
(
scvf
.
outerNormalScalar
())
==
sign
(
velocity
);
static
const
Scalar
upWindWeight
=
getParamFromGroup
<
Scalar
>
(
GET_PROP_VALUE
(
TypeTag
,
ModelParameterGroup
),
"Implicit.UpwindWeight"
);
const
auto
&
insideVolVars
=
elemVolVars
[
scvf
.
insideScvIdx
()];
const
auto
&
outsideVolVars
=
isOutflow
?
insideVolVars
:
elemVolVars
[
scvf
.
outsideScvIdx
()];
const
auto
&
upstreamVolVars
=
insideIsUpstream
?
insideVolVars
:
outsideVolVars
;
const
auto
&
downstreamVolVars
=
insideIsUpstream
?
outsideVolVars
:
insideVolVars
;
const
Scalar
flux
=
(
upWindWeight
*
upwindTerm
(
upstreamVolVars
)
+
(
1.0
-
upWindWeight
)
*
upwindTerm
(
downstreamVolVars
))
*
velocity
*
scvf
.
area
()
*
sign
(
scvf
.
outerNormalScalar
());
return
flux
;
}
CellCenterPrimaryVariables
computeFluxForCellCenter
(
const
Problem
&
problem
,
const
Element
&
element
,
const
FVElementGeometry
&
fvGeometry
,
...
...
@@ -99,27 +123,14 @@ public:
const
SubControlVolumeFace
&
scvf
,
const
FluxVariablesCache
&
fluxVarsCache
)
{
const
auto
&
insideScv
=
fvGeometry
.
scv
(
scvf
.
insideScvIdx
());
const
auto
&
insideVolVars
=
elemVolVars
[
insideScv
];
auto
upwindTerm
=
[](
const
auto
&
volVars
)
{
return
volVars
.
density
();
};
// if we are on an inflow/outflow boundary, use the volVars of the element itself
const
auto
&
outsideVolVars
=
scvf
.
boundary
()
?
insideVolVars
:
elemVolVars
[
scvf
.
outsideScvIdx
()];
const
Scalar
flux
=
advectiveFluxForCellCenter
(
elemVolVars
,
elemFaceVars
,
scvf
,
upwindTerm
,
false
);
CellCenterPrimaryVariables
flux
(
0.0
);
const
Scalar
velocity
=
elemFaceVars
[
scvf
].
velocitySelf
()
;
CellCenterPrimaryVariables
result
(
0.0
);
result
[
massBalanceIdx
]
=
flux
;
const
bool
insideIsUpstream
=
sign
(
scvf
.
outerNormalScalar
())
==
sign
(
velocity
)
?
true
:
false
;
const
auto
&
upstreamVolVars
=
insideIsUpstream
?
insideVolVars
:
outsideVolVars
;
const
auto
&
downstreamVolVars
=
insideIsUpstream
?
insideVolVars
:
outsideVolVars
;
static
const
Scalar
upWindWeight
=
getParamFromGroup
<
Scalar
>
(
GET_PROP_VALUE
(
TypeTag
,
ModelParameterGroup
),
"Implicit.UpwindWeight"
);
flux
=
(
upWindWeight
*
upstreamVolVars
.
density
()
+
(
1.0
-
upWindWeight
)
*
downstreamVolVars
.
density
())
*
velocity
;
flux
*=
scvf
.
area
()
*
sign
(
scvf
.
outerNormalScalar
());
return
flux
;
return
result
;
}
void
computeCellCenterToCellCenterStencil
(
Stencil
&
stencil
,
...
...
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