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
642c7456
Commit
642c7456
authored
11 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
[Cleanup] Move body info to a separate class
parent
0d66c910
Branches
master
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/tectonic/body.hh
+22
-0
22 additions, 0 deletions
dune/tectonic/body.hh
src/mybody.hh
+42
-0
42 additions, 0 deletions
src/mybody.hh
src/one-body-sample.cc
+13
-15
13 additions, 15 deletions
src/one-body-sample.cc
with
77 additions
and
15 deletions
dune/tectonic/body.hh
0 → 100644
+
22
−
0
View file @
642c7456
#ifndef BODY_HH
#define BODY_HH
template
<
int
dimension
>
struct
Body
{
using
ScalarFunction
=
Dune
::
VirtualFunction
<
Dune
::
FieldVector
<
double
,
dimension
>
,
Dune
::
FieldVector
<
double
,
1
>>
;
using
VectorField
=
Dune
::
VirtualFunction
<
Dune
::
FieldVector
<
double
,
dimension
>
,
Dune
::
FieldVector
<
double
,
dimension
>>
;
double
virtual
getPoissonRatio
()
const
=
0
;
double
virtual
getYoungModulus
()
const
=
0
;
double
virtual
getShearViscosity
()
const
=
0
;
double
virtual
getBulkViscosity
()
const
=
0
;
double
virtual
getDensity
()
const
=
0
;
double
virtual
getGravity
()
const
=
0
;
};
#endif
This diff is collapsed.
Click to expand it.
src/mybody.hh
0 → 100644
+
42
−
0
View file @
642c7456
#ifndef MY_BODY_HH
#define MY_BODY_HH
#include
<dune/common/fvector.hh>
#include
<dune/tectonic/body.hh>
#include
"mygeometry.hh"
template
<
int
dimension
>
class
MyBody
:
public
Body
<
dimension
>
{
using
typename
Body
<
dimension
>::
ScalarFunction
;
using
typename
Body
<
dimension
>::
VectorField
;
public:
MyBody
(
Dune
::
ParameterTree
const
&
parset
,
MyGeometry
const
&
mygeometry
)
:
poissonRatio_
(
parset
.
get
<
double
>
(
"body.poissonRatio"
)),
youngModulus_
(
parset
.
get
<
double
>
(
"body.youngModulus"
)),
shearViscosity_
(
parset
.
get
<
double
>
(
"body.shearViscosity"
)),
bulkViscosity_
(
parset
.
get
<
double
>
(
"body.bulkViscosity"
)),
density_
(
parset
.
get
<
double
>
(
"body.density"
)),
gravity_
(
parset
.
get
<
double
>
(
"gravity"
))
{}
double
getPoissonRatio
()
const
override
{
return
poissonRatio_
;
}
double
getYoungModulus
()
const
override
{
return
youngModulus_
;
}
double
getShearViscosity
()
const
override
{
return
shearViscosity_
;
}
double
getBulkViscosity
()
const
override
{
return
bulkViscosity_
;
}
double
getDensity
()
const
override
{
return
density_
;
}
double
getGravity
()
const
override
{
return
gravity_
;
}
private
:
double
const
poissonRatio_
;
double
const
youngModulus_
;
double
const
shearViscosity_
;
double
const
bulkViscosity_
;
double
const
density_
;
double
const
gravity_
;
};
#endif
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
13
−
15
View file @
642c7456
...
...
@@ -72,6 +72,7 @@
#include
"enum_verbosity.cc"
#include
"enums.hh"
#include
"friction_writer.hh"
#include
"mybody.hh"
#include
"mygeometry.hh"
#include
"mygrid.hh"
#include
"solverfactory.hh"
...
...
@@ -97,13 +98,6 @@ int main(int argc, char *argv[]) {
MyGeometry
const
myGeometry
;
auto
const
youngModulus
=
parset
.
get
<
double
>
(
"body.youngModulus"
);
auto
const
poissonRatio
=
parset
.
get
<
double
>
(
"body.poissonRatio"
);
auto
const
shearViscosity
=
parset
.
get
<
double
>
(
"body.shearViscosity"
);
auto
const
bulkViscosity
=
parset
.
get
<
double
>
(
"body.bulkViscosity"
);
auto
const
density
=
parset
.
get
<
double
>
(
"body.density"
);
auto
const
gravity
=
parset
.
get
<
double
>
(
"gravity"
);
// {{{ Set up grid
using
Grid
=
Dune
::
ALUGrid
<
dims
,
dims
,
Dune
::
simplex
,
Dune
::
nonconforming
>
;
auto
grid
=
constructGrid
<
Grid
>
(
myGeometry
);
// FIXME
...
...
@@ -162,10 +156,14 @@ int main(int argc, char *argv[]) {
MyAssembler
myAssembler
(
leafView
);
MyBody
<
dims
>
const
body
(
parset
,
myGeometry
);
Matrix
A
,
C
,
M
;
myAssembler
.
assembleElasticity
(
youngModulus
,
poissonRatio
,
A
);
myAssembler
.
assembleViscosity
(
shearViscosity
,
bulkViscosity
,
C
);
myAssembler
.
assembleMass
(
density
,
M
);
myAssembler
.
assembleElasticity
(
body
.
getYoungModulus
(),
body
.
getPoissonRatio
(),
A
);
myAssembler
.
assembleViscosity
(
body
.
getShearViscosity
(),
body
.
getBulkViscosity
(),
C
);
myAssembler
.
assembleMass
(
body
.
getDensity
(),
M
);
EnergyNorm
<
Matrix
,
Vector
>
const
ANorm
(
A
),
MNorm
(
M
);
// Q: Does it make sense to weigh them in this manner?
SumNorm
<
Vector
>
const
AMNorm
(
1.0
,
ANorm
,
1.0
,
MNorm
);
...
...
@@ -178,8 +176,8 @@ int main(int argc, char *argv[]) {
// Assemble forces
Vector
gravityFunctional
;
myAssembler
.
assembleBodyForce
(
gravity
,
density
,
myGeometry
.
z
enit
h
,
gravityFunctional
);
myAssembler
.
assembleBodyForce
(
body
.
getGravity
(),
body
.
getD
en
s
it
y
()
,
myGeometry
.
zenith
,
gravityFunctional
);
// Problem formulation: right-hand side
auto
const
computeExternalForces
=
[
&
](
double
_relativeTime
,
Vector
&
_ell
)
{
...
...
@@ -204,7 +202,7 @@ int main(int argc, char *argv[]) {
// volume * gravity * density / area = normal stress
// V * g * rho / A = sigma_n
// m^d * N/kg * kg/m^d / m^(d-1) = N/m^(d-1)
normalStress
=
-
volume
*
g
ravity
*
d
ensity
/
area
;
normalStress
=
-
volume
*
body
.
getG
ravity
()
*
body
.
getD
ensity
()
/
area
;
}
FrictionData
const
frictionData
(
parset
.
sub
(
"boundary.friction"
),
normalStress
);
...
...
@@ -438,8 +436,8 @@ int main(int argc, char *argv[]) {
if
(
parset
.
get
<
bool
>
(
"io.writeVTK"
))
{
ScalarVector
stress
;
myAssembler
.
assembleVonMisesStress
(
y
oungModulus
,
poissonRatio
,
u
,
stress
);
myAssembler
.
assembleVonMisesStress
(
body
.
getY
oungModulus
()
,
body
.
getPoissonRatio
(),
u
,
stress
);
vtkWriter
.
write
(
u
,
v
,
alpha
,
stress
);
}
}
...
...
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