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
e2881681
Commit
e2881681
authored
13 years ago
by
Elias Pipping
Committed by
Elias Pipping
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make RuinaFunction convex(!)
parent
2324ce75
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/tectonic/nicefunction.hh
+23
-26
23 additions, 26 deletions
dune/tectonic/nicefunction.hh
with
23 additions
and
26 deletions
dune/tectonic/nicefunction.hh
+
23
−
26
View file @
e2881681
...
@@ -27,7 +27,9 @@ class NiceFunction {
...
@@ -27,7 +27,9 @@ class NiceFunction {
// Whether H(|.|) is smooth at zero
// Whether H(|.|) is smooth at zero
bool
virtual
smoothesNorm
()
const
{
return
false
;
}
bool
virtual
smoothesNorm
()
const
{
return
false
;
}
void
virtual
evaluate
(
double
const
&
x
,
double
&
y
)
const
=
0
;
void
virtual
evaluate
(
double
const
&
x
,
double
&
y
)
const
{
DUNE_THROW
(
NotImplemented
,
"evaluation not implemented"
);
}
};
};
class
RuinaFunction
:
public
NiceFunction
{
class
RuinaFunction
:
public
NiceFunction
{
...
@@ -35,30 +37,20 @@ class RuinaFunction : public NiceFunction {
...
@@ -35,30 +37,20 @@ class RuinaFunction : public NiceFunction {
RuinaFunction
(
double
coefficient
,
double
a
,
double
mu
,
double
eta
,
RuinaFunction
(
double
coefficient
,
double
a
,
double
mu
,
double
eta
,
double
normalStress
,
double
b
,
double
state
,
double
L
,
double
h
)
double
normalStress
,
double
b
,
double
state
,
double
L
,
double
h
)
:
a
(
a
),
:
a
(
a
),
mu
(
mu
),
eta
(
eta
),
h
(
h
),
h
(
h
),
coefficientProduct
(
coefficient
*
normalStress
),
coefficientProduct
(
coefficient
*
normalStress
),
c
(
mu
+
(
a
-
b
)
*
std
::
log
(
eta
)
-
b
*
std
::
log
(
L
)),
K
(
b
*
K
(
b
*
state
)
// state is assumed to be logarithmic
(
state
-
std
::
log
(
eta
*
L
))),
// state is assumed to be logarithmic
{}
rho
(
std
::
exp
(
-
(
mu
+
K
)
/
a
))
{}
void
virtual
evaluate
(
double
const
&
x
,
double
&
y
)
const
{
double
const
arg
=
x
/
h
;
if
(
arg
==
0
)
{
// TODO: Make this controllable
y
=
0
;
return
;
}
double
const
expstar
=
arg
*
std
::
log
(
arg
)
-
arg
;
y
=
a
*
expstar
+
(
c
+
K
)
*
arg
;
y
*=
coefficientProduct
*
h
;
}
double
virtual
leftDifferential
(
double
x
)
const
{
double
virtual
leftDifferential
(
double
x
)
const
{
double
const
arg
=
x
/
h
;
double
const
arg
=
x
/
h
*
eta
;
if
(
arg
<
1e-14
)
// TODO: Make this controllable
if
(
arg
<
=
rho
)
return
0
;
return
0
;
double
const
ret
=
(
a
*
std
::
log
(
arg
)
+
c
+
K
)
;
double
const
ret
=
a
*
std
::
log
(
arg
)
+
mu
+
K
;
return
coefficientProduct
*
ret
;
return
coefficientProduct
*
ret
;
}
}
...
@@ -66,26 +58,31 @@ class RuinaFunction : public NiceFunction {
...
@@ -66,26 +58,31 @@ class RuinaFunction : public NiceFunction {
return
leftDifferential
(
s
);
return
leftDifferential
(
s
);
}
}
double
virtual
second_deriv
(
double
s
)
const
{
double
virtual
second_deriv
(
double
x
)
const
{
if
(
s
<
1e-14
)
// TODO: Make this controllable
double
const
arg
=
x
/
h
*
eta
;
if
(
arg
<=
rho
)
return
0
;
return
0
;
return
coefficientProduct
*
a
/
s
;
return
coefficientProduct
*
a
/
x
;
}
}
double
virtual
regularity
(
double
s
)
const
{
double
virtual
regularity
(
double
x
)
const
{
if
(
s
==
0
)
double
const
arg
=
x
/
h
*
eta
;
// TODO: Make this controllable
if
(
arg
<
1e-14
||
std
::
abs
(
arg
-
rho
)
<
1e-14
)
return
std
::
numeric_limits
<
double
>::
infinity
();
return
std
::
numeric_limits
<
double
>::
infinity
();
return
std
::
abs
(
second_deriv
(
s
));
return
std
::
abs
(
second_deriv
(
x
));
}
}
private
:
private
:
double
const
a
;
double
const
a
;
double
const
mu
;
double
const
eta
;
double
const
h
;
double
const
h
;
double
const
coefficientProduct
;
double
const
coefficientProduct
;
double
const
c
;
double
const
K
;
double
const
K
;
double
const
rho
;
};
};
class
LinearFunction
:
public
NiceFunction
{
class
LinearFunction
:
public
NiceFunction
{
...
...
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