nonlinear_implicit_system.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_NONLINEAR_IMPLICIT_SYSTEM_H
21 #define LIBMESH_NONLINEAR_IMPLICIT_SYSTEM_H
22 
23 // Local Includes
25 
26 // C++ includes
27 
28 namespace libMesh
29 {
30 
31 
32 // Forward declarations
33 class DiffSolver;
34 template<typename T> class NonlinearSolver;
35 
36 
55 {
56 public:
57 
63  const std::string & name,
64  const unsigned int number);
65 
69  virtual ~NonlinearImplicitSystem ();
70 
75 
80 
86  {
87  public:
88  virtual ~ComputeResidual () {}
93  virtual void residual (const NumericVector<Number> & X,
95  sys_type & S) = 0;
96  };
97 
98 
104  {
105  public:
106  virtual ~ComputeJacobian () {}
107 
112  virtual void jacobian (const NumericVector<Number> & X,
114  sys_type & S) = 0;
115  };
116 
117 
123  {
124  public:
125  virtual ~ComputeBounds () {}
126 
131  virtual void bounds (NumericVector<Number> & XL,
133  sys_type & S) = 0;
134  };
135 
148  {
149  public:
151 
157  virtual void operator()(std::vector<NumericVector<Number> *> & sp,
158  sys_type & s) = 0;
159  };
160 
166  {
167  public:
169 
175  virtual void residual_and_jacobian (const NumericVector<Number> & X,
178  sys_type & S) = 0;
179  };
180 
188  {
189  public:
190  virtual ~ComputePostCheck () {}
191 
202  virtual void postcheck (const NumericVector<Number> & old_soln,
203  NumericVector<Number> & search_direction,
204  NumericVector<Number> & new_soln,
205  bool & changed_search_direction,
206  bool & changed_new_soln,
207  sys_type & S) = 0;
208  };
209 
213  sys_type & system () { return *this; }
214 
219  virtual void clear () override;
220 
225  virtual void reinit () override;
226 
230  virtual void solve () override;
231 
237  virtual std::pair<unsigned int, Real>
238  get_linear_solve_parameters() const override;
239 
244  virtual void assembly(bool get_residual,
245  bool get_jacobian,
246  bool apply_heterogeneous_constraints = false,
247  bool apply_no_constraints = false) override;
248 
253  virtual std::string system_type () const override { return "NonlinearImplicit"; }
254 
261  std::unique_ptr<NonlinearSolver<Number>> nonlinear_solver;
262 
267  std::unique_ptr<DiffSolver> diff_solver;
268 
273  unsigned int n_nonlinear_iterations() const { return _n_nonlinear_iterations; }
274 
279 
286 
287 
288 protected:
289 
293  void set_solver_parameters();
294 
300 
305 };
306 
307 } // namespace libMesh
308 
309 #endif // LIBMESH_NONLINEAR_IMPLICIT_SYSTEM_H
Manages multiples systems of equations.
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
virtual void residual(const NumericVector< Number > &X, NumericVector< Number > &R, sys_type &S)=0
virtual void bounds(NumericVector< Number > &XL, NumericVector< Number > &XU, sys_type &S)=0
NonlinearImplicitSystem(EquationSystems &es, const std::string &name, const unsigned int number)
virtual void postcheck(const NumericVector< Number > &old_soln, NumericVector< Number > &search_direction, NumericVector< Number > &new_soln, bool &changed_search_direction, bool &changed_new_soln, sys_type &S)=0
unsigned int number() const
Definition: system.h:2025
virtual void jacobian(const NumericVector< Number > &X, SparseMatrix< Number > &J, sys_type &S)=0
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
virtual void operator()(std::vector< NumericVector< Number > *> &sp, sys_type &s)=0
std::unique_ptr< DiffSolver > diff_solver
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void assembly(bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) override
virtual std::string system_type() const override
const std::string & name() const
Definition: system.h:2017
virtual void residual_and_jacobian(const NumericVector< Number > &X, NumericVector< Number > *R, SparseMatrix< Number > *J, sys_type &S)=0
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems...
virtual std::pair< unsigned int, Real > get_linear_solve_parameters() const override
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...