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
942e5c6b
Commit
942e5c6b
authored
3 years ago
by
Kilian Weishaupt
Browse files
Options
Downloads
Patches
Plain Diff
[staggered] Adapt coupling manager to handle twisted grids
parent
cecd27a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2901
Feature/improve staggered gridgeometry
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dumux/multidomain/staggeredfreeflow/couplingmanager.hh
+37
-7
37 additions, 7 deletions
dumux/multidomain/staggeredfreeflow/couplingmanager.hh
with
37 additions
and
7 deletions
dumux/multidomain/staggeredfreeflow/couplingmanager.hh
+
37
−
7
View file @
942e5c6b
...
...
@@ -36,6 +36,7 @@
#include
<dumux/common/properties.hh>
#include
<dumux/common/typetraits/typetraits.hh>
#include
<dumux/multidomain/couplingmanager.hh>
#include
<dumux/discretization/facecentered/staggered/consistentlyorientedgrid.hh>
namespace
Dumux
{
...
...
@@ -93,6 +94,11 @@ private:
struct
MassAndEnergyCouplingContext
{
MassAndEnergyCouplingContext
(
FVElementGeometry
<
freeFlowMomentumIndex
>&&
f
,
const
std
::
size_t
i
)
:
fvGeometry
(
std
::
move
(
f
))
,
eIdx
(
i
)
{}
FVElementGeometry
<
freeFlowMomentumIndex
>
fvGeometry
;
std
::
size_t
eIdx
;
};
...
...
@@ -328,12 +334,14 @@ public:
{
// TODO: rethink this! Maybe we only need scvJ.dofIndex()
bindCouplingContext_
(
Dune
::
index_constant
<
freeFlowMassIndex
>
(),
element
,
scvf
.
insideScvIdx
()
/*eIdx*/
);
const
auto
&
scvJ
=
massAndEnergyCouplingContext_
[
0
].
fvGeometry
.
scv
(
scvf
.
index
()
/*corresponds to scvIdx of staggered*/
);
// the TPFA scvf index corresponds to the staggered scv index (might need mapping)
const
auto
localMomentumScvIdx
=
massScvfToMomentumScvIdx_
(
scvf
,
massAndEnergyCouplingContext_
[
0
].
fvGeometry
);
const
auto
&
scvJ
=
massAndEnergyCouplingContext_
[
0
].
fvGeometry
.
scv
(
localMomentumScvIdx
);
// create a unit normal vector oriented in positive coordinate direction
auto
velocity
=
scvf
.
unitOuterNormal
();
using
std
::
abs
;
std
::
for_each
(
velocity
.
begin
(),
velocity
.
end
(),
[](
auto
&
v
){
v
=
abs
(
v
);
});
typename
SubControlVolumeFace
<
freeFlowMassIndex
>::
GlobalPosition
velocity
;
velocity
[
scvJ
.
dofAxis
()]
=
1.0
;
// create the actual velocity vector
velocity
*=
this
->
curSol
(
freeFlowMomentumIndex
)[
scvJ
.
dofIndex
()];
...
...
@@ -505,10 +513,10 @@ private:
{
if
(
massAndEnergyCouplingContext_
.
empty
())
{
auto
fvGeometry
=
localView
(
this
->
problem
(
freeFlowMomentumIndex
).
gridGeometry
());
const
auto
&
gridGeometry
=
this
->
problem
(
freeFlowMomentumIndex
).
gridGeometry
();
auto
fvGeometry
=
localView
(
gridGeometry
);
fvGeometry
.
bindElement
(
elementI
);
massAndEnergyCouplingContext_
.
emplace_back
(
MassAndEnergyCouplingContext
{
std
::
move
(
fvGeometry
),
eIdx
});
massAndEnergyCouplingContext_
.
emplace_back
(
std
::
move
(
fvGeometry
),
eIdx
);
}
else
if
(
eIdx
!=
massAndEnergyCouplingContext_
[
0
].
eIdx
)
{
...
...
@@ -581,6 +589,28 @@ private:
}
}
std
::
size_t
massScvfToMomentumScvIdx_
(
const
SubControlVolumeFace
<
freeFlowMassIndex
>&
massScvf
,
[[
maybe_unused
]]
const
FVElementGeometry
<
freeFlowMomentumIndex
>&
momentumFVGeometry
)
const
{
if
constexpr
(
ConsistentlyOrientedGrid
<
typename
GridView
<
freeFlowMomentumIndex
>::
Grid
>
{})
return
massScvf
.
index
();
else
{
static
const
bool
makeConsistentlyOriented
=
getParam
<
bool
>
(
"Grid.MakeConsistentlyOriented"
,
true
);
if
(
!
makeConsistentlyOriented
)
return
massScvf
.
index
();
for
(
const
auto
&
momentumScv
:
scvs
(
momentumFVGeometry
))
{
typename
SubControlVolumeFace
<
freeFlowMassIndex
>::
GlobalPosition
momentumUnitOuterNormal
(
0.0
);
momentumUnitOuterNormal
[
momentumScv
.
dofAxis
()]
=
momentumScv
.
directionSign
();
if
(
Dune
::
FloatCmp
::
eq
<
typename
GridView
<
freeFlowMomentumIndex
>::
ctype
>
(
massScvf
.
unitOuterNormal
()
*
momentumUnitOuterNormal
,
1.0
))
return
momentumScv
.
index
();
}
DUNE_THROW
(
Dune
::
InvalidStateException
,
"No Momentum SCV found"
);
}
}
CouplingStencilType
emptyStencil_
;
std
::
vector
<
CouplingStencilType
>
momentumToMassAndEnergyStencils_
;
std
::
vector
<
CouplingStencilType
>
massAndEnergyToMomentumStencils_
;
...
...
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