diff --git a/dune/tectonic/myblockproblem.hh b/dune/tectonic/myblockproblem.hh index ed34b4f850be7beeda7f8fd1acc0e41971c752d1..da843328d0687cd7cab4e11f9d0f1869ec816065 100644 --- a/dune/tectonic/myblockproblem.hh +++ b/dune/tectonic/myblockproblem.hh @@ -27,18 +27,20 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { /** \brief Solves one local system using a modified gradient method */ class IterateObject; - MyBlockProblem(MyConvexProblemType &problem) : problem(problem) { - bisection = - Bisection(0.0, // acceptError: Stop if the search interval has - // become smaller than this number - 1.0, // acceptFactor: ? - 1e-12, // requiredResidual: ? - true, // fastQuadratic - 0); // safety: acceptance factor for inexact minimization + MyBlockProblem(Dune::ParameterTree &parset, MyConvexProblemType &problem) + : parset(parset), problem(problem) { + bisection = Bisection( + 0.0, // acceptError: Stop if the search interval has + // become smaller than this number + 1.0, // acceptFactor: ? + parset.get<double>("bisection.requiredResidual"), true, // fastQuadratic + 0); // safety: acceptance factor for inexact minimization } /** \brief Constructs and returns an iterate object */ - IterateObject getIterateObject() { return IterateObject(bisection, problem); } + IterateObject getIterateObject() { + return IterateObject(parset, bisection, problem); + } private: // problem data @@ -46,6 +48,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { // commonly used minimization stuff Bisection bisection; + + Dune::ParameterTree &parset; }; /** \brief Solves one local system using a scalar Gauss-Seidel method */ @@ -58,8 +62,9 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject { * \param bisection The class used to do a scalar bisection * \param problem The problem including quadratic part and nonlinear part */ - IterateObject(Bisection const &bisection, MyConvexProblemType &problem) - : problem(problem), bisection(bisection) {} + IterateObject(Dune::ParameterTree &parset, Bisection const &bisection, + MyConvexProblemType &problem) + : parset(parset), problem(problem), bisection(bisection) {} public: /** \brief Set the current iterate */ @@ -119,11 +124,14 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject { ignore_component); LocalVectorType correction; - Dune::minimise(localJ, ui, 5, bisection); // FIXME: hardcoded value + Dune::minimise(localJ, ui, parset.get<size_t>("localsolver.steps"), + bisection); } } private: + Dune::ParameterTree &parset; + // problem data MyConvexProblemType &problem; diff --git a/src/one-body-sample.cc b/src/one-body-sample.cc index 6eb97709eeb36b0d31d4efddcfd141d24a8de5f6..b296fdcd43de74bb54f8709e3e1494f3c161be83 100644 --- a/src/one-body-sample.cc +++ b/src/one-body-sample.cc @@ -257,7 +257,7 @@ int main(int argc, char *argv[]) { { MyConvexProblemType myConvexProblem(stiffnessMatrix, *myGlobalNonlinearity, b1, u1); - MyBlockProblemType myBlockProblem(myConvexProblem); + MyBlockProblemType myBlockProblem(parset, myConvexProblem); nonlinearGSStep.setProblem(u1, myBlockProblem); LoopSolver<VectorType> solver(&nonlinearGSStep, solver_maxIterations, diff --git a/src/one-body-sample.parset b/src/one-body-sample.parset index 7559941db6b4bdde342ca385b3a55324ef6a2f8a..3a282cdb0e1f86576adad24a9942000d3a80166d 100644 --- a/src/one-body-sample.parset +++ b/src/one-body-sample.parset @@ -11,6 +11,12 @@ nu = 0.3 maxiterations = 100000 tolerance = 1e-6 +[localsolver] +steps = 5 + +[bisection] +requiredResidual = 1e-12 + [boundary.friction] normalstress = 0.1 mu = 0.75