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
208376d5
Commit
208376d5
authored
Sep 29, 2017
by
Dennis Gläser
Browse files
[mpfa] further restructure interaction volumes
parent
b1261c86
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
dumux/discretization/cellcentered/mpfa/darcyslaw.hh
View file @
208376d5
...
...
@@ -66,6 +66,8 @@ class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCMpfa>
using
DataHandle
=
typename
PrimaryInteractionVolume
::
Traits
::
DataHandle
;
static
constexpr
int
numPhases
=
GET_PROP_VALUE
(
TypeTag
,
NumPhases
);
static
constexpr
int
dim
=
GridView
::
dimension
;
static
constexpr
int
dimWorld
=
GridView
::
dimensionworld
;
//! The cache used in conjunction with the mpfa Darcy's Law
class
MpfaDarcysLawCache
...
...
@@ -82,10 +84,17 @@ class DarcysLawImplementation<TypeTag, DiscretizationMethods::CCMpfa>
const
auto
&
localFaceData
=
iv
.
getLocalFaceData
(
scvf
);
// update the quantities that are equal for all phases
advectionSwitchFluxSign_
=
localFaceData
.
isOutside
;
advectionTij_
=
&
iv
.
getTransmissibilities
(
scvf
,
localFaceData
,
dataHandle
);
advectionSwitchFluxSign_
=
localFaceData
.
isOutside
();
advectionVolVarsStencil_
=
&
dataHandle
.
volVarsStencil
();
advectionDirichletData_
=
&
dataHandle
.
dirichletData
();
// the transmissibilities on surface grids have to be obtained from the outside
if
(
dim
==
dimWorld
)
advectionTij_
=
&
dataHandle
.
T
()[
localFaceData
.
ivLocalScvfIndex
()];
else
advectionTij_
=
localFaceData
.
isOutside
()
?
&
dataHandle
.
outsideTij
()[
localFaceData
.
ivLocalOutsideScvfIndex
()]
:
&
dataHandle
.
T
()[
localFaceData
.
ivLocalScvfIndex
()];
}
//! Returns the stencil for advective scvf flux computation
...
...
@@ -192,13 +201,13 @@ public:
// add contributions from possible dirichlet boundary conditions
for
(
const
auto
&
d
:
fluxVarsCache
.
advectionDirichletData
())
{
const
auto
&
volVars
=
elemVolVars
[
d
.
volVarIndex
];
const
auto
&
volVars
=
elemVolVars
[
d
.
volVarIndex
()
];
Scalar
h
=
volVars
.
pressure
(
phaseIdx
);
// maybe add gravitational acceleration
if
(
gravity
)
{
const
auto
x
=
d
.
ipGlobal
;
const
auto
x
=
d
.
ipGlobal
()
;
const
auto
g
=
problem
.
gravityAtPos
(
x
);
h
-=
rho
*
(
g
*
x
);
}
...
...
dumux/discretization/cellcentered/mpfa/fluxvariablescachefiller.hh
View file @
208376d5
...
...
@@ -96,7 +96,6 @@ public:
elementPtr_
=
&
element
;
fvGeometryPtr_
=
&
fvGeometry
;
elemVolVarsPtr_
=
&
elemVolVars
;
scvfPtr_
=
&
scvf
;
// prepare interaction volume and fill caches of all the scvfs connected to it
const
auto
&
fvGridGeometry
=
fvGeometry
.
fvGridGeometry
();
...
...
@@ -108,18 +107,15 @@ public:
const
auto
ivIndexInContainer
=
fluxVarsCacheContainer
.
secondaryInteractionVolumes_
.
size
();
// prepare the locally cached boundary interaction volume
const
auto
&
indexSet
=
fvGridGeometry
.
gridInteractionVolumeIndexSets
().
secondaryIndexSet
(
scvf
);
fluxVarsCacheContainer
.
secondaryInteractionVolumes_
.
emplace_back
();
secondaryIv_
=
&
fluxVarsCacheContainer
.
secondaryInteractionVolumes_
.
back
();
secondaryIv_
->
setUpLocalScope
(
indexSet
,
problem
(),
fvGeometry
);
// prepare the corresponding data handle
fluxVarsCacheContainer
.
secondaryIvDataHandles_
.
emplace_back
();
ivDataHandle_
=
&
fluxVarsCacheContainer
.
secondaryIvDataHandles_
.
back
();
secondaryIv_
->
bind
(
fvGridGeometry
.
gridInteractionVolumeIndexSets
().
secondaryIndexSet
(
scvf
),
problem
(),
fvGeometry
,
elemVolVars
,
*
ivDataHandle_
);
secondaryIv_
->
prepareDataHandle
(
*
ivDataHandle_
);
// fill the caches for all the scvfs in the interaction volume
fillCachesInInteractionVolume_
(
fluxVarsCacheContainer
,
*
secondaryIv_
,
*
ivDataHandle_
,
ivIndexInContainer
,
true
);
...
...
@@ -142,18 +138,15 @@ public:
const
auto
ivIndexInContainer
=
fluxVarsCacheContainer
.
primaryInteractionVolumes_
.
size
();
// prepare the locally cached boundary interaction volume
const
auto
&
indexSet
=
fvGridGeometry
.
gridInteractionVolumeIndexSets
().
primaryIndexSet
(
scvf
);
fluxVarsCacheContainer
.
primaryInteractionVolumes_
.
emplace_back
();
primaryIv_
=
&
fluxVarsCacheContainer
.
primaryInteractionVolumes_
.
back
();
primaryIv_
->
setUpLocalScope
(
indexSet
,
problem
(),
fvGeometry
);
// prepare the corresponding data handle
fluxVarsCacheContainer
.
primaryIvDataHandles_
.
emplace_back
();
ivDataHandle_
=
&
fluxVarsCacheContainer
.
primaryIvDataHandles_
.
back
();
primaryIv_
->
bind
(
fvGridGeometry
.
gridInteractionVolumeIndexSets
().
primaryIndexSet
(
scvf
),
problem
(),
fvGeometry
,
elemVolVars
,
*
ivDataHandle_
);
primaryIv_
->
prepareDataHandle
(
*
ivDataHandle_
);
// fill the caches for all the scvfs in the interaction volume
fillCachesInInteractionVolume_
(
fluxVarsCacheContainer
,
*
primaryIv_
,
*
ivDataHandle_
,
ivIndexInContainer
,
true
);
...
...
@@ -193,9 +186,6 @@ private:
const
ElementVolumeVariables
&
elemVolVars
()
const
{
return
*
elemVolVarsPtr_
;
}
const
SubControlVolumeFace
&
scvFace
()
const
{
return
*
scvfPtr_
;
}
//! Method to fill the flux var caches within an interaction volume
template
<
class
FluxVariablesCacheContainer
,
class
InteractionVolumeType
>
void
fillCachesInInteractionVolume_
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
...
...
@@ -209,40 +199,49 @@ private:
// this data only once and can use it again in the sub-cache fillers.
if
(
forceUpdateAll
)
{
std
::
vector
<
FluxVariablesCache
*>
ivFluxVarCaches
(
iv
.
globalLocalScvfPairedData
().
size
());
const
auto
numGlobalScvfs
=
iv
.
localFaceData
().
size
();
std
::
vector
<
const
SubControlVolumeFace
*>
ivScvfs
(
numGlobalScvfs
);
std
::
vector
<
FluxVariablesCache
*>
ivFluxVarCaches
(
numGlobalScvfs
);
unsigned
int
i
=
0
;
for
(
const
auto
&
d
ataPair
:
iv
.
g
lo
b
al
LocalScvfPaired
Data
())
for
(
const
auto
&
d
:
iv
.
lo
c
al
Face
Data
())
{
// obtain the scvf
const
auto
&
scvfJ
=
*
dataPair
.
first
;
const
auto
&
scvfJ
=
fvGeometry
().
scvf
(
d
.
globalScvfIndex
());
ivScvfs
[
i
]
=
&
scvfJ
;
ivFluxVarCaches
[
i
]
=
&
fluxVarsCacheContainer
[
scvfJ
];
ivFluxVarCaches
[
i
]
->
setIvIndexInContainer
(
ivIndexInContainer
);
ivFluxVarCaches
[
i
]
->
setUpdateStatus
(
true
);
i
++
;
}
fillAdvection
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivFluxVarCaches
);
fillDiffusion
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivFluxVarCaches
);
fillHeatConduction
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivFluxVarCaches
);
fillAdvection
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivScvfs
,
ivFluxVarCaches
);
fillDiffusion
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivScvfs
,
ivFluxVarCaches
);
fillHeatConduction
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivScvfs
,
ivFluxVarCaches
);
}
else
{
std
::
vector
<
FluxVariablesCache
*>
ivFluxVarCaches
(
iv
.
globalLocalScvfPairedData
().
size
());
const
auto
numGlobalScvfs
=
iv
.
localFaceData
().
size
();
std
::
vector
<
const
SubControlVolumeFace
*>
ivScvfs
(
numGlobalScvfs
);
std
::
vector
<
FluxVariablesCache
*>
ivFluxVarCaches
(
numGlobalScvfs
);
unsigned
int
i
=
0
;
for
(
const
auto
&
d
ataPair
:
iv
.
g
lo
b
al
LocalScvfPaired
Data
())
for
(
const
auto
&
d
:
iv
.
lo
c
al
Face
Data
())
{
// the interior boundary data and the iv index have been set already
ivFluxVarCaches
[
i
]
=
&
fluxVarsCacheContainer
[
*
dataPair
.
first
];
// the iv index has been set already
const
auto
&
scvfJ
=
fvGeometry
().
scvf
(
d
.
globalScvfIndex
());
ivScvfs
[
i
]
=
&
scvfJ
;
ivFluxVarCaches
[
i
]
=
&
fluxVarsCacheContainer
[
scvfJ
];
ivFluxVarCaches
[
i
]
->
setUpdateStatus
(
true
);
i
++
;
}
if
(
doAdvection
&&
soldependentAdvection
)
fillAdvection
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivFluxVarCaches
);
fillAdvection
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivScvfs
,
ivFluxVarCaches
);
if
(
doDiffusion
&&
soldependentDiffusion
)
fillDiffusion
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivFluxVarCaches
);
fillDiffusion
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivScvfs
,
ivFluxVarCaches
);
if
(
doHeatConduction
&&
soldependentHeatConduction
)
fillHeatConduction
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivFluxVarCaches
);
fillHeatConduction
(
fluxVarsCacheContainer
,
iv
,
handle
,
ivScvfs
,
ivFluxVarCaches
);
}
}
...
...
@@ -252,6 +251,7 @@ private:
fillAdvection
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
InteractionVolumeType
&
iv
,
DataHandle
&
handle
,
const
std
::
vector
<
const
SubControlVolumeFace
*>&
ivScvfs
,
const
std
::
vector
<
FluxVariablesCache
*>&
ivFluxVarCaches
)
{
using
AdvectionType
=
typename
GET_PROP_TYPE
(
TypeTag
,
AdvectionType
);
...
...
@@ -265,17 +265,16 @@ private:
// maybe solve the local system subject to K (if AdvectionType uses mpfa)
if
(
AdvectionMethod
==
DiscretizationMethods
::
CCMpfa
)
iv
.
solveLocalSystem
(
LambdaFactory
::
getAdvectionLambda
(),
handle
);
iv
.
solveLocalSystem
(
LambdaFactory
::
getAdvectionLambda
(),
problem
(),
fvGeometry
(),
elemVolVars
(),
handle
);
// fill advection caches
unsigned
int
i
=
0
;
for
(
const
auto
&
dataPair
:
iv
.
globalLocalScvfPairedData
())
AdvectionFiller
::
fill
(
*
ivFluxVarCaches
[
i
++
],
for
(
unsigned
int
i
=
0
;
i
<
iv
.
localFaceData
().
size
();
++
i
)
AdvectionFiller
::
fill
(
*
ivFluxVarCaches
[
i
],
problem
(),
iv
.
element
(
dataPair
.
second
.
local
ScvIndex
),
iv
.
element
(
iv
.
localFaceData
()[
i
].
ivLocalInside
ScvIndex
()
),
fvGeometry
(),
elemVolVars
(),
*
dataPair
.
first
,
*
ivScvfs
[
i
]
,
*
this
);
}
...
...
@@ -285,6 +284,7 @@ private:
fillAdvection
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
InteractionVolumeType
&
iv
,
DataHandle
&
handle
,
const
std
::
vector
<
const
SubControlVolumeFace
*>&
ivScvfs
,
const
std
::
vector
<
FluxVariablesCache
*>&
ivFluxVarCaches
)
{}
//! method to fill the diffusive quantities
...
...
@@ -293,6 +293,7 @@ private:
fillDiffusion
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
InteractionVolumeType
&
iv
,
DataHandle
&
handle
,
const
std
::
vector
<
const
SubControlVolumeFace
*>&
ivScvfs
,
const
std
::
vector
<
FluxVariablesCache
*>&
ivFluxVarCaches
)
{
using
DiffusionType
=
typename
GET_PROP_TYPE
(
TypeTag
,
MolecularDiffusionType
);
...
...
@@ -316,19 +317,18 @@ private:
// solve the local system subject to the diffusion tensor (if uses mpfa)
if
(
DiffusionMethod
==
DiscretizationMethods
::
CCMpfa
)
iv
.
solveLocalSystem
(
LambdaFactory
::
getDiffusionLambda
(
phaseIdx
,
compIdx
),
handle
);
iv
.
solveLocalSystem
(
LambdaFactory
::
getDiffusionLambda
(
phaseIdx
,
compIdx
),
problem
(),
fvGeometry
(),
elemVolVars
(),
handle
);
// fill diffusion caches
unsigned
int
i
=
0
;
for
(
const
auto
&
dataPair
:
iv
.
globalLocalScvfPairedData
())
DiffusionFiller
::
fill
(
*
ivFluxVarCaches
[
i
++
],
for
(
unsigned
int
i
=
0
;
i
<
iv
.
localFaceData
().
size
();
++
i
)
DiffusionFiller
::
fill
(
*
ivFluxVarCaches
[
i
],
phaseIdx
,
compIdx
,
problem
(),
iv
.
element
(
dataPair
.
second
.
local
ScvIndex
),
iv
.
element
(
iv
.
localFaceData
()[
i
].
ivLocalInside
ScvIndex
()
),
fvGeometry
(),
elemVolVars
(),
*
dataPair
.
first
,
*
ivScvfs
[
i
]
,
*
this
);
}
}
...
...
@@ -340,6 +340,7 @@ private:
fillDiffusion
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
InteractionVolumeType
&
iv
,
DataHandle
&
handle
,
const
std
::
vector
<
const
SubControlVolumeFace
*>&
ivScvfs
,
const
std
::
vector
<
FluxVariablesCache
*>&
ivFluxVarCaches
)
{}
//! method to fill the quantities related to heat conduction
...
...
@@ -348,6 +349,7 @@ private:
fillHeatConduction
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
InteractionVolumeType
&
iv
,
DataHandle
&
handle
,
const
std
::
vector
<
const
SubControlVolumeFace
*>&
ivScvfs
,
const
std
::
vector
<
FluxVariablesCache
*>&
ivFluxVarCaches
)
{
using
HeatConductionType
=
typename
GET_PROP_TYPE
(
TypeTag
,
HeatConductionType
);
...
...
@@ -361,17 +363,16 @@ private:
// maybe solve the local system subject to fourier coefficient
if
(
HeatConductionMethod
==
DiscretizationMethods
::
CCMpfa
)
iv
.
solveLocalSystem
(
LambdaFactory
::
getHeatConductionLambda
(),
handle
);
iv
.
solveLocalSystem
(
LambdaFactory
::
getHeatConductionLambda
(),
problem
(),
fvGeometry
(),
elemVolVars
(),
handle
);
// fill heat conduction caches
unsigned
int
i
=
0
;
for
(
const
auto
&
dataPair
:
iv
.
globalLocalScvfPairedData
())
HeatConductionFiller
::
fill
(
*
ivFluxVarCaches
[
i
++
],
for
(
unsigned
int
i
=
0
;
i
<
iv
.
localFaceData
().
size
();
++
i
)
HeatConductionFiller
::
fill
(
*
ivFluxVarCaches
[
i
],
problem
(),
iv
.
element
(
dataPair
.
second
.
local
ScvIndex
),
iv
.
element
(
iv
.
localFaceData
()[
i
].
ivLocalInside
ScvIndex
()
),
fvGeometry
(),
elemVolVars
(),
*
dataPair
.
first
,
*
ivScvfs
[
i
]
,
*
this
);
}
...
...
@@ -381,16 +382,16 @@ private:
fillHeatConduction
(
FluxVariablesCacheContainer
&
fluxVarsCacheContainer
,
InteractionVolumeType
&
iv
,
DataHandle
&
handle
,
const
std
::
vector
<
const
SubControlVolumeFace
*>&
ivScvfs
,
const
std
::
vector
<
FluxVariablesCache
*>&
ivFluxVarCaches
)
{}
const
Problem
*
problemPtr_
;
const
Element
*
elementPtr_
;
const
FVElementGeometry
*
fvGeometryPtr_
;
const
ElementVolumeVariables
*
elemVolVarsPtr_
;
const
SubControlVolumeFace
*
scvfPtr_
;
// We store pointers to an inner and boundary interaction volume
//
t
hese are updated during the filling of the caches and the
// We store pointers to an inner and
a
boundary interaction volume
.
//
T
hese are updated during the filling of the caches and the
// physics-related caches have access to them
PrimaryInteractionVolume
*
primaryIv_
;
SecondaryInteractionVolume
*
secondaryIv_
;
...
...
dumux/discretization/cellcentered/mpfa/fvgridgeometry.hh
View file @
208376d5
...
...
@@ -128,12 +128,6 @@ public:
bool
vertexUsesPrimaryInteractionVolume
(
IndexType
vIdxGlobal
)
const
{
return
primaryInteractionVolumeVertices_
[
vIdxGlobal
];
}
/*!
* \brief Returns the number of vertices using the primary interaction volume type
*/
std
::
size_t
numVerticesUsingPrimaryInteractionVolume
()
const
{
return
numVertUsingPrimaryIV_
;
}
/*!
* \brief Returns if primary interaction volumes are used around a given vertex.
*/
...
...
@@ -147,12 +141,6 @@ public:
bool
vertexUsesSecondaryInteractionVolume
(
IndexType
vIdxGlobal
)
const
{
return
secondaryInteractionVolumeVertices_
[
vIdxGlobal
];
}
/*!
* \brief Returns the number of vertices using the secondary interaction volume type.
*/
std
::
size_t
numVerticesUsingSecondaryInteractionVolume
()
const
{
return
numVertUsingSecondaryIV_
;
}
/*!
* \brief Updates all finite volume geometries of the grid. This has to be called again
* after grid adaption. A function can be passed to this method specifying where the secondary
...
...
@@ -361,11 +349,7 @@ public:
}
}
// calculate the total number of vertices using the primary/secondary interaction volumes
numVertUsingPrimaryIV_
=
0
;
numVertUsingSecondaryIV_
=
0
;
std
::
accumulate
(
primaryInteractionVolumeVertices_
.
begin
(),
primaryInteractionVolumeVertices_
.
end
(),
0
);
std
::
accumulate
(
secondaryInteractionVolumeVertices_
.
begin
(),
secondaryInteractionVolumeVertices_
.
end
(),
0
);
// building the geometries has finished
std
::
cout
<<
"Initializing of the grid finite volume geometry took "
<<
timer
.
elapsed
()
<<
" seconds."
<<
std
::
endl
;
// Initialize the grid interaction volume seeds
...
...
@@ -430,8 +414,6 @@ private:
std
::
vector
<
std
::
vector
<
IndexType
>>
scvfIndicesOfScv_
;
std
::
vector
<
bool
>
primaryInteractionVolumeVertices_
;
std
::
vector
<
bool
>
secondaryInteractionVolumeVertices_
;
std
::
size_t
numVertUsingPrimaryIV_
;
std
::
size_t
numVertUsingSecondaryIV_
;
std
::
size_t
numBoundaryScvf_
;
// needed for embedded surface and network grids (dim < dimWorld)
...
...
@@ -519,12 +501,6 @@ public:
bool
vertexUsesPrimaryInteractionVolume
(
IndexType
vIdxGlobal
)
const
{
return
primaryInteractionVolumeVertices_
[
vIdxGlobal
];
}
/*!
* \brief Returns the number of vertices using the primary interaction volume type
*/
std
::
size_t
numVerticesUsingPrimaryInteractionVolume
()
const
{
return
numVertUsingPrimaryIV_
;
}
/*!
* \brief Returns if primary interaction volumes are used around a given vertex.
*/
...
...
@@ -538,12 +514,6 @@ public:
bool
vertexUsesSecondaryInteractionVolume
(
IndexType
vIdxGlobal
)
const
{
return
secondaryInteractionVolumeVertices_
[
vIdxGlobal
];
}
/*!
* \brief Returns the number of vertices using the secondary interaction volume type.
*/
std
::
size_t
numVerticesUsingSecondaryInteractionVolume
()
const
{
return
numVertUsingSecondaryIV_
;
}
/*!
* \brief Returns true if a given vertex lies on a processor boundary inside a ghost element.
*/
...
...
@@ -711,11 +681,7 @@ public:
neighborVolVarIndices_
[
eIdx
]
=
neighborVolVarIndexSet
;
}
// calculate the total number of vertices using the primary/secondary interaction volumes
numVertUsingPrimaryIV_
=
0
;
numVertUsingSecondaryIV_
=
0
;
std
::
accumulate
(
primaryInteractionVolumeVertices_
.
begin
(),
primaryInteractionVolumeVertices_
.
end
(),
0
);
std
::
accumulate
(
secondaryInteractionVolumeVertices_
.
begin
(),
secondaryInteractionVolumeVertices_
.
end
(),
0
);
// building the geometries has finished
std
::
cout
<<
"Initializing of the grid finite volume geometry took "
<<
timer
.
elapsed
()
<<
" seconds."
<<
std
::
endl
;
// Initialize the grid interaction volume seeds
...
...
@@ -765,8 +731,6 @@ private:
std
::
vector
<
bool
>
primaryInteractionVolumeVertices_
;
std
::
vector
<
bool
>
secondaryInteractionVolumeVertices_
;
std
::
vector
<
bool
>
isGhostVertex_
;
std
::
size_t
numVertUsingPrimaryIV_
;
std
::
size_t
numVertUsingSecondaryIV_
;
std
::
size_t
numScvs_
;
std
::
size_t
numScvf_
;
std
::
size_t
numBoundaryScvf_
;
...
...
dumux/discretization/cellcentered/mpfa/globalfluxvariablescache.hh
View file @
208376d5
...
...
@@ -68,7 +68,7 @@ class CCMpfaGlobalFluxVariablesCache<TypeTag, true>
public:
CCMpfaGlobalFluxVariablesCache
(
const
Problem
&
problem
)
:
problemPtr_
(
&
problem
)
{}
// When global caching is enabled, precompute transmissibilities
and stencils
for all
the
scv faces
// When global caching is enabled, precompute transmissibilities for all scv faces
void
update
(
const
FVGridGeometry
&
fvGridGeometry
,
const
GridVolumeVariables
&
gridVolVars
,
const
SolutionVector
&
sol
,
...
...
@@ -139,17 +139,7 @@ public:
{
auto
&
scvfCache
=
fluxVarsCache_
[
scvf
.
index
()];
if
(
!
scvfCache
.
isUpdated
())
{
// reset the pointers to the local views in the corresponding interaction volume
const
auto
ivIndexInContainer
=
scvfCache
.
ivIndexInContainer
();
if
(
fvGridGeometry
.
vertexUsesSecondaryInteractionVolume
(
scvf
.
vertexIndex
()))
secondaryInteractionVolumes_
[
ivIndexInContainer
].
resetPointers
(
fvGeometry
,
elemVolVars
);
else
primaryInteractionVolumes_
[
ivIndexInContainer
].
resetPointers
(
fvGeometry
,
elemVolVars
);
// update cache
filler
.
fill
(
*
this
,
scvfCache
,
element
,
fvGeometry
,
elemVolVars
,
scvf
);
}
}
for
(
const
auto
&
dataJ
:
assemblyMapI
)
...
...
@@ -160,16 +150,8 @@ public:
auto
&
scvfCache
=
fluxVarsCache_
[
scvfIdx
];
if
(
!
scvfCache
.
isUpdated
())
{
const
auto
&
scvf
=
fvGeometry
.
scvf
(
scvfIdx
);
const
auto
ivIndexInContainer
=
scvfCache
.
ivIndexInContainer
();
// reset the pointers to the local views in the corresponding interaction volume
if
(
fvGridGeometry
.
vertexUsesSecondaryInteractionVolume
(
scvf
.
vertexIndex
()))
secondaryInteractionVolumes_
[
ivIndexInContainer
].
resetPointers
(
fvGeometry
,
elemVolVars
);
else
primaryInteractionVolumes_
[
ivIndexInContainer
].
resetPointers
(
fvGeometry
,
elemVolVars
);
// update cache
const
auto
&
scvf
=
fvGeometry
.
scvf
(
scvfIdx
);
filler
.
fill
(
*
this
,
scvfCache
,
elementJ
,
fvGeometry
,
elemVolVars
,
scvf
);
}
}
...
...
dumux/discretization/cellcentered/mpfa/interactionvolumebase.hh
View file @
208376d5
...
...
@@ -86,13 +86,17 @@ class CCMpfaInteractionVolumeBase
{
using
Scalar
=
typename
GET_PROP_TYPE
(
TypeTag
,
Scalar
);
using
GridView
=
typename
GET_PROP_TYPE
(
TypeTag
,
GridView
);
using
Problem
=
typename
GET_PROP_TYPE
(
TypeTag
,
Problem
);
using
FVElementGeometry
=
typename
GET_PROP_TYPE
(
TypeTag
,
FVElementGeometry
);
using
SubControlVolumeFace
=
typename
GET_PROP_TYPE
(
TypeTag
,
SubControlVolumeFace
);
using
ElementVolumeVariables
=
typename
GET_PROP_TYPE
(
TypeTag
,
ElementVolumeVariables
);
using
LocalIndexSet
=
typename
T
::
DynamicLocalIndexContainer
;
using
LocalIndexType
=
typename
LocalIndexSet
::
value_type
;
using
GlobalIndexSet
=
typename
T
::
DynamicGlobalIndexContainer
;
using
GlobalIndexType
=
typename
GlobalIndexSet
::
value_type
;
using
Vector
=
typename
T
::
Vector
;
using
DataHandle
=
typename
T
::
DataHandle
;
using
IndexSet
=
typename
T
::
IndexSet
;
using
LocalIndexContainer
=
typename
T
::
DynamicLocalIndexContainer
;
using
LocalIndexType
=
typename
LocalIndexContainer
::
value_type
;
using
GlobalIndexContainer
=
typename
T
::
DynamicGlobalIndexContainer
;
using
GlobalIndexType
=
typename
GlobalIndexContainer
::
value_type
;
static
const
int
dim
=
GridView
::
dimension
;
static
const
int
dimWorld
=
GridView
::
dimensionworld
;
...
...
@@ -102,49 +106,99 @@ public:
// state the traits type publicly
using
Traits
=
T
;
struct
LocalFaceData
class
LocalFaceData
{
LocalIndexType
localScvfIndex
;
LocalIndexType
localScvIndex
;
bool
isOutside
;
//! Constructor
LocalFaceData
(
LocalIndexType
faceIndex
,
LocalIndexType
scvIndex
,
bool
isOut
)
:
localScvfIndex
(
faceIndex
),
localScvIndex
(
scvIndex
),
isOutside
(
isOut
)
{}
LocalIndexType
ivLocalScvfIndex_
;
//! the iv-local scvf index this scvf maps to
LocalIndexType
ivLocalInsideScvIndex_
;
//! the iv-local index of the scvfs' inside scv
LocalIndexType
ivLocalOutsideScvfIndex_
;
//! the index of this scvf in the iv-local outside faces
LocalIndexType
scvfLocalOutsideScvfIndex_
;
//! the index of this scvf in the scvf-local outside faces
GlobalIndexType
globalScvfIndex_
;
//! the index of the corresponding global scvf
bool
isOutside_
;
//! indicates if this face maps to the iv-local index from "outside"
public:
//! Constructor for "inside" faces
LocalFaceData
(
LocalIndexType
faceIndex
,
LocalIndexType
scvIndex
,
GlobalIndexType
globalScvfIndex
)
:
ivLocalScvfIndex_
(
faceIndex
),
ivLocalInsideScvIndex_
(
scvIndex
),
globalScvfIndex_
(
globalScvfIndex
),
isOutside_
(
false
)
{}
//! Constructor for "outside" faces
LocalFaceData
(
LocalIndexType
faceIndex
,
LocalIndexType
scvIndex
,
LocalIndexType
indexInIvOutsideFaces
,
LocalIndexType
indexInScvfOutsideFaces
,
GlobalIndexType
globalScvfIndex
)
:
ivLocalScvfIndex_
(
faceIndex
),
ivLocalInsideScvIndex_
(
scvIndex
),
ivLocalOutsideScvfIndex_
(
indexInIvOutsideFaces
),
scvfLocalOutsideScvfIndex_
(
indexInScvfOutsideFaces
),
globalScvfIndex_
(
globalScvfIndex
),
isOutside_
(
true
)
{}
//! The index of the scvf within the inside faces
LocalIndexType
ivLocalScvfIndex
()
const
{
return
ivLocalScvfIndex_
;
}
LocalIndexType
ivLocalInsideScvIndex
()
const
{
return
ivLocalInsideScvIndex_
;
}
LocalIndexType
ivLocalOutsideScvfIndex
()
const
{
assert
(
isOutside_
);
return
ivLocalOutsideScvfIndex_
;
}
LocalIndexType
scvfLocalOutsideScvfIndex
()
const
{
assert
(
isOutside_
);
return
scvfLocalOutsideScvfIndex_
;
}
GlobalIndexType
globalScvfIndex
()
const
{
return
globalScvfIndex_
;
}
bool
isOutside
()
const
{
return
isOutside_
;
}
};
struct
DirichletData
{
GlobalIndexType
volVarIndex
;
GlobalPosition
ipGlobal
;
GlobalIndexType
volVarIndex
_
;
GlobalPosition
ipGlobal
_
;
public:
DirichletData
(
const
GlobalIndexType
index
,
const
GlobalPosition
&
ip
)
:
volVarIndex
(
index
)
,
ipGlobal
(
ip
)
:
volVarIndex
_
(
index
)
,
ipGlobal
_
(
ip
)
{}
const
GlobalPosition
&
ipGlobal
()
const
{
return
ipGlobal_
;
}
GlobalIndexType
volVarIndex
()
const
{
return
volVarIndex_
;
}
};
using
GlobalLocalFaceDataPair
=
std
::
pair
<
const
SubControlVolumeFace
*
,
LocalFaceData
>
;
using
DirichletDataContainer
=
std
::
vector
<
DirichletData
>
;
using
LocalFaceDataContainer
=
std
::
vector
<
LocalFaceData
>
;
//! Sets up the local scope (geometries etc) for a given iv index set!
void
setUpLocalScope
(
const
IndexSet
&
indexSet
,
const
Problem
&
problem
,
const
FVElementGeometry
&
fvGeometry
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Interaction volume implementation does not provide a setUpLocalScope() method."
);
}
//! solves the local equation system for the computation of the transmissibilities
//! sets the sizes of the corresponding matrices in the data handle
void
prepareDataHandle
(
DataHandle
&
dataHandle
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Interaction volume implementation does not provide a prepareDataHandle() method."
);
}
//! solves for the transmissibilities subject to a given tensor
template
<
typename
GetTensorFunction
>
void
solveLocalSystem
(
const
GetTensorFunction
&
getTensor
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Actual interaction volume implementation does not provide a solveLocalSystem() method."
);
}
void
solveLocalSystem
(
const
GetTensorFunction
&
getTensor
,
const
Problem
&
problem
,
const
FVElementGeometry
&
fvGeometry
,
const
ElementVolumeVariables
&
elemVolVars
,
DataHandle
&
dataHandle
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Interaction volume implementation does not provide a solveLocalSystem() method."
);
}
//!
returns the indices of the volvars in the stencil of the interaction volume
const
GlobalIndexSet
&
volVarsStencil
(
)
const
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"
Actual i
nteraction volume implementation does not provide a
volVarsStencil
() method."
);
}
//!
obtain the local data object for a given global scvf
const
LocalFaceData
&
getLocalFaceData
(
const
SubControlVolumeFace
&
scvf
)
const
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"
I
nteraction volume implementation does not provide a
getLocalFaceData
() method."
);
}
//!
returns
the local index of an scvf in the IV and a boolean whether or not it is on the negative side of the local scvf (flux has to be inverted)
LocalFaceData
getLocalFaceData
(
const
SubControlVolumeFace
&
scvf
)
const
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"
Actual i
nteraction volume implementation does not provide a
getL
ocalFaceData() method."
);
}
//!returns
a reference to the container with the local face data
const
LocalFaceDataContainer
&
localFaceData
(
)
const
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"
I
nteraction volume implementation does not provide a
l
ocalFaceData() method."
);
}
//! returns the transmissibilities corresponding to a local scvf
Vector
getTransmissibilities
(
const
LocalFaceData
&
localFaceData
)
const
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Actual interaction volume implementation does not provide a getTransmissibilities() method."
);
}
//! returns a reference to the container with the data on Dirichlet boundaries
const
DirichletDataContainer
&
dirichletData
()
const
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"Interaction volume implementation does not provide a dirichletData() method."
);
}
//! returns the indices of the volvars in the stencil of the interaction volume