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
82337912
Commit
82337912
authored
Sep 07, 2021
by
Kilian Weishaupt
Committed by
Ned Coltman
Sep 16, 2021
Browse files
[md] Add periodic constraints to multidomain fvassembler
parent
db6de99e
Changes
1
Hide whitespace changes
Inline
Side-by-side
dumux/multidomain/fvassembler.hh
View file @
82337912
...
...
@@ -203,6 +203,9 @@ public:
auto
&
jacRow
=
(
*
jacobian_
)[
domainId
];
auto
&
subRes
=
(
*
residual_
)[
domainId
];
this
->
assembleJacobianAndResidual_
(
domainId
,
jacRow
,
subRes
,
curSol
);
const
auto
gridGeometry
=
std
::
get
<
domainId
>
(
gridGeometryTuple_
);
enforcePeriodicConstraints_
(
domainId
,
jacRow
,
subRes
,
*
gridGeometry
,
curSol
[
domainId
]);
});
}
...
...
@@ -551,6 +554,48 @@ private:
domainJ
,
gridGeometry
(
domainJ
));
}
// build periodic contraints into the system matrix
template
<
std
::
size_t
i
,
class
JacRow
,
class
Sol
,
class
GG
>
void
enforcePeriodicConstraints_
(
Dune
::
index_constant
<
i
>
domainI
,
JacRow
&
jacRow
,
Sol
&
res
,
const
GG
&
gridGeometry
,
const
Sol
&
curSol
)
{
if
constexpr
(
GG
::
discMethod
==
DiscretizationMethod
::
box
||
GG
::
discMethod
==
DiscretizationMethod
::
fcstaggered
)
{
for
(
const
auto
&
m
:
gridGeometry
.
periodicVertexMap
())
{
if
(
m
.
first
<
m
.
second
)
{
auto
&
jac
=
jacRow
[
domainI
];
// add the second row to the first
res
[
m
.
first
]
+=
res
[
m
.
second
];
// enforce the solution of the first periodic DOF to the second one
res
[
m
.
second
]
=
curSol
[
m
.
second
]
-
curSol
[
m
.
first
];
const
auto
end
=
jac
[
m
.
second
].
end
();
for
(
auto
it
=
jac
[
m
.
second
].
begin
();
it
!=
end
;
++
it
)
jac
[
m
.
first
][
it
.
index
()]
+=
(
*
it
);
// enforce constraint in second row
for
(
auto
it
=
jac
[
m
.
second
].
begin
();
it
!=
end
;
++
it
)
(
*
it
)
=
it
.
index
()
==
m
.
second
?
1.0
:
it
.
index
()
==
m
.
first
?
-
1.0
:
0.0
;
using
namespace
Dune
::
Hybrid
;
forEach
(
makeIncompleteIntegerSequence
<
JacRow
::
size
(),
domainI
>
(),
[
&
](
const
auto
couplingDomainId
)
{
auto
&
jacCoupling
=
jacRow
[
couplingDomainId
];
for
(
auto
it
=
jacCoupling
[
m
.
second
].
begin
();
it
!=
jacCoupling
[
m
.
second
].
end
();
++
it
)
jacCoupling
[
m
.
first
][
it
.
index
()]
+=
(
*
it
);
for
(
auto
it
=
jacCoupling
[
m
.
second
].
begin
();
it
!=
jacCoupling
[
m
.
second
].
end
();
++
it
)
(
*
it
)
=
0.0
;
});
}
}
}
}
//! pointer to the problem to be solved
ProblemTuple
problemTuple_
;
...
...
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