Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-tectonic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
podlesny
dune-tectonic
Commits
edd91679
Commit
edd91679
authored
11 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Cleanup] Construct boundary from faces
parent
df715b6a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/one-body-sample.cc
+36
-26
36 additions, 26 deletions
src/one-body-sample.cc
with
36 additions
and
26 deletions
src/one-body-sample.cc
+
36
−
26
View file @
edd91679
...
@@ -137,42 +137,52 @@ int main(int argc, char *argv[]) {
...
@@ -137,42 +137,52 @@ int main(int argc, char *argv[]) {
GridView
const
leafView
=
grid
->
leafView
();
GridView
const
leafView
=
grid
->
leafView
();
// }}}
// }}}
// Set up the boundary
// Set up faces
Dune
::
BitSetVector
<
dims
>
dirichletNodes
(
fineVertexCount
);
BoundaryPatch
<
GridView
>
lowerFace
(
leafView
);
Dune
::
BitSetVector
<
dims
>
noNodes
(
fineVertexCount
);
BoundaryPatch
<
GridView
>
upperFace
(
leafView
);
BoundaryPatch
<
GridView
>
const
neumannBoundary
(
leafView
);
{
auto
const
isClose
=
[](
double
a
,
double
b
)
{
return
std
::
abs
(
a
-
b
)
<
1e-14
;
};
lowerFace
.
insertFacesByProperty
([
&
](
typename
GridView
::
Intersection
const
&
in
)
{
return
isClose
(
lowerLeft
[
1
],
in
.
geometry
().
center
()[
1
]);
});
upperFace
.
insertFacesByProperty
([
&
](
typename
GridView
::
Intersection
const
&
in
)
{
return
isClose
(
upperRight
[
1
],
in
.
geometry
().
center
()[
1
]);
});
}
Vector
vertexCoordinates
(
fineVertexCount
);
Vector
vertexCoordinates
(
fineVertexCount
);
Dune
::
BitSetVector
<
1
>
frictionalNodes
(
fineVertexCount
,
false
);
{
{
Dune
::
MultipleCodimMultipleGeomTypeMapper
<
Dune
::
MultipleCodimMultipleGeomTypeMapper
<
GridView
,
Dune
::
MCMGVertexLayout
>
const
vertexMapper
(
leafView
);
GridView
,
Dune
::
MCMGVertexLayout
>
const
vertexMapper
(
leafView
);
for
(
auto
it
=
leafView
.
begin
<
dims
>
();
it
!=
leafView
.
end
<
dims
>
();
++
it
)
{
for
(
auto
it
=
leafView
.
begin
<
dims
>
();
it
!=
leafView
.
end
<
dims
>
();
++
it
)
{
assert
(
it
->
geometry
().
corners
()
==
1
);
auto
const
geometry
=
it
->
geometry
();
size_t
const
id
=
vertexMapper
.
map
(
*
it
);
assert
(
geometry
.
corners
()
==
1
);
vertexCoordinates
[
id
]
=
it
->
geometry
().
corner
(
0
);
vertexCoordinates
[
vertexMapper
.
map
(
*
it
)]
=
geometry
.
corner
(
0
);
auto
const
&
localCoordinates
=
vertexCoordinates
[
id
];
}
}
// lower face
if
(
localCoordinates
[
1
]
==
lowerLeft
[
1
])
{
frictionalNodes
[
id
]
=
true
;
velocityDirichletNodes
[
id
][
1
]
=
true
;
}
// upper face
// Neumann boundary
else
if
(
localCoordinates
[
1
]
==
upperRight
[
1
])
BoundaryPatch
<
GridView
>
const
neumannBoundary
(
leafView
);
velocityDirichletNodes
[
id
]
=
true
;
// right face (except for both corners)
// Frictional Boundary
else
if
(
localCoordinates
[
0
]
==
upperRight
[
0
])
BoundaryPatch
<
GridView
>
const
&
frictionalBoundary
=
lowerFace
;
;
Dune
::
BitSetVector
<
1
>
frictionalNodes
(
fineVertexCount
);
frictionalBoundary
.
getVertices
(
frictionalNodes
);
// left face (except for both corners)
// Dirichlet Boundary
else
if
(
localCoordinates
[
0
]
==
lowerLeft
[
0
])
Dune
::
BitSetVector
<
dims
>
noNodes
(
fineVertexCount
);
;
Dune
::
BitSetVector
<
dims
>
dirichletNodes
(
fineVertexCount
);
}
for
(
size_t
i
=
0
;
i
<
fineVertexCount
;
++
i
)
{
if
(
lowerFace
.
containsVertex
(
i
))
dirichletNodes
[
i
][
1
]
=
true
;
if
(
upperFace
.
containsVertex
(
i
))
dirichletNodes
[
i
]
=
true
;
}
}
BoundaryPatch
<
GridView
>
const
frictionalBoundary
(
leafView
,
frictionalNodes
);
// Set up functions for time-dependent boundary conditions
// Set up functions for time-dependent boundary conditions
using
Function
=
Dune
::
VirtualFunction
<
double
,
double
>
;
using
Function
=
Dune
::
VirtualFunction
<
double
,
double
>
;
...
...
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