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
0d66c910
Commit
0d66c910
authored
11 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Extend] Introduce geometry class
parent
f411ed4b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mygeometry.hh
+15
-0
15 additions, 0 deletions
src/mygeometry.hh
src/mygrid.hh
+34
-0
34 additions, 0 deletions
src/mygrid.hh
src/one-body-sample.cc
+14
-39
14 additions, 39 deletions
src/one-body-sample.cc
with
63 additions
and
39 deletions
src/mygeometry.hh
0 → 100644
+
15
−
0
View file @
0d66c910
#ifndef MY_GEOMETRY_HH
#define MY_GEOMETRY_HH
struct
MyGeometry
{
MyGeometry
()
{}
Dune
::
FieldVector
<
double
,
2
>
A
=
{
0
,
0
};
Dune
::
FieldVector
<
double
,
2
>
B
=
{
5
,
0
};
Dune
::
FieldVector
<
double
,
2
>
C
=
{
5
,
1
};
Dune
::
FieldVector
<
double
,
2
>
D
=
{
0
,
1
};
Dune
::
FieldVector
<
double
,
2
>
zenith
=
{
0
,
1
};
};
#endif
This diff is collapsed.
Click to expand it.
src/mygrid.hh
0 → 100644
+
34
−
0
View file @
0d66c910
#include
<dune/grid/common/gridfactory.hh>
#include
<dune/fufem/boundarypatch.hh>
#include
"mygeometry.hh"
template
<
class
Grid
>
std
::
shared_ptr
<
Grid
>
constructGrid
(
MyGeometry
const
&
myGeometry
)
{
std
::
array
<
unsigned
int
,
2
>
elements
=
{
{
5
,
1
}
};
return
Dune
::
StructuredGridFactory
<
Grid
>::
createSimplexGrid
(
myGeometry
.
A
,
myGeometry
.
C
,
elements
);
}
template
<
class
GridView
,
class
MyGeometry
>
class
MyFaces
{
private:
bool
isClose
(
double
a
,
double
b
)
{
return
std
::
abs
(
a
-
b
)
<
1e-14
;
};
public
:
MyFaces
(
GridView
const
&
gridView
,
MyGeometry
const
&
myGeometry
)
:
lower
(
gridView
),
upper
(
gridView
)
{
lower
.
insertFacesByProperty
([
&
](
typename
GridView
::
Intersection
const
&
in
)
{
return
isClose
(
myGeometry
.
A
[
1
],
in
.
geometry
().
center
()[
1
]);
});
upper
.
insertFacesByProperty
([
&
](
typename
GridView
::
Intersection
const
&
in
)
{
return
isClose
(
myGeometry
.
C
[
1
],
in
.
geometry
().
center
()[
1
]);
});
}
BoundaryPatch
<
GridView
>
lower
;
BoundaryPatch
<
GridView
>
upper
;
};
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
14
−
39
View file @
0d66c910
...
@@ -72,6 +72,8 @@
...
@@ -72,6 +72,8 @@
#include
"enum_verbosity.cc"
#include
"enum_verbosity.cc"
#include
"enums.hh"
#include
"enums.hh"
#include
"friction_writer.hh"
#include
"friction_writer.hh"
#include
"mygeometry.hh"
#include
"mygrid.hh"
#include
"solverfactory.hh"
#include
"solverfactory.hh"
#include
"state.hh"
#include
"state.hh"
#include
"timestepping.hh"
#include
"timestepping.hh"
...
@@ -93,6 +95,8 @@ int main(int argc, char *argv[]) {
...
@@ -93,6 +95,8 @@ int main(int argc, char *argv[]) {
parset
);
parset
);
Dune
::
ParameterTreeParser
::
readOptions
(
argc
,
argv
,
parset
);
Dune
::
ParameterTreeParser
::
readOptions
(
argc
,
argv
,
parset
);
MyGeometry
const
myGeometry
;
auto
const
youngModulus
=
parset
.
get
<
double
>
(
"body.youngModulus"
);
auto
const
youngModulus
=
parset
.
get
<
double
>
(
"body.youngModulus"
);
auto
const
poissonRatio
=
parset
.
get
<
double
>
(
"body.poissonRatio"
);
auto
const
poissonRatio
=
parset
.
get
<
double
>
(
"body.poissonRatio"
);
auto
const
shearViscosity
=
parset
.
get
<
double
>
(
"body.shearViscosity"
);
auto
const
shearViscosity
=
parset
.
get
<
double
>
(
"body.shearViscosity"
);
...
@@ -102,23 +106,7 @@ int main(int argc, char *argv[]) {
...
@@ -102,23 +106,7 @@ int main(int argc, char *argv[]) {
// {{{ Set up grid
// {{{ Set up grid
using
Grid
=
Dune
::
ALUGrid
<
dims
,
dims
,
Dune
::
simplex
,
Dune
::
nonconforming
>
;
using
Grid
=
Dune
::
ALUGrid
<
dims
,
dims
,
Dune
::
simplex
,
Dune
::
nonconforming
>
;
auto
grid
=
constructGrid
<
Grid
>
(
myGeometry
);
// FIXME
Dune
::
FieldVector
<
size_t
,
dims
>
lowerLeft
(
0
);
Dune
::
FieldVector
<
size_t
,
dims
>
upperRight
(
1
);
upperRight
[
0
]
=
5
;
upperRight
[
1
]
=
1
;
std
::
shared_ptr
<
Grid
>
grid
;
{
Dune
::
array
<
unsigned
int
,
dims
>
elements
;
for
(
size_t
i
=
0
;
i
<
dims
;
++
i
)
elements
[
i
]
=
upperRight
[
i
];
// 1x1 elements
grid
=
Dune
::
StructuredGridFactory
<
Grid
>::
createSimplexGrid
(
lowerLeft
,
upperRight
,
elements
);
}
Dune
::
FieldVector
<
double
,
dims
>
zenith
(
0
);
zenith
[
1
]
=
1
;
auto
const
refinements
=
parset
.
get
<
size_t
>
(
"grid.refinements"
);
auto
const
refinements
=
parset
.
get
<
size_t
>
(
"grid.refinements"
);
grid
->
globalRefine
(
refinements
);
grid
->
globalRefine
(
refinements
);
...
@@ -128,28 +116,14 @@ int main(int argc, char *argv[]) {
...
@@ -128,28 +116,14 @@ int main(int argc, char *argv[]) {
GridView
const
leafView
=
grid
->
leafView
();
GridView
const
leafView
=
grid
->
leafView
();
// }}}
// }}}
// Set up faces
// Set up myFaces
BoundaryPatch
<
GridView
>
lowerFace
(
leafView
);
MyFaces
<
GridView
,
MyGeometry
>
myFaces
(
leafView
,
myGeometry
);
BoundaryPatch
<
GridView
>
upperFace
(
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
]);
});
}
// Neumann boundary
// Neumann boundary
BoundaryPatch
<
GridView
>
const
neumannBoundary
(
leafView
);
BoundaryPatch
<
GridView
>
const
neumannBoundary
(
leafView
);
// Frictional Boundary
// Frictional Boundary
BoundaryPatch
<
GridView
>
const
&
frictionalBoundary
=
lower
Face
;
BoundaryPatch
<
GridView
>
const
&
frictionalBoundary
=
myFaces
.
lower
;
Dune
::
BitSetVector
<
1
>
frictionalNodes
(
fineVertexCount
);
Dune
::
BitSetVector
<
1
>
frictionalNodes
(
fineVertexCount
);
frictionalBoundary
.
getVertices
(
frictionalNodes
);
frictionalBoundary
.
getVertices
(
frictionalNodes
);
...
@@ -157,10 +131,10 @@ int main(int argc, char *argv[]) {
...
@@ -157,10 +131,10 @@ int main(int argc, char *argv[]) {
Dune
::
BitSetVector
<
dims
>
noNodes
(
fineVertexCount
);
Dune
::
BitSetVector
<
dims
>
noNodes
(
fineVertexCount
);
Dune
::
BitSetVector
<
dims
>
dirichletNodes
(
fineVertexCount
);
Dune
::
BitSetVector
<
dims
>
dirichletNodes
(
fineVertexCount
);
for
(
size_t
i
=
0
;
i
<
fineVertexCount
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
fineVertexCount
;
++
i
)
{
if
(
lower
Face
.
containsVertex
(
i
))
if
(
myFaces
.
lower
.
containsVertex
(
i
))
dirichletNodes
[
i
][
1
]
=
true
;
dirichletNodes
[
i
][
1
]
=
true
;
if
(
upper
Face
.
containsVertex
(
i
))
if
(
myFaces
.
upper
.
containsVertex
(
i
))
dirichletNodes
[
i
]
=
true
;
dirichletNodes
[
i
]
=
true
;
}
}
...
@@ -204,7 +178,8 @@ int main(int argc, char *argv[]) {
...
@@ -204,7 +178,8 @@ int main(int argc, char *argv[]) {
// Assemble forces
// Assemble forces
Vector
gravityFunctional
;
Vector
gravityFunctional
;
myAssembler
.
assembleBodyForce
(
gravity
,
density
,
zenith
,
gravityFunctional
);
myAssembler
.
assembleBodyForce
(
gravity
,
density
,
myGeometry
.
zenith
,
gravityFunctional
);
// Problem formulation: right-hand side
// Problem formulation: right-hand side
auto
const
computeExternalForces
=
[
&
](
double
_relativeTime
,
Vector
&
_ell
)
{
auto
const
computeExternalForces
=
[
&
](
double
_relativeTime
,
Vector
&
_ell
)
{
...
@@ -219,12 +194,12 @@ int main(int argc, char *argv[]) {
...
@@ -219,12 +194,12 @@ int main(int argc, char *argv[]) {
{
{
double
volume
=
1.0
;
double
volume
=
1.0
;
for
(
size_t
i
=
0
;
i
<
dims
;
++
i
)
for
(
size_t
i
=
0
;
i
<
dims
;
++
i
)
volume
*=
(
upperRight
[
i
]
-
lowerLeft
[
i
]);
volume
*=
(
myGeometry
.
C
[
i
]
-
myGeometry
.
A
[
i
]);
double
area
=
1.0
;
double
area
=
1.0
;
for
(
size_t
i
=
0
;
i
<
dims
;
++
i
)
for
(
size_t
i
=
0
;
i
<
dims
;
++
i
)
if
(
i
!=
1
)
if
(
i
!=
1
)
area
*=
(
upperRight
[
i
]
-
lowerLeft
[
i
]);
area
*=
(
myGeometry
.
C
[
i
]
-
myGeometry
.
A
[
i
]);
// volume * gravity * density / area = normal stress
// volume * gravity * density / area = normal stress
// V * g * rho / A = sigma_n
// V * g * rho / A = sigma_n
...
...
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