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
7e286c1e
Commit
7e286c1e
authored
11 years ago
by
Elias Pipping
Committed by
Elias Pipping
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Do not distinguish between left- and right gradient
parent
ea23ff25
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/ellipticenergy.hh
+6
-15
6 additions, 15 deletions
dune/tectonic/ellipticenergy.hh
dune/tectonic/frictionpotential.hh
+3
-11
3 additions, 11 deletions
dune/tectonic/frictionpotential.hh
dune/tectonic/localfriction.hh
+10
-29
10 additions, 29 deletions
dune/tectonic/localfriction.hh
with
19 additions
and
55 deletions
dune/tectonic/ellipticenergy.hh
+
6
−
15
View file @
7e286c1e
...
@@ -52,9 +52,9 @@ template <int dim> class EllipticEnergy {
...
@@ -52,9 +52,9 @@ template <int dim> class EllipticEnergy {
// returns false if the direction is tangential
// returns false if the direction is tangential
void
descentDirectionNew
(
SmallVector
const
&
x
,
SmallVector
&
ret
)
const
{
void
descentDirectionNew
(
SmallVector
const
&
x
,
SmallVector
&
ret
)
const
{
SmallVector
pg
;
SmallVector
pg
;
upperG
radient
(
x
,
pg
);
g
radient
(
x
,
pg
);
SmallVector
mg
;
SmallVector
mg
;
lowerG
radient
(
x
,
mg
);
g
radient
(
x
,
mg
);
double
const
pgx
=
pg
*
x
;
double
const
pgx
=
pg
*
x
;
double
const
mgx
=
mg
*
x
;
double
const
mgx
=
mg
*
x
;
if
(
pgx
>=
0
&&
mgx
>=
0
)
{
if
(
pgx
>=
0
&&
mgx
>=
0
)
{
...
@@ -78,9 +78,9 @@ template <int dim> class EllipticEnergy {
...
@@ -78,9 +78,9 @@ template <int dim> class EllipticEnergy {
}
}
SmallVector
pg
;
SmallVector
pg
;
upperG
radient
(
x
,
pg
);
g
radient
(
x
,
pg
);
SmallVector
mg
;
SmallVector
mg
;
lowerG
radient
(
x
,
mg
);
g
radient
(
x
,
mg
);
double
const
pgx
=
pg
*
x
;
double
const
pgx
=
pg
*
x
;
double
const
mgx
=
mg
*
x
;
double
const
mgx
=
mg
*
x
;
if
(
pgx
>=
0
&&
mgx
>=
0
)
{
if
(
pgx
>=
0
&&
mgx
>=
0
)
{
...
@@ -118,17 +118,8 @@ template <int dim> class EllipticEnergy {
...
@@ -118,17 +118,8 @@ template <int dim> class EllipticEnergy {
y
[
ignore
]
=
0
;
y
[
ignore
]
=
0
;
}
}
void
upperGradient
(
SmallVector
const
&
x
,
SmallVector
&
y
)
const
{
void
gradient
(
SmallVector
const
&
x
,
SmallVector
&
y
)
const
{
phi
->
upperGradient
(
x
,
y
);
phi
->
gradient
(
x
,
y
);
SmallVector
z
;
smoothGradient
(
x
,
z
);
y
+=
z
;
if
(
ignore
!=
dim
)
y
[
ignore
]
=
0
;
}
void
lowerGradient
(
SmallVector
const
&
x
,
SmallVector
&
y
)
const
{
phi
->
lowerGradient
(
x
,
y
);
SmallVector
z
;
SmallVector
z
;
smoothGradient
(
x
,
z
);
smoothGradient
(
x
,
z
);
y
+=
z
;
y
+=
z
;
...
...
This diff is collapsed.
Click to expand it.
dune/tectonic/frictionpotential.hh
+
3
−
11
View file @
7e286c1e
...
@@ -16,9 +16,7 @@ class FrictionPotentialWrapper {
...
@@ -16,9 +16,7 @@ class FrictionPotentialWrapper {
public:
public:
virtual
~
FrictionPotentialWrapper
()
{}
virtual
~
FrictionPotentialWrapper
()
{}
double
virtual
leftDifferential
(
double
s
)
const
=
0
;
double
virtual
differential
(
double
s
)
const
=
0
;
double
virtual
rightDifferential
(
double
s
)
const
=
0
;
double
virtual
second_deriv
(
double
x
)
const
=
0
;
double
virtual
second_deriv
(
double
x
)
const
=
0
;
double
virtual
regularity
(
double
s
)
const
=
0
;
double
virtual
regularity
(
double
s
)
const
=
0
;
...
@@ -61,7 +59,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
...
@@ -61,7 +59,7 @@ class FrictionPotential : public FrictionPotentialWrapper {
// log(V/V_m) if V >= V_0
// log(V/V_m) if V >= V_0
// 0 otherwise
// 0 otherwise
double
virtual
leftD
ifferential
(
double
V
)
const
{
double
virtual
d
ifferential
(
double
V
)
const
{
assert
(
V
>=
0
);
assert
(
V
>=
0
);
if
(
V
<=
V_m
)
if
(
V
<=
V_m
)
return
0
;
return
0
;
...
@@ -69,10 +67,6 @@ class FrictionPotential : public FrictionPotentialWrapper {
...
@@ -69,10 +67,6 @@ class FrictionPotential : public FrictionPotentialWrapper {
return
coefficientProduct
*
std
::
log
(
V
/
V_m
);
return
coefficientProduct
*
std
::
log
(
V
/
V_m
);
}
}
double
virtual
rightDifferential
(
double
V
)
const
{
return
leftDifferential
(
V
);
}
// 1/V if V > V_0
// 1/V if V > V_0
// undefined if V == V_0
// undefined if V == V_0
// 0 if V < V_0
// 0 if V < V_0
...
@@ -104,9 +98,7 @@ class TrivialFunction : public FrictionPotentialWrapper {
...
@@ -104,9 +98,7 @@ class TrivialFunction : public FrictionPotentialWrapper {
public:
public:
double
virtual
evaluate
(
double
)
const
{
return
0
;
}
double
virtual
evaluate
(
double
)
const
{
return
0
;
}
double
virtual
leftDifferential
(
double
)
const
{
return
0
;
}
double
virtual
differential
(
double
)
const
{
return
0
;
}
double
virtual
rightDifferential
(
double
)
const
{
return
0
;
}
double
virtual
second_deriv
(
double
)
const
{
return
0
;
}
double
virtual
second_deriv
(
double
)
const
{
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
dune/tectonic/localfriction.hh
+
10
−
29
View file @
7e286c1e
...
@@ -35,21 +35,14 @@ template <int dimension> class LocalFriction {
...
@@ -35,21 +35,14 @@ template <int dimension> class LocalFriction {
// directional subdifferential: at u on the line u + t*v
// directional subdifferential: at u on the line u + t*v
// u and v are assumed to be non-zero
// u and v are assumed to be non-zero
void
directionalSubDiff
(
VectorType
const
&
u
,
VectorType
const
&
v
,
void
directionalSubDiff
(
VectorType
const
&
x
,
VectorType
const
&
v
,
Interval
<
double
>
&
D
)
const
{
Interval
<
double
>
&
D
)
const
{
if
(
u
.
two_norm
()
==
0
)
{
if
(
x
.
two_norm
()
==
0
)
{
D
[
0
]
=
D
[
1
]
=
func
->
rightD
ifferential
(
0
)
*
v
.
two_norm
();
D
[
0
]
=
D
[
1
]
=
func
->
d
ifferential
(
0
)
*
v
.
two_norm
();
return
;
return
;
}
}
double
const
un
=
u
.
two_norm
();
double
const
un
=
x
.
two_norm
();
double
const
ndotp
=
(
u
*
v
)
/
un
;
D
[
0
]
=
D
[
1
]
=
func
->
differential
(
un
)
*
(
x
*
v
)
/
un
;
if
(
ndotp
>
0
)
{
D
[
1
]
=
ndotp
*
func
->
rightDifferential
(
un
);
D
[
0
]
=
ndotp
*
func
->
leftDifferential
(
un
);
}
else
{
D
[
1
]
=
ndotp
*
func
->
leftDifferential
(
un
);
D
[
0
]
=
ndotp
*
func
->
rightDifferential
(
un
);
}
}
}
/** Formula for the derivative:
/** Formula for the derivative:
...
@@ -73,7 +66,7 @@ template <int dimension> class LocalFriction {
...
@@ -73,7 +66,7 @@ template <int dimension> class LocalFriction {
double
const
xnorm
=
std
::
sqrt
(
xnorm2
);
double
const
xnorm
=
std
::
sqrt
(
xnorm2
);
double
const
xnorm3
=
xnorm
*
xnorm2
;
double
const
xnorm3
=
xnorm
*
xnorm2
;
double
const
H1
=
func
->
rightD
ifferential
(
xnorm
);
double
const
H1
=
func
->
d
ifferential
(
xnorm
);
double
const
H2
=
func
->
second_deriv
(
xnorm
);
double
const
H2
=
func
->
second_deriv
(
xnorm
);
// TODO: potential optimisation: factor out (H1 / xnorm), get rid of xnorm3
// TODO: potential optimisation: factor out (H1 / xnorm), get rid of xnorm3
...
@@ -120,24 +113,12 @@ template <int dimension> class LocalFriction {
...
@@ -120,24 +113,12 @@ template <int dimension> class LocalFriction {
if
(
xnorm
==
0
or
std
::
isinf
(
func
->
regularity
(
xnorm
)))
if
(
xnorm
==
0
or
std
::
isinf
(
func
->
regularity
(
xnorm
)))
return
;
return
;
// left and right differential coincide in this case
y
.
axpy
(
func
->
differential
(
xnorm
)
/
xnorm
,
x
);
y
.
axpy
(
func
->
rightDifferential
(
xnorm
)
/
xnorm
,
x
);
}
}
void
upperGradient
(
VectorType
const
&
x
,
VectorType
&
ret
)
const
{
void
gradient
(
VectorType
const
&
x
,
VectorType
&
ret
)
const
{
double
const
xnorm
=
x
.
two_norm
();
ret
=
0
;
assert
(
xnorm
!=
0
);
addGradient
(
x
,
ret
);
ret
=
x
;
ret
*=
func
->
rightDifferential
(
xnorm
)
/
xnorm
;
}
void
lowerGradient
(
VectorType
const
&
x
,
VectorType
&
ret
)
const
{
double
const
xnorm
=
x
.
two_norm
();
assert
(
xnorm
!=
0
);
ret
=
x
;
ret
*=
func
->
leftDifferential
(
xnorm
)
/
xnorm
;
}
}
void
directionalDomain
(
VectorType
const
&
,
VectorType
const
&
,
void
directionalDomain
(
VectorType
const
&
,
VectorType
const
&
,
...
...
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