diff_solver.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_DIFF_SOLVER_H
21 #define LIBMESH_DIFF_SOLVER_H
22 
23 // Local includes
24 #include "libmesh/auto_ptr.h" // deprecated
25 #include "libmesh/libmesh_common.h"
28 
29 // C++ includes
30 #include <vector>
31 #include <memory>
32 
33 namespace libMesh
34 {
35 
36 // Forward Declarations
37 class ImplicitSystem;
38 template <typename T> class NumericVector;
39 
44 {
45 public:
46  virtual void operator() (const NumericVector<Number> & delta_u,
47  const double & norm_delta_u,
48  const NumericVector<Number> & u,
49  const double & norm_u,
50  const NumericVector<Number> & res,
51  const double & norm_res,
52  const unsigned int iteration) = 0;
53  virtual ~LinearSolutionMonitor();
54 };
55 
57 
71 class DiffSolver : public ReferenceCountedObject<DiffSolver>,
72  public ParallelObject
73 {
74 public:
79 
84  DiffSolver (sys_type & s);
85 
92  static std::unique_ptr<DiffSolver> build(sys_type & s);
93 
97  virtual ~DiffSolver () {}
98 
103  virtual void init ();
104 
109  virtual void reinit ();
110 
116  virtual unsigned int solve () = 0;
117 
122  unsigned int total_outer_iterations() { return _outer_iterations; }
123 
128  unsigned int total_inner_iterations() { return _inner_iterations; }
129 
133  unsigned int solve_result() { return _solve_result; }
134 
138  const sys_type & system () const { return _system; }
139 
143  sys_type & system () { return _system; }
144 
149  unsigned int max_linear_iterations;
150 
158 
163  bool quiet;
164 
169  bool verbose;
170 
176 
182 
194 
206 
212 
217 
223  enum SolveResult {
229 
235 
241 
247 
253 
259 
265 
272 
278 
284  };
285 
289  std::unique_ptr<LinearSolutionMonitor> linear_solution_monitor;
290 
291 protected:
292 
298 
305 
309  unsigned int _outer_iterations;
310 
314  unsigned int _inner_iterations;
315 
320 
327  unsigned int _solve_result;
328 };
329 
330 
331 } // namespace libMesh
332 
333 
334 #endif // LIBMESH_DIFF_SOLVER_H
bool continue_after_max_iterations
Definition: diff_solver.h:175
virtual ~DiffSolver()
Definition: diff_solver.h:97
unsigned int solve_result()
Definition: diff_solver.h:133
unsigned int max_nonlinear_iterations
Definition: diff_solver.h:157
Real absolute_residual_tolerance
Definition: diff_solver.h:192
ImplicitSystem sys_type
Definition: diff_solver.h:78
virtual void reinit()
Definition: diff_solver.C:60
static std::unique_ptr< DiffSolver > build(sys_type &s)
Definition: diff_solver.C:53
unsigned int _solve_result
Definition: diff_solver.h:327
unsigned int _inner_iterations
Definition: diff_solver.h:314
unsigned int total_outer_iterations()
Definition: diff_solver.h:122
virtual void init()
Definition: diff_solver.C:69
sys_type & _system
Definition: diff_solver.h:319
unsigned int max_linear_iterations
Definition: diff_solver.h:149
virtual unsigned int solve()=0
const sys_type & system() const
Definition: diff_solver.h:138
An object whose state is distributed along a set of processors.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool continue_after_backtrack_failure
Definition: diff_solver.h:181
unsigned int _outer_iterations
Definition: diff_solver.h:309
sys_type & system()
Definition: diff_solver.h:143
DiffSolver(sys_type &s)
Definition: diff_solver.C:28
unsigned int total_inner_iterations()
Definition: diff_solver.h:128
Real relative_residual_tolerance
Definition: diff_solver.h:193
std::unique_ptr< LinearSolutionMonitor > linear_solution_monitor
Definition: diff_solver.h:289
virtual void operator()(const NumericVector< Number > &delta_u, const double &norm_delta_u, const NumericVector< Number > &u, const double &norm_u, const NumericVector< Number > &res, const double &norm_res, const unsigned int iteration)=0
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...