Skip to content
Snippets Groups Projects
Commit 1eb936d7 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Get requiredResidual and local steps from parset

parent 1a741aea
Branches
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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,
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment