Plugins
newton_limex.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2015: G-CSC, Goethe University Frankfurt
3  * Author: Markus Breit,
4  * but largely copied from ugcore Newton implementation by Andreas Vogel
5  *
6  * This file is part of UG4.
7  *
8  * UG4 is free software: you can redistribute it and/or modify it under the
9  * terms of the GNU Lesser General Public License version 3 (as published by the
10  * Free Software Foundation) with the following additional attribution
11  * requirements (according to LGPL/GPL v3 §7):
12  *
13  * (1) The following notice must be displayed in the Appropriate Legal Notices
14  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
15  *
16  * (2) The following notice must be displayed at a prominent place in the
17  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
18  *
19  * (3) The following bibliography is recommended for citation and must be
20  * preserved in all covered files:
21  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
22  * parallel geometric multigrid solver on hierarchically distributed grids.
23  * Computing and visualization in science 16, 4 (2013), 151-164"
24  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
25  * flexible software system for simulating pde based models on high performance
26  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
27  *
28  * This program is distributed in the hope that it will be useful,
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31  * GNU Lesser General Public License for more details.
32  */
33 
34 #ifndef UG_PLUGINS__LIMEX__NEWTON_LIMEX
35 #define UG_PLUGINS__LIMEX__NEWTON_LIMEX
36 
40 
44 
45 
46 namespace ug {
47 
49 template <typename TAlgebra>
51  : public IOperatorInverse<typename TAlgebra::vector_type>
52  //public DebugWritingObject<TAlgebra>
53 {
54  public:
56  typedef TAlgebra algebra_type;
57 
60 
63 
64  public:
67 
70 
73 
77 
79  virtual bool init(SmartPtr<IOperator<vector_type> > N);
80 
82  virtual bool prepare(vector_type& u);
83 
85  virtual bool apply(vector_type& u);
86 
94  virtual std::string config_string() const;
95 
97  number linear_solver_rate() const;
98 
100  int linear_solver_steps() const;
101 
102  private:
105  void write_debug(const vector_type& vec, const char* filename);
106  void write_debug(const matrix_type& mat, const char* filename);
108 
109  private:
112 
113 
116 
119 
122 
123 
129 };
130 
131 } // namespace ug
132 
133 #include "newton_limex_impl.h"
134 
135 #endif // UG_PLUGINS__LIMEX__NEWTON_LIMEX
Newton solver for assembling-based discretizations solved using Limex.
Definition: newton_limex.h:53
TAlgebra algebra_type
algebra type
Definition: newton_limex.h:56
SmartPtr< AssembledLinearOperator< algebra_type > > m_J
jacobi operator
Definition: newton_limex.h:118
number m_linSolverRate
Definition: newton_limex.h:127
TAlgebra::vector_type vector_type
vector type
Definition: newton_limex.h:59
LimexNewtonSolver()
default constructor
Definition: newton_limex_impl.h:57
virtual bool prepare(vector_type &u)
prepare operator
Definition: newton_limex_impl.h:107
size_t m_linSolverSteps
Definition: newton_limex.h:126
void write_debug(const vector_type &vec, const char *filename)
TAlgebra::matrix_type matrix_type
matrix type
Definition: newton_limex.h:62
SmartPtr< ILinearOperatorInverse< vector_type > > m_spLinearSolver
linear solver
Definition: newton_limex.h:111
number linear_solver_rate() const
prints average linear solver convergence
Definition: newton_limex_impl.h:209
SmartPtr< IAssemble< TAlgebra > > m_spAss
assembling
Definition: newton_limex.h:121
virtual bool init(SmartPtr< IOperator< vector_type > > N)
This operator inverts the operator N: Y -> X.
Definition: newton_limex_impl.h:94
SmartPtr< AssembledOperator< algebra_type > > m_N
assembling routine
Definition: newton_limex.h:115
void set_linear_solver(SmartPtr< ILinearOperatorInverse< vector_type > > LinearSolver)
sets the linear solver
Definition: newton_limex.h:75
virtual std::string config_string() const
Returns information about configuration parameters. This should return necessary information about pa...
Definition: newton_limex_impl.h:221
virtual bool apply(vector_type &u)
apply operator, i.e. N^{-1}(0) = u
Definition: newton_limex_impl.h:114
void write_debug(const matrix_type &mat, const char *filename)
int linear_solver_steps() const
information on linear solver convergence
Definition: newton_limex_impl.h:215
ParallelMatrix< SparseMatrix< double > > matrix_type
ParallelVector< Vector< double > > vector_type
double number