Commit 3d42384d authored by Gräser, Carsten's avatar Gräser, Carsten
Browse files

Introduce local damping in Newton solver

This ensures energy-monotonicity of the smoother
with local Newton-step
parent 749a5bbe
......@@ -51,8 +51,40 @@ class BrittleFractureLocalSolver
// solve for upper left block
FieldVector<double,dim> correction;
H00.solve(correction, g0);
// Extend vector to full size
FieldVector<double,dim+1> direction;
for(std::size_t i=0; i<dim; ++i)
direction[i] = correction[i];
direction[dim] = 0;
// Constrained functional along correction
auto f = [&](auto t) {
auto z = x + t*direction;
return quadraticFunctional(z) + nonlinearFunctional(z);
};
// Reduce step size if needed to ensure monotonicity
double t = 1;
auto f0 = f(0);
auto ft = f(t);
while (std::max(ft-f0, 0.0) > 1e-14 * std::fabs(f0))
{
t *= .5;
ft = f(t);
}
// if (t<1.0)
// {
// std::cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++" << std::endl;
// std::cout << " |direction| = " << direction.infinity_norm() << std::endl;
// std::cout << " |f(0)-f(1)|/|f(0)| = " << std::fabs((f(1)-f0)/f0) << std::endl;
// std::cout << " f(1) = " << f(1) << std::endl;
// std::cout << " f(" << t << ") = " << f(t) << std::endl;
// }
// Apply damped correction
for(std::size_t i=0; i<dim; ++i)
x[i] += correction[i];
x[i] += t*correction[i];
}
template <class SumFunctional, class BitVector>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment