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
No related branches found
No related tags found
No related merge requests found
...@@ -27,18 +27,20 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { ...@@ -27,18 +27,20 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
/** \brief Solves one local system using a modified gradient method */ /** \brief Solves one local system using a modified gradient method */
class IterateObject; class IterateObject;
MyBlockProblem(MyConvexProblemType &problem) : problem(problem) { MyBlockProblem(Dune::ParameterTree &parset, MyConvexProblemType &problem)
bisection = : parset(parset), problem(problem) {
Bisection(0.0, // acceptError: Stop if the search interval has bisection = Bisection(
// become smaller than this number 0.0, // acceptError: Stop if the search interval has
1.0, // acceptFactor: ? // become smaller than this number
1e-12, // requiredResidual: ? 1.0, // acceptFactor: ?
true, // fastQuadratic parset.get<double>("bisection.requiredResidual"), true, // fastQuadratic
0); // safety: acceptance factor for inexact minimization 0); // safety: acceptance factor for inexact minimization
} }
/** \brief Constructs and returns an iterate object */ /** \brief Constructs and returns an iterate object */
IterateObject getIterateObject() { return IterateObject(bisection, problem); } IterateObject getIterateObject() {
return IterateObject(parset, bisection, problem);
}
private: private:
// problem data // problem data
...@@ -46,6 +48,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem { ...@@ -46,6 +48,8 @@ template <class MyConvexProblemTypeTEMPLATE> class MyBlockProblem {
// commonly used minimization stuff // commonly used minimization stuff
Bisection bisection; Bisection bisection;
Dune::ParameterTree &parset;
}; };
/** \brief Solves one local system using a scalar Gauss-Seidel method */ /** \brief Solves one local system using a scalar Gauss-Seidel method */
...@@ -58,8 +62,9 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject { ...@@ -58,8 +62,9 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject {
* \param bisection The class used to do a scalar bisection * \param bisection The class used to do a scalar bisection
* \param problem The problem including quadratic part and nonlinear part * \param problem The problem including quadratic part and nonlinear part
*/ */
IterateObject(Bisection const &bisection, MyConvexProblemType &problem) IterateObject(Dune::ParameterTree &parset, Bisection const &bisection,
: problem(problem), bisection(bisection) {} MyConvexProblemType &problem)
: parset(parset), problem(problem), bisection(bisection) {}
public: public:
/** \brief Set the current iterate */ /** \brief Set the current iterate */
...@@ -119,11 +124,14 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject { ...@@ -119,11 +124,14 @@ class MyBlockProblem<MyConvexProblemTypeTEMPLATE>::IterateObject {
ignore_component); ignore_component);
LocalVectorType correction; LocalVectorType correction;
Dune::minimise(localJ, ui, 5, bisection); // FIXME: hardcoded value Dune::minimise(localJ, ui, parset.get<size_t>("localsolver.steps"),
bisection);
} }
} }
private: private:
Dune::ParameterTree &parset;
// problem data // problem data
MyConvexProblemType &problem; MyConvexProblemType &problem;
......
...@@ -257,7 +257,7 @@ int main(int argc, char *argv[]) { ...@@ -257,7 +257,7 @@ int main(int argc, char *argv[]) {
{ {
MyConvexProblemType myConvexProblem(stiffnessMatrix, MyConvexProblemType myConvexProblem(stiffnessMatrix,
*myGlobalNonlinearity, b1, u1); *myGlobalNonlinearity, b1, u1);
MyBlockProblemType myBlockProblem(myConvexProblem); MyBlockProblemType myBlockProblem(parset, myConvexProblem);
nonlinearGSStep.setProblem(u1, myBlockProblem); nonlinearGSStep.setProblem(u1, myBlockProblem);
LoopSolver<VectorType> solver(&nonlinearGSStep, solver_maxIterations, LoopSolver<VectorType> solver(&nonlinearGSStep, solver_maxIterations,
......
...@@ -11,6 +11,12 @@ nu = 0.3 ...@@ -11,6 +11,12 @@ nu = 0.3
maxiterations = 100000 maxiterations = 100000
tolerance = 1e-6 tolerance = 1e-6
[localsolver]
steps = 5
[bisection]
requiredResidual = 1e-12
[boundary.friction] [boundary.friction]
normalstress = 0.1 normalstress = 0.1
mu = 0.75 mu = 0.75
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment