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
177ea2a4
Commit
177ea2a4
authored
6 years ago
by
Dennis Gläser
Browse files
Options
Downloads
Patches
Plain Diff
[mpfa][ivdatahandle] get rid of resize overload for surface grids
parent
d5c75864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1337
WIP Fix/dirichlet caching v2
,
!1298
Restructure mpfa flux caches
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/discretization/cellcentered/mpfa/interactionvolumedatahandle.hh
+36
-66
36 additions, 66 deletions
...tization/cellcentered/mpfa/interactionvolumedatahandle.hh
with
36 additions
and
66 deletions
dumux/discretization/cellcentered/mpfa/interactionvolumedatahandle.hh
+
36
−
66
View file @
177ea2a4
...
...
@@ -46,7 +46,7 @@ public:
template
<
class
MatVecTraits
,
class
PhysicsTraits
,
bool
EnableAdvection
>
class
AdvectionDataHandle
{
//
export
matrix & vector types from interaction volume
//
obtain
matrix & vector types from interaction volume
using
AMatrix
=
typename
MatVecTraits
::
AMatrix
;
using
CMatrix
=
typename
MatVecTraits
::
CMatrix
;
using
TMatrix
=
typename
MatVecTraits
::
TMatrix
;
...
...
@@ -59,74 +59,42 @@ class AdvectionDataHandle
public:
//! prepare data handle for subsequent fill (normal grids)
template
<
class
IV
,
std
::
enable_if_t
<
(
IV
::
Traits
::
GridView
::
dimension
==
IV
::
Traits
::
GridView
::
dimensionworld
),
int
>
=
0
>
void
resize
(
const
IV
&
iv
)
{
// resize transmissibility matrix & pressure vectors
resizeMatrix
(
T_
,
iv
.
numFaces
(),
iv
.
numKnowns
());
for
(
unsigned
int
pIdx
=
0
;
pIdx
<
numPhases
;
++
pIdx
)
resizeVector
(
p_
[
pIdx
],
iv
.
numKnowns
());
// maybe resize gravity container
static
const
bool
enableGravity
=
getParam
<
bool
>
(
"Problem.EnableGravity"
);
if
(
enableGravity
)
{
resizeMatrix
(
CA_
,
iv
.
numFaces
(),
iv
.
numUnknowns
());
for
(
unsigned
int
pIdx
=
0
;
pIdx
<
numPhases
;
++
pIdx
)
resizeVector
(
g_
[
pIdx
],
iv
.
numFaces
());
}
}
//! prepare data handle for subsequent fill (surface grids)
template
<
class
IV
,
std
::
enable_if_t
<
(
IV
::
Traits
::
GridView
::
dimension
<
IV
::
Traits
::
GridView
::
dimensionworld
),
int
>
=
0
>
//! prepare data handle for subsequent fill
template
<
class
IV
>
void
resize
(
const
IV
&
iv
)
{
using
LocalIndexType
=
typename
IV
::
Traits
::
IndexSet
::
LocalIndexType
;
static
const
bool
enableGravity
=
getParam
<
bool
>
(
"Problem.EnableGravity"
);
if
(
!
enableGravity
)
{
resizeMatrix
(
T_
,
iv
.
numFaces
(),
iv
.
numKnowns
());
outsideT_
.
resize
(
iv
.
numFaces
());
// resize matrices
resizeMatrix
(
T_
,
iv
.
numFaces
(),
iv
.
numKnowns
());
resizeMatrix
(
A_
,
iv
.
numUnknowns
(),
iv
.
numUnknowns
());
resizeMatrix
(
CA_
,
iv
.
numFaces
(),
iv
.
numUnknowns
());
for
(
unsigned
int
pIdx
=
0
;
pIdx
<
numPhases
;
++
pIdx
)
resizeVector
(
p_
[
pIdx
],
iv
.
numKnowns
());
for
(
LocalIndexType
i
=
0
;
i
<
iv
.
numFaces
();
++
i
)
{
const
auto
numNeighbors
=
iv
.
localScvf
(
i
).
neighboringLocalScvIndices
().
size
()
-
1
;
outsideT_
[
i
].
resize
(
numNeighbors
);
for
(
LocalIndexType
j
=
0
;
j
<
numNeighbors
;
++
j
)
resizeVector
(
outsideT_
[
i
][
j
],
iv
.
numKnowns
());
}
}
// lambdas to resize a vector
auto
resizeToNumFaces
=
[
&
iv
]
(
auto
&
v
)
{
resizeVector
(
v
,
iv
.
numFaces
());
};
auto
resizeToNumKnowns
=
[
&
iv
]
(
auto
&
v
)
{
resizeVector
(
v
,
iv
.
numKnowns
());
};
// resize pressure/gravity vector
std
::
for_each
(
p_
.
begin
(),
p_
.
end
(),
resizeToNumKnowns
);
std
::
for_each
(
g_
.
begin
(),
g_
.
end
(),
resizeToNumFaces
);
else
// on surface grids, resize additional containers
static
constexpr
int
dim
=
IV
::
Traits
::
GridView
::
dimension
;
static
constexpr
int
dimWorld
=
IV
::
Traits
::
GridView
::
dimensionworld
;
if
(
dim
<
dimWorld
)
{
resizeMatrix
(
T_
,
iv
.
numFaces
(),
iv
.
numKnowns
());
resizeMatrix
(
CA_
,
iv
.
numFaces
(),
iv
.
numUnknowns
());
resizeMatrix
(
A_
,
iv
.
numUnknowns
(),
iv
.
numUnknowns
());
outsideT_
.
resize
(
iv
.
numFaces
());
std
::
for_each
(
outsideG_
.
begin
(),
outsideG_
.
end
(),
resizeToNumFaces
);
for
(
unsigned
int
pIdx
=
0
;
pIdx
<
numPhases
;
++
pIdx
)
{
resizeVector
(
p_
[
pIdx
],
iv
.
numKnowns
());
resizeVector
(
g_
[
pIdx
],
iv
.
numFaces
());
outsideG_
[
pIdx
].
resize
(
iv
.
numFaces
());
}
// resize the entries for each face
for
(
LocalIndexType
i
=
0
;
i
<
iv
.
numFaces
();
++
i
)
{
const
auto
numNeighbors
=
iv
.
localScvf
(
i
).
neighboringLocalScvIndices
().
size
()
-
1
;
const
auto
&
localScvf
=
iv
.
localScvf
(
i
);
const
auto
numNeighbors
=
localScvf
.
neighboringLocalScvIndices
().
size
()
-
1
;
outsideT_
[
i
].
resize
(
numNeighbors
);
for
(
unsigned
int
pIdx
=
0
;
pIdx
<
numPhases
;
++
pIdx
)
resizeVector
(
outsideG_
[
pIdx
][
i
],
numNeighbors
);
for
(
LocalIndexType
j
=
0
;
j
<
numNeighbors
;
++
j
)
resizeVector
(
outsideT_
[
i
][
j
],
iv
.
numKnowns
());
std
::
for_each
(
outsideT_
[
i
].
begin
(),
outsideT_
[
i
].
end
(),
resizeToNumKnowns
);
std
::
for_each
(
outsideG_
.
begin
(),
outsideG_
.
end
(),
[
&
]
(
auto
&
v
)
{
resizeVector
(
v
[
i
],
numNeighbors
);
});
}
}
}
...
...
@@ -135,7 +103,7 @@ public:
const
CellVector
&
pressures
(
unsigned
int
pIdx
)
const
{
return
p_
[
pIdx
];
}
CellVector
&
pressures
(
unsigned
int
pIdx
)
{
return
p_
[
pIdx
];
}
//!
Access to t
he gravitational flux contributions for
one
phase
//!
T
he gravitational flux contributions for
a
phase
on all faces
const
FaceVector
&
gravity
(
unsigned
int
pIdx
)
const
{
return
g_
[
pIdx
];
}
FaceVector
&
gravity
(
unsigned
int
pIdx
)
{
return
g_
[
pIdx
];
}
...
...
@@ -143,15 +111,16 @@ public:
const
std
::
array
<
FaceVector
,
numPhases
>&
gravity
()
const
{
return
g_
;
}
std
::
array
<
FaceVector
,
numPhases
>&
gravity
()
{
return
g_
;
}
//! Projection matrix for gravitational acceleration
//! Projection matrix for Neumann/gravity contribution computation
const
CMatrix
&
advectionCA
()
const
{
return
CA_
;
}
CMatrix
&
advectionCA
()
{
return
CA_
;
}
//!
Additional projection matrix needed on surface grids
//!
Inverse of the iv-local system matrix
const
AMatrix
&
advectionA
()
const
{
return
A_
;
}
AMatrix
&
advectionA
()
{
return
A_
;
}
//! The transmissibilit
ies associated with advective fluxes
//! The transmissibilit
y matrix (i.e. C*(A^-1)*B + D)
const
TMatrix
&
advectionT
()
const
{
return
T_
;
}
TMatrix
&
advectionT
()
{
return
T_
;
}
...
...
@@ -168,9 +137,9 @@ public:
OutsideGravityStorage
&
gravityOutside
(
unsigned
int
pIdx
)
{
return
outsideG_
[
pIdx
];
}
private
:
TMatrix
T_
;
//!< The transmissibilities such that f_i = T_ij*p_j
C
Matrix
C
A_
;
//!< Matrix to project gravitational acceleration to all scvfs
A
Matrix
A_
;
//!< Matrix additionally needed for the projection on surface grids
TMatrix
T_
;
//!< The transmissibilities such that f_i = T_ij*p_j
(... + Neumann/gravity contributions)
A
Matrix
A_
;
//!< Inverse of the iv-local system matrix (needed e.g. for face pressure reconstruction)
C
Matrix
C
A_
;
//!< A_ right multiplied to C (needed e.g. for Neumann/gravity contribution computation)
std
::
array
<
CellVector
,
numPhases
>
p_
;
//!< The interaction volume-wide phase pressures
std
::
array
<
FaceVector
,
numPhases
>
g_
;
//!< The gravitational acceleration at each scvf (only for enabled gravity)
std
::
vector
<
std
::
vector
<
CellVector
>
>
outsideT_
;
//!< The transmissibilities for "outside" faces (only on surface grids)
...
...
@@ -313,9 +282,10 @@ class HeatConductionDataHandle<MatVecTraits, PhysicsTraits, false> : public Empt
* \tparam PT The physics traits collecting data on the physical processes to be considered
*/
template
<
class
MVT
,
class
PT
>
class
InteractionVolumeDataHandle
:
public
AdvectionDataHandle
<
MVT
,
PT
,
PT
::
enableAdvection
>
,
public
DiffusionDataHandle
<
MVT
,
PT
,
PT
::
enableMolecularDiffusion
>
,
public
HeatConductionDataHandle
<
MVT
,
PT
,
PT
::
enableHeatConduction
>
class
InteractionVolumeDataHandle
:
public
AdvectionDataHandle
<
MVT
,
PT
,
PT
::
enableAdvection
>
,
public
DiffusionDataHandle
<
MVT
,
PT
,
PT
::
enableMolecularDiffusion
>
,
public
HeatConductionDataHandle
<
MVT
,
PT
,
PT
::
enableHeatConduction
>
{
using
AdvectionHandle
=
AdvectionDataHandle
<
MVT
,
PT
,
PT
::
enableAdvection
>
;
using
DiffusionHandle
=
DiffusionDataHandle
<
MVT
,
PT
,
PT
::
enableMolecularDiffusion
>
;
...
...
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