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
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
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
agnumpde
dune-tectonic
Commits
548db504
Commit
548db504
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Proper time discretisation
parent
a7969146
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/globalruinanonlinearity.hh
+4
-2
4 additions, 2 deletions
dune/tectonic/globalruinanonlinearity.hh
dune/tectonic/nicefunction.hh
+17
-12
17 additions, 12 deletions
dune/tectonic/nicefunction.hh
src/one-body-sample.cc
+10
-7
10 additions, 7 deletions
src/one-body-sample.cc
with
31 additions
and
21 deletions
dune/tectonic/globalruinanonlinearity.hh
+
4
−
2
View file @
548db504
...
@@ -26,13 +26,14 @@ class GlobalRuinaNonlinearity
...
@@ -26,13 +26,14 @@ class GlobalRuinaNonlinearity
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
mu
,
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
mu
,
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
eta
,
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
eta
,
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
normalStress
,
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
normalStress
,
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
state
)
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
state
,
double
h
)
:
nodalIntegrals
(
nodalIntegrals
),
:
nodalIntegrals
(
nodalIntegrals
),
a
(
a
),
a
(
a
),
mu
(
mu
),
mu
(
mu
),
eta
(
eta
),
eta
(
eta
),
normalStress
(
normalStress
),
normalStress
(
normalStress
),
state
(
state
),
state
(
state
),
h
(
h
),
trivialNonlinearity
(
trivialNonlinearity
(
new
LocalNonlinearity
<
dim
>
(
make_shared
<
TrivialFunction
const
>
())),
new
LocalNonlinearity
<
dim
>
(
make_shared
<
TrivialFunction
const
>
())),
restrictions
(
nodalIntegrals
->
size
())
// TODO: can we get the size from
restrictions
(
nodalIntegrals
->
size
())
// TODO: can we get the size from
...
@@ -54,7 +55,7 @@ class GlobalRuinaNonlinearity
...
@@ -54,7 +55,7 @@ class GlobalRuinaNonlinearity
auto
const
func
=
make_shared
<
RuinaFunction
const
>
(
auto
const
func
=
make_shared
<
RuinaFunction
const
>
(
(
*
nodalIntegrals
)[
i
][
0
],
(
*
a
)[
i
][
0
],
(
*
mu
)[
i
][
0
],
(
*
eta
)[
i
][
0
],
(
*
nodalIntegrals
)[
i
][
0
],
(
*
a
)[
i
][
0
],
(
*
mu
)[
i
][
0
],
(
*
eta
)[
i
][
0
],
(
*
normalStress
)[
i
][
0
],
(
*
state
)[
i
][
0
]);
(
*
normalStress
)[
i
][
0
],
(
*
state
)[
i
][
0
]
,
h
);
restrictions
[
i
]
=
make_shared
<
LocalNonlinearity
<
dim
>
const
>
(
func
);
restrictions
[
i
]
=
make_shared
<
LocalNonlinearity
<
dim
>
const
>
(
func
);
return
restrictions
[
i
];
return
restrictions
[
i
];
}
}
...
@@ -68,6 +69,7 @@ class GlobalRuinaNonlinearity
...
@@ -68,6 +69,7 @@ class GlobalRuinaNonlinearity
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
eta
;
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
eta
;
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
normalStress
;
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
normalStress
;
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
state
;
shared_ptr
<
BlockVector
<
FieldVector
<
double
,
1
>>
const
>
state
;
double
const
h
;
std
::
vector
<
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>>
mutable
restrictions
;
std
::
vector
<
shared_ptr
<
LocalNonlinearity
<
dim
>
const
>>
mutable
restrictions
;
};
};
...
...
This diff is collapsed.
Click to expand it.
dune/tectonic/nicefunction.hh
+
17
−
12
View file @
548db504
...
@@ -31,14 +31,15 @@ class NiceFunction : public VirtualFunction<double, double> {
...
@@ -31,14 +31,15 @@ class NiceFunction : public VirtualFunction<double, double> {
class
RuinaFunction
:
public
NiceFunction
{
class
RuinaFunction
:
public
NiceFunction
{
public:
public:
RuinaFunction
(
double
coefficient
,
double
a
,
double
mu
,
double
eta
,
RuinaFunction
(
double
coefficient
,
double
a
,
double
mu
,
double
eta
,
double
normalStress
,
double
state
)
double
normalStress
,
double
state
,
double
h
)
:
coefficient
(
coefficient
),
:
coefficient
(
coefficient
),
a
(
a
),
a
(
a
),
mu
(
mu
),
mu
(
mu
),
rho
(
exp
(
-
mu
/
a
)),
rho
(
exp
(
-
mu
/
a
)),
eta
(
eta
),
eta
(
eta
),
normalStress
(
normalStress
),
normalStress
(
normalStress
),
state
(
state
)
{}
state
(
state
),
h
(
h
)
{}
/*
/*
If mu and sigma_n denote the coefficient of friction and the
If mu and sigma_n denote the coefficient of friction and the
...
@@ -48,17 +49,18 @@ class RuinaFunction : public NiceFunction {
...
@@ -48,17 +49,18 @@ class RuinaFunction : public NiceFunction {
with the constants a and b from Ruina's model and
with the constants a and b from Ruina's model and
h
(beta) = beta (a (log beta - 1) + mu)
r
(beta) = beta (a (log beta - 1) + mu)
as well as
as well as
rho = exp(-mu/a)
rho = exp(-mu/a)
*/
*/
void
virtual
evaluate
(
double
const
&
x
,
double
&
y
)
const
{
void
virtual
evaluate
(
double
const
&
x
,
double
&
y
)
const
{
double
const
arg
=
std
::
max
(
eta
*
x
,
rho
);
double
const
arg
=
std
::
max
(
eta
*
x
/
h
,
rho
);
double
const
h
=
arg
*
(
a
*
(
std
::
log
(
arg
)
-
1
)
+
mu
+
state
);
double
const
r
=
arg
*
(
a
*
(
std
::
log
(
arg
)
-
1
)
+
mu
+
state
);
y
=
1
/
eta
*
normalStress
*
h
+
a
*
rho
+
mu
+
state
;
y
=
1
/
eta
*
normalStress
*
r
+
a
*
rho
+
mu
+
state
;
y
*=
coefficient
;
y
*=
coefficient
;
y
*=
h
;
}
}
/*
/*
...
@@ -69,18 +71,20 @@ class RuinaFunction : public NiceFunction {
...
@@ -69,18 +71,20 @@ class RuinaFunction : public NiceFunction {
= a * log(eta x) + mu
= a * log(eta x) + mu
*/
*/
double
virtual
leftDifferential
(
double
s
)
const
{
double
virtual
leftDifferential
(
double
s
)
const
{
if
(
eta
*
s
<=
rho
)
double
const
arg
=
eta
*
s
/
h
;
if
(
arg
<=
rho
)
return
0
;
return
0
;
return
coefficient
*
normalStress
*
(
a
*
std
::
log
(
eta
*
s
)
+
mu
+
state
);
return
coefficient
*
normalStress
*
(
a
*
std
::
log
(
arg
)
+
mu
+
state
);
}
}
/* see above */
/* see above */
double
virtual
rightDifferential
(
double
s
)
const
{
double
virtual
rightDifferential
(
double
s
)
const
{
if
(
eta
*
s
<=
rho
)
double
const
arg
=
eta
*
s
/
h
;
if
(
arg
<=
rho
)
return
0
;
return
0
;
return
coefficient
*
normalStress
*
(
a
*
std
::
log
(
eta
*
s
)
+
mu
+
state
);
return
coefficient
*
normalStress
*
(
a
*
std
::
log
(
arg
)
+
mu
+
state
);
}
}
/*
/*
...
@@ -90,10 +94,10 @@ class RuinaFunction : public NiceFunction {
...
@@ -90,10 +94,10 @@ class RuinaFunction : public NiceFunction {
*/
*/
double
virtual
second_deriv
(
double
s
)
const
{
double
virtual
second_deriv
(
double
s
)
const
{
// includes the case eta * s = rho for which there is no second derivative
// includes the case eta * s = rho for which there is no second derivative
if
(
eta
*
s
<=
rho
)
if
(
eta
*
s
/
h
<=
rho
)
return
0
;
return
0
;
else
else
return
coefficient
*
normalStress
*
(
a
/
s
)
;
return
coefficient
*
normalStress
*
a
/
s
;
}
}
double
virtual
regularity
(
double
s
)
const
{
double
virtual
regularity
(
double
s
)
const
{
...
@@ -110,6 +114,7 @@ class RuinaFunction : public NiceFunction {
...
@@ -110,6 +114,7 @@ class RuinaFunction : public NiceFunction {
double
const
eta
;
double
const
eta
;
double
const
normalStress
;
double
const
normalStress
;
double
const
state
;
double
const
state
;
double
const
h
;
double
const
rho
;
double
const
rho
;
};
};
...
...
This diff is collapsed.
Click to expand it.
src/one-body-sample.cc
+
10
−
7
View file @
548db504
...
@@ -103,11 +103,12 @@ template <class GridType, class GridView, class LocalVectorType, class FEBasis>
...
@@ -103,11 +103,12 @@ template <class GridType, class GridView, class LocalVectorType, class FEBasis>
void
assemble_neumann
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
void
assemble_neumann
(
GridView
const
&
gridView
,
FEBasis
const
&
feBasis
,
Dune
::
BitSetVector
<
1
>
const
&
neumannNodes
,
Dune
::
BitSetVector
<
1
>
const
&
neumannNodes
,
Dune
::
BlockVector
<
LocalVectorType
>
&
f
,
Dune
::
BlockVector
<
LocalVectorType
>
&
f
,
int
run
)
{
// constant sample function on neumann boundary
double
time
)
{
// constant sample function on neumann
// boundary
BoundaryPatch
<
GridView
>
neumannBoundary
(
gridView
,
neumannNodes
);
BoundaryPatch
<
GridView
>
neumannBoundary
(
gridView
,
neumannNodes
);
LocalVectorType
SampleVector
(
0
);
LocalVectorType
SampleVector
(
0
);
// FIXME: random values (time-dependent)
// FIXME: random values (time-dependent)
SampleVector
[
0
]
=
run
/
10.0
;
SampleVector
[
0
]
=
time
;
SampleVector
[
1
]
=
0
;
SampleVector
[
1
]
=
0
;
ConstantFunction
<
LocalVectorType
,
LocalVectorType
>
fNeumann
(
SampleVector
);
ConstantFunction
<
LocalVectorType
,
LocalVectorType
>
fNeumann
(
SampleVector
);
NeumannBoundaryAssembler
<
GridType
,
LocalVectorType
>
neumannBoundaryAssembler
(
NeumannBoundaryAssembler
<
GridType
,
LocalVectorType
>
neumannBoundaryAssembler
(
...
@@ -145,7 +146,8 @@ assemble_nonlinearity(
...
@@ -145,7 +146,8 @@ assemble_nonlinearity(
int
size
,
Dune
::
ParameterTree
const
&
parset
,
int
size
,
Dune
::
ParameterTree
const
&
parset
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
nodalIntegrals
,
nodalIntegrals
,
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
state
)
{
Dune
::
shared_ptr
<
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>>
state
,
double
h
)
{
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>
SingletonVectorType
;
typedef
Dune
::
BlockVector
<
Dune
::
FieldVector
<
double
,
1
>>
SingletonVectorType
;
// {{{ Assemble terms for the nonlinearity
// {{{ Assemble terms for the nonlinearity
...
@@ -166,7 +168,7 @@ assemble_nonlinearity(
...
@@ -166,7 +168,7 @@ assemble_nonlinearity(
return
Dune
::
make_shared
<
return
Dune
::
make_shared
<
Dune
::
GlobalRuinaNonlinearity
<
VectorType
,
MatrixType
>
const
>
(
Dune
::
GlobalRuinaNonlinearity
<
VectorType
,
MatrixType
>
const
>
(
nodalIntegrals
,
a
,
mu
,
eta
,
normalStress
,
state
);
nodalIntegrals
,
a
,
mu
,
eta
,
normalStress
,
state
,
h
);
}
else
if
(
friction_model
==
std
::
string
(
"Laursen"
))
{
}
else
if
(
friction_model
==
std
::
string
(
"Laursen"
))
{
return
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
return
Dune
::
make_shared
<
Dune
::
GlobalLaursenNonlinearity
<
Dune
::
LinearFunction
,
VectorType
,
MatrixType
>
const
>
(
mu
,
normalStress
,
Dune
::
LinearFunction
,
VectorType
,
MatrixType
>
const
>
(
mu
,
normalStress
,
...
@@ -312,6 +314,7 @@ int main(int argc, char *argv[]) {
...
@@ -312,6 +314,7 @@ int main(int argc, char *argv[]) {
timer
.
reset
();
timer
.
reset
();
auto
const
timesteps
=
parset
.
get
<
size_t
>
(
"timesteps"
);
auto
const
timesteps
=
parset
.
get
<
size_t
>
(
"timesteps"
);
double
h
=
1.0
/
timesteps
;
for
(
size_t
run
=
1
;
run
<=
timesteps
;
++
run
)
{
for
(
size_t
run
=
1
;
run
<=
timesteps
;
++
run
)
{
if
(
parset
.
get
<
bool
>
(
"printProgress"
))
{
if
(
parset
.
get
<
bool
>
(
"printProgress"
))
{
std
::
cout
<<
"."
;
std
::
cout
<<
"."
;
...
@@ -320,7 +323,7 @@ int main(int argc, char *argv[]) {
...
@@ -320,7 +323,7 @@ int main(int argc, char *argv[]) {
// b = neumann
// b = neumann
assemble_neumann
<
GridType
,
GridView
,
SmallVector
,
P1Basis
>
(
assemble_neumann
<
GridType
,
GridView
,
SmallVector
,
P1Basis
>
(
leafView
,
p1Basis
,
neumannNodes
,
b1
,
run
);
leafView
,
p1Basis
,
neumannNodes
,
b1
,
h
*
run
);
b2
=
b1
;
b2
=
b1
;
b3
=
b1
;
b3
=
b1
;
b4
=
b1
;
b4
=
b1
;
...
@@ -339,7 +342,7 @@ int main(int argc, char *argv[]) {
...
@@ -339,7 +342,7 @@ int main(int argc, char *argv[]) {
auto
myGlobalNonlinearity
=
auto
myGlobalNonlinearity
=
assemble_nonlinearity
<
VectorType
,
OperatorType
>
(
assemble_nonlinearity
<
VectorType
,
OperatorType
>
(
grid
->
size
(
grid
->
maxLevel
(),
dim
),
parset
,
nodalIntegrals
,
grid
->
size
(
grid
->
maxLevel
(),
dim
),
parset
,
nodalIntegrals
,
state
);
state
,
h
);
MyConvexProblemType
myConvexProblem
(
stiffnessMatrix
,
MyConvexProblemType
myConvexProblem
(
stiffnessMatrix
,
*
myGlobalNonlinearity
,
b1
);
*
myGlobalNonlinearity
,
b1
);
MyBlockProblemType
myBlockProblem
(
parset
,
myConvexProblem
);
MyBlockProblemType
myBlockProblem
(
parset
,
myConvexProblem
);
...
@@ -362,7 +365,7 @@ int main(int argc, char *argv[]) {
...
@@ -362,7 +365,7 @@ int main(int argc, char *argv[]) {
auto
myGlobalNonlinearity
=
auto
myGlobalNonlinearity
=
assemble_nonlinearity
<
VectorType
,
OperatorType
>
(
assemble_nonlinearity
<
VectorType
,
OperatorType
>
(
grid
->
size
(
grid
->
maxLevel
(),
dim
),
parset
,
nodalIntegrals
,
grid
->
size
(
grid
->
maxLevel
(),
dim
),
parset
,
nodalIntegrals
,
state
);
state
,
h
);
MyConvexProblemType
myConvexProblem
(
stiffnessMatrix
,
MyConvexProblemType
myConvexProblem
(
stiffnessMatrix
,
*
myGlobalNonlinearity
,
b4
);
*
myGlobalNonlinearity
,
b4
);
...
...
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