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
54cf9ff6
Commit
54cf9ff6
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use make_shared; use blockvectors
parent
18d76394
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/tectonic/globallaursennonlinearity.hh
+8
-10
8 additions, 10 deletions
dune/tectonic/globallaursennonlinearity.hh
dune/tectonic/globalruinanonlinearity.hh
+12
-12
12 additions, 12 deletions
dune/tectonic/globalruinanonlinearity.hh
src/one-body-sample.cc
+29
-35
29 additions, 35 deletions
src/one-body-sample.cc
with
49 additions
and
57 deletions
dune/tectonic/globallaursennonlinearity.hh
+
8
−
10
View file @
54cf9ff6
...
...
@@ -19,9 +19,9 @@ template <int dim, class OuterFunctionType>
class
GlobalLaursenNonlinearity
:
public
GlobalNonlinearity
<
dim
>
{
public:
GlobalLaursenNonlinearity
(
shared_ptr
<
std
::
v
ector
<
double
>
const
>
mu
,
shared_ptr
<
std
::
v
ector
<
double
>
const
>
normalStress
,
shared_ptr
<
std
::
v
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
)
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
mu
,
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
normalStress
,
shared_ptr
<
BlockV
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
)
:
mu
(
mu
),
normalStress
(
normalStress
),
nodalIntegrals
(
nodalIntegrals
)
{}
/*
...
...
@@ -43,18 +43,16 @@ class GlobalLaursenNonlinearity : public GlobalNonlinearity<dim> {
coefficient
*=
(
*
normalStress
)[
i
];
coefficient
*=
1
+
(
*
mu
)[
i
];
shared_ptr
<
NiceFunction
const
>
const
func
(
new
OuterFunctionType
(
coefficient
));
return
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>
(
new
LocalNonlinearity
<
dim
>
(
func
));
return
make_shared
<
LocalNonlinearity
<
dim
>
const
>
(
make_shared
<
OuterFunctionType
const
>
(
coefficient
));
}
private
:
// TODO: If we're clever, we only store one vector with the precomputed
// results
shared_ptr
<
std
::
v
ector
<
double
>
const
>
mu
;
shared_ptr
<
std
::
v
ector
<
double
>
const
>
normalStress
;
shared_ptr
<
std
::
v
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
;
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
mu
;
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
normalStress
;
shared_ptr
<
BlockV
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
;
};
}
#endif
This diff is collapsed.
Click to expand it.
dune/tectonic/globalruinanonlinearity.hh
+
12
−
12
View file @
54cf9ff6
...
...
@@ -19,11 +19,11 @@ template <int dim>
class
GlobalRuinaNonlinearity
:
public
GlobalNonlinearity
<
dim
>
{
public:
GlobalRuinaNonlinearity
(
shared_ptr
<
std
::
v
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
,
shared_ptr
<
std
::
v
ector
<
double
>
const
>
a
,
shared_ptr
<
std
::
v
ector
<
double
>
const
>
mu
,
shared_ptr
<
std
::
v
ector
<
double
>
const
>
eta
,
shared_ptr
<
std
::
v
ector
<
double
>
const
>
normalStress
)
shared_ptr
<
BlockV
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
,
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
a
,
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
mu
,
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
eta
,
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
normalStress
)
:
nodalIntegrals
(
nodalIntegrals
),
a
(
a
),
mu
(
mu
),
...
...
@@ -40,19 +40,19 @@ class GlobalRuinaNonlinearity : public GlobalNonlinearity<dim> {
return
trivialNonlinearity
;
shared_ptr
<
NiceFunction
const
>
const
func
(
new
RuinaFunction
((
*
nodalIntegrals
)[
i
][
0
],
(
*
a
)[
i
],
(
*
mu
)[
i
]
,
(
*
eta
)[
i
],
(
*
normalStress
)[
i
]));
new
RuinaFunction
((
*
nodalIntegrals
)[
i
][
0
],
(
*
a
)[
i
]
[
0
]
,
(
*
mu
)[
i
]
[
0
],
(
*
eta
)[
i
][
0
],
(
*
normalStress
)[
i
]
[
0
]
));
return
shared_ptr
<
LocalNonlinearity
<
dim
>>
(
new
LocalNonlinearity
<
dim
>
(
func
));
}
private
:
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>
const
trivialNonlinearity
;
shared_ptr
<
std
::
v
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
;
shared_ptr
<
std
::
v
ector
<
double
>
const
>
a
;
shared_ptr
<
std
::
v
ector
<
double
>
const
>
mu
;
shared_ptr
<
std
::
v
ector
<
double
>
const
>
eta
;
shared_ptr
<
std
::
v
ector
<
double
>
const
>
normalStress
;
shared_ptr
<
BlockV
ector
<
FieldVector
<
double
,
1
>>
const
>
nodalIntegrals
;
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
a
;
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
mu
;
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
eta
;
shared_ptr
<
BlockVector
<
FieldV
ector
<
double
,
1
>
>
const
>
normalStress
;
};
}
#endif
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
29
−
35
View file @
54cf9ff6
...
...
@@ -121,7 +121,7 @@ template <class GridType, class GridView, class LocalVectorType, class FEBasis>
void
assemble_frictional
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
frictionalNodes
,
std
::
v
ector
<
Dune
::
FieldVector
<
double
,
1
>>
&
nodalIntegrals
)
{
Dune
::
BlockV
ector
<
Dune
::
FieldVector
<
double
,
1
>>
&
nodalIntegrals
)
{
BoundaryPatch
<
GridView
>
frictionalBoundary
(
gridView
,
frictionalNodes
);
ConstantFunction
<
LocalVectorType
,
Dune
::
FieldVector
<
double
,
1
>>
constantOneFunction
(
1
);
...
...
@@ -138,42 +138,36 @@ void assemble_frictional(
void
assemble_nonlinearity
(
int
size
,
Dune
::
ParameterTree
const
&
parset
,
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
dim
>
const
>
&
myGlobalNonlinearity
,
Dune
::
shared_ptr
<
std
::
v
ector
<
Dune
::
FieldVector
<
double
,
1
>>>
Dune
::
shared_ptr
<
Dune
::
BlockV
ector
<
Dune
::
FieldVector
<
double
,
1
>>>
nodalIntegrals
)
{
// {{{ Assemble terms for the nonlinearity
auto
mu
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
());
mu
->
resize
(
size
);
std
::
fill
(
mu
->
begin
(),
mu
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.mu"
)
)
;
auto
mu
=
Dune
::
make_shared
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
(
size
);
*
mu
=
parset
.
get
<
double
>
(
"boundary.friction.mu"
);
auto
normalStress
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
());
normalStress
->
resize
(
size
);
std
::
fill
(
normalStress
->
begin
(),
normalStress
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.normalstress"
));
Dune
::
make_shared
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
(
size
);
*
normalStress
=
parset
.
get
<
double
>
(
"boundary.friction.normalstress"
);
std
::
string
const
friction_model
=
parset
.
get
<
std
::
string
>
(
"boundary.friction.model"
);
if
(
friction_model
==
std
::
string
(
"Ruina"
))
{
auto
a
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
());
a
->
resize
(
size
);
std
::
fill
(
a
->
begin
(),
a
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.ruina.a"
));
auto
eta
=
Dune
::
shared_ptr
<
std
::
vector
<
double
>>
(
new
std
::
vector
<
double
>
());
eta
->
resize
(
size
);
std
::
fill
(
eta
->
begin
(),
eta
->
end
(),
parset
.
get
<
double
>
(
"boundary.friction.eta"
));
auto
const
tmp
=
new
Dune
::
GlobalRuinaNonlinearity
<
dim
>
(
nodalIntegrals
,
a
,
mu
,
eta
,
normalStress
);
auto
a
=
Dune
::
make_shared
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
(
size
);
*
a
=
parset
.
get
<
double
>
(
"boundary.friction.ruina.a"
);
auto
eta
=
Dune
::
make_shared
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
(
size
);
*
eta
=
parset
.
get
<
double
>
(
"boundary.friction.eta"
);
myGlobalNonlinearity
=
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
dim
>
const
>
(
tmp
);
Dune
::
make_shared
<
Dune
::
GlobalRuinaNonlinearity
<
dim
>
const
>
(
nodalIntegrals
,
a
,
mu
,
eta
,
normalStress
);
}
else
if
(
friction_model
==
std
::
string
(
"Laursen"
))
{
auto
const
tmp
=
new
Dune
::
GlobalLaursenNonlinearity
<
dim
,
Dune
::
LinearFunction
>
(
mu
,
normalStress
,
nodalIntegrals
);
myGlobalNonlinearity
=
Dune
::
shared_ptr
<
Dune
::
GlobalNonlinearity
<
dim
>
const
>
(
tmp
);
myGlobalNonlinearity
=
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
dim
,
Dune
::
LinearFunction
>
const
>
(
mu
,
normalStress
,
nodalIntegrals
);
}
else
{
assert
(
false
);
}
...
...
@@ -263,8 +257,7 @@ int main(int argc, char *argv[]) {
VectorType
b3
;
auto
nodalIntegrals
=
Dune
::
shared_ptr
<
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>>
(
new
std
::
vector
<
Dune
::
FieldVector
<
double
,
1
>>
);
Dune
::
make_shared
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
();
assemble_frictional
<
GridType
,
GridView
,
SmallVector
,
P1Basis
>
(
leafView
,
p1Basis
,
frictionalNodes
,
*
nodalIntegrals
);
...
...
@@ -310,12 +303,13 @@ int main(int argc, char *argv[]) {
Dune
::
VTKWriter
<
GridView
>
writer
(
leafView
);
std
::
string
filename
((
boost
::
format
(
"obs%d"
)
%
run
).
str
());
Dune
::
shared_ptr
<
VTKBasisGridFunction
<
P1Basis
,
VectorType
>>
displacement_ptr
(
new
VTKBasisGridFunction
<
P1Basis
,
VectorType
>
(
p1Basis
,
u1
,
"displacement"
));
Dune
::
shared_ptr
<
VTKBasisGridFunction
<
P0Basis
,
CellVectorType
>>
vonmises_ptr
(
new
VTKBasisGridFunction
<
P0Basis
,
CellVectorType
>
(
p0Basis
,
vonMisesStress
,
"stress"
));
auto
displacement_ptr
=
Dune
::
make_shared
<
VTKBasisGridFunction
<
P1Basis
,
VectorType
>>
(
p1Basis
,
u1
,
"displacement"
);
auto
vonmises_ptr
=
Dune
::
make_shared
<
VTKBasisGridFunction
<
P0Basis
,
CellVectorType
>>
(
p0Basis
,
vonMisesStress
,
"stress"
);
writer
.
addVertexData
(
displacement_ptr
);
writer
.
addCellData
(
vonmises_ptr
);
writer
.
write
(
filename
.
c_str
());
...
...
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