Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
paraphase
dune-fracture-phasefields
Commits
9b8a756a
Commit
9b8a756a
authored
May 16, 2022
by
Gräser, Carsten
Browse files
Slightly simplify initial bisection interval algorithm
parent
54d820b7
Pipeline
#8763
passed with stage
in 3 minutes and 37 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/brittle-fracture.cc
View file @
9b8a756a
...
...
@@ -911,30 +911,30 @@ int main (int argc, char *argv[]) try
}
// If the domain contains 1, try to find a better initial interval guess.
// Otherwise
u
se domain as initial guess.
// Otherwise s
tay with th
e domain as initial guess.
if
(
contains
(
I
,
1
))
{
// Start from z=1 and successively double the value of z
// until we have found f(z)>=0 for using z as upper bound.
// While doing so, replace the lower bound by z whenever
// f(z)<0. In the special case f(z)=0, we're done and
// can instantly return the root z.
double
z
=
1
;
double
fz
=
f
(
z
);
while
(
fz
<
0
)
// Start from I[1]=1 and successively double the step length
// until we have found an upper bound with f(I[1])>0.
// While doing so, replace the lower bound I[0] by I[1]
// whenever f(I[1])<0. That way I[0] will always be a lower
// bound with f(I[0])<0.
// In the special case f(I[1])=0, we're done and can instantly
// return the found root I[1].
I
[
1
]
=
1
;
fI
[
1
]
=
f
(
I
[
1
]);
while
(
fI
[
1
]
<
0
)
{
I
[
0
]
=
z
;
fI
[
0
]
=
f
z
;
z
=
dom
.
projectIn
(
z
*
2
);
f
z
=
f
(
z
);
I
[
0
]
=
I
[
1
]
;
fI
[
0
]
=
f
I
[
1
]
;
I
[
1
]
=
dom
.
projectIn
(
I
[
1
]
*
2
);
f
I
[
1
]
=
f
(
I
[
1
]
);
}
if
(
f
z
==
0
)
if
(
f
I
[
1
]
==
0
)
{
xi
=
z
;
xi
=
I
[
1
]
;
return
;
}
I
[
1
]
=
z
;
fI
[
1
]
=
fz
;
}
else
fI
[
1
]
=
f
(
I
[
1
]);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment