Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
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
Commits
95f8f7cc
Commit
95f8f7cc
authored
6 years ago
by
Kilian Weishaupt
Browse files
Options
Downloads
Patches
Plain Diff
[stokesdarcy][couplingdata] Add pressure reconstruction for Forchheimer
parent
0e52f00c
No related branches found
No related tags found
1 merge request
!1476
Fix/p reconstruction forchheimer
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/multidomain/boundary/stokesdarcy/couplingdata.hh
+81
-17
81 additions, 17 deletions
dumux/multidomain/boundary/stokesdarcy/couplingdata.hh
with
81 additions
and
17 deletions
dumux/multidomain/boundary/stokesdarcy/couplingdata.hh
+
81
−
17
View file @
95f8f7cc
...
...
@@ -191,6 +191,15 @@ struct IndexHelper<stokesIdx, darcyIdx, FFFS, true>
{
return
FFFS
::
compIdx
(
coupledCompdIdx
);
}
};
//! forward declare
template
<
class
TypeTag
,
DiscretizationMethod
discMethod
>
class
DarcysLawImplementation
;
//! forward declare
template
<
class
TypeTag
,
DiscretizationMethod
discMethod
>
class
ForchheimersLawImplementation
;
template
<
class
MDTraits
,
class
CouplingManager
,
bool
enableEnergyBalance
,
bool
isCompositional
>
class
StokesDarcyCouplingDataImplementation
;
...
...
@@ -221,14 +230,18 @@ class StokesDarcyCouplingDataImplementationBase
template
<
std
::
size_t
id
>
using
SubControlVolume
=
typename
FVGridGeometry
<
id
>::
LocalView
::
SubControlVolume
;
template
<
std
::
size_t
id
>
using
Indices
=
typename
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
ModelTraits
>::
Indices
;
template
<
std
::
size_t
id
>
using
ElementVolumeVariables
=
typename
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
GridVolumeVariables
>::
LocalView
;
template
<
std
::
size_t
id
>
using
VolumeVariables
=
typename
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
GridVolumeVariables
>::
VolumeVariables
;
template
<
std
::
size_t
id
>
using
Problem
=
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
Problem
>
;
template
<
std
::
size_t
id
>
using
FluidSystem
=
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
FluidSystem
>
;
template
<
std
::
size_t
id
>
using
ModelTraits
=
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
ModelTraits
>
;
template
<
std
::
size_t
id
>
using
VolumeVariables
=
typename
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
GridVolumeVariables
>::
VolumeVariables
;
template
<
std
::
size_t
id
>
using
Problem
=
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
Problem
>
;
template
<
std
::
size_t
id
>
using
FluidSystem
=
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
FluidSystem
>
;
template
<
std
::
size_t
id
>
using
ModelTraits
=
GetPropType
<
SubDomainTypeTag
<
id
>
,
Properties
::
ModelTraits
>
;
static
constexpr
auto
stokesIdx
=
CouplingManager
::
stokesIdx
;
static
constexpr
auto
darcyIdx
=
CouplingManager
::
darcyIdx
;
using
AdvectionType
=
GetPropType
<
SubDomainTypeTag
<
darcyIdx
>
,
Properties
::
AdvectionType
>
;
using
DarcysLaw
=
DarcysLawImplementation
<
SubDomainTypeTag
<
darcyIdx
>
,
FVGridGeometry
<
darcyIdx
>::
discMethod
>
;
using
ForchheimersLaw
=
ForchheimersLawImplementation
<
SubDomainTypeTag
<
darcyIdx
>
,
FVGridGeometry
<
darcyIdx
>::
discMethod
>
;
static
constexpr
bool
adapterUsed
=
ModelTraits
<
darcyIdx
>::
numFluidPhases
()
>
1
;
using
IndexHelper
=
Dumux
::
IndexHelper
<
stokesIdx
,
darcyIdx
,
FluidSystem
<
stokesIdx
>
,
adapterUsed
>
;
...
...
@@ -298,20 +311,10 @@ public:
const
Scalar
darcyPressure
=
stokesContext
.
volVars
.
pressure
(
darcyPhaseIdx
);
if
(
numPhasesDarcy
>
1
)
{
momentumFlux
=
darcyPressure
;
}
else
// use pressure reconstruction for single phase models
{
// v = -K/mu * (gradP + rho*g)
const
Scalar
velocity
=
stokesElemFaceVars
[
scvf
].
velocitySelf
();
const
Scalar
mu
=
stokesContext
.
volVars
.
viscosity
(
darcyPhaseIdx
);
const
Scalar
rho
=
stokesContext
.
volVars
.
density
(
darcyPhaseIdx
);
const
Scalar
distance
=
(
stokesContext
.
element
.
geometry
().
center
()
-
scvf
.
center
()).
two_norm
();
const
Scalar
g
=
-
scvf
.
directionSign
()
*
couplingManager_
.
problem
(
darcyIdx
).
gravity
()[
scvf
.
directionIndex
()];
const
Scalar
interfacePressure
=
((
scvf
.
directionSign
()
*
velocity
*
(
mu
/
darcyPermeability
(
element
,
scvf
)))
+
rho
*
g
)
*
distance
+
darcyPressure
;
momentumFlux
=
interfacePressure
;
}
else
// use pressure reconstruction for single phase models; use tag dispatch to choose correct function for Darcy or Forchheimer
momentumFlux
=
pressureAtInterface_
(
element
,
scvf
,
stokesElemFaceVars
,
stokesContext
,
AdvectionType
());
// TODO: generalize for permeability tensors
// normalize pressure
if
(
getPropValue
<
SubDomainTypeTag
<
stokesIdx
>
,
Properties
::
NormalizePressure
>
())
...
...
@@ -434,6 +437,67 @@ protected:
return
volVars
.
effectiveThermalConductivity
();
}
/*!
* \brief Returns the pressure at the interface using Darcy's law for reconstruction
*/
template
<
class
ElementFaceVariables
,
class
CouplingContext
>
Scalar
pressureAtInterface_
(
const
Element
<
stokesIdx
>&
element
,
const
SubControlVolumeFace
<
stokesIdx
>&
scvf
,
const
ElementFaceVariables
&
elemFaceVars
,
const
CouplingContext
&
context
,
const
DarcysLaw
&
)
const
{
const
auto
darcyPhaseIdx
=
couplingPhaseIdx
(
darcyIdx
);
const
Scalar
cellCenterPressure
=
context
.
volVars
.
pressure
(
darcyPhaseIdx
);
// v = -K/mu * (gradP + rho*g)
const
Scalar
velocity
=
elemFaceVars
[
scvf
].
velocitySelf
();
const
Scalar
mu
=
context
.
volVars
.
viscosity
(
darcyPhaseIdx
);
const
Scalar
rho
=
context
.
volVars
.
density
(
darcyPhaseIdx
);
const
Scalar
distance
=
(
context
.
element
.
geometry
().
center
()
-
scvf
.
center
()).
two_norm
();
const
Scalar
g
=
-
scvf
.
directionSign
()
*
couplingManager_
.
problem
(
darcyIdx
).
gravity
()[
scvf
.
directionIndex
()];
const
Scalar
interfacePressure
=
((
scvf
.
directionSign
()
*
velocity
*
(
mu
/
darcyPermeability
(
element
,
scvf
)))
+
rho
*
g
)
*
distance
+
cellCenterPressure
;
return
interfacePressure
;
}
/*!
* \brief Returns the pressure at the interface using Forchheimers's law for reconstruction
*/
template
<
class
ElementFaceVariables
,
class
CouplingContext
>
Scalar
pressureAtInterface_
(
const
Element
<
stokesIdx
>&
element
,
const
SubControlVolumeFace
<
stokesIdx
>&
scvf
,
const
ElementFaceVariables
&
elemFaceVars
,
const
CouplingContext
&
context
,
const
ForchheimersLaw
&
)
const
{
const
auto
darcyPhaseIdx
=
couplingPhaseIdx
(
darcyIdx
);
const
Scalar
cellCenterPressure
=
context
.
volVars
.
pressure
(
darcyPhaseIdx
);
using
std
::
abs
;
using
std
::
sqrt
;
// v + cF * sqrt(K) * rho/mu * v * abs(v) + K/mu grad(p + rho z) = 0
const
Scalar
velocity
=
elemFaceVars
[
scvf
].
velocitySelf
();
const
Scalar
mu
=
context
.
volVars
.
viscosity
(
darcyPhaseIdx
);
const
Scalar
rho
=
context
.
volVars
.
density
(
darcyPhaseIdx
);
const
Scalar
distance
=
(
context
.
element
.
geometry
().
center
()
-
scvf
.
center
()).
two_norm
();
const
Scalar
g
=
-
scvf
.
directionSign
()
*
couplingManager_
.
problem
(
darcyIdx
).
gravity
()[
scvf
.
directionIndex
()];
// get the Forchheimer coefficient
Scalar
cF
=
0.0
;
for
(
const
auto
&
darcyScvf
:
scvfs
(
context
.
fvGeometry
))
{
if
(
darcyScvf
.
index
()
==
context
.
darcyScvfIdx
)
cF
=
couplingManager_
.
problem
(
darcyIdx
).
spatialParams
().
forchCoeff
(
darcyScvf
);
}
const
Scalar
interfacePressure
=
((
scvf
.
directionSign
()
*
velocity
*
(
mu
/
darcyPermeability
(
element
,
scvf
)))
+
(
scvf
.
directionSign
()
*
velocity
*
abs
(
velocity
)
*
rho
*
1.0
/
sqrt
(
darcyPermeability
(
element
,
scvf
))
*
cF
)
+
rho
*
g
)
*
distance
+
cellCenterPressure
;
return
interfacePressure
;
}
private
:
const
CouplingManager
&
couplingManager_
;
...
...
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