www.mooseframework.org
NonlinearSystem.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "NonlinearSystemBase.h"
13 #include "ComputeResidualFunctor.h"
15 
22 {
23 public:
24  NonlinearSystem(FEProblemBase & problem, const std::string & name);
25  virtual ~NonlinearSystem();
26 
27  virtual SparseMatrix<Number> & addMatrix(TagID tag) override;
28 
29  virtual void solve() override;
30 
34  virtual void stopSolve() override;
35 
40  virtual unsigned int getCurrentNonlinearIterationNumber() override
41  {
42  return _transient_sys.get_current_nonlinear_iteration_number();
43  }
44 
45  virtual void setupFiniteDifferencedPreconditioner() override;
46 
51  virtual bool converged() override;
52 
53  virtual NumericVector<Number> & RHS() override { return *_transient_sys.rhs; }
54 
55  virtual NonlinearSolver<Number> * nonlinearSolver() override
56  {
57  return _transient_sys.nonlinear_solver.get();
58  }
59 
60  NumericVector<Number> & solutionOld() override { return *_transient_sys.old_local_solution; }
61  const NumericVector<Number> & solutionOld() const override
62  {
63  return *_transient_sys.old_local_solution;
64  }
65 
66  NumericVector<Number> & solutionOlder() override { return *_transient_sys.older_local_solution; }
67  const NumericVector<Number> & solutionOlder() const override
68  {
69  return *_transient_sys.older_local_solution;
70  }
71 
72  virtual TransientNonlinearImplicitSystem & sys() { return _transient_sys; }
73 
74 protected:
75  TransientNonlinearImplicitSystem & _transient_sys;
78 
79 private:
86 
98 
100 };
101 
virtual SparseMatrix< Number > & addMatrix(TagID tag) override
Adds a jacobian sized vector.
const NumericVector< Number > & solutionOld() const override
virtual void solve() override
Solve the system (using libMesh magic)
unsigned int TagID
Definition: MooseTypes.h:162
NonlinearSystem(FEProblemBase &problem, const std::string &name)
virtual void setupFiniteDifferencedPreconditioner() override
ComputeResidualFunctor _nl_residual_functor
virtual void stopSolve() override
Quit the current solve as soon as possible.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
NumericVector< Number > & solutionOlder() override
virtual NonlinearSolver< Number > * nonlinearSolver() override
Nonlinear system to be solved.
virtual const std::string & name() const
Definition: SystemBase.C:1088
ComputeFDResidualFunctor _fd_residual_functor
const NumericVector< Number > & solutionOlder() const override
void setupColoringFiniteDifferencedPreconditioner()
According to the nonzero pattern provided in the matrix, a graph is constructed.
virtual unsigned int getCurrentNonlinearIterationNumber() override
Returns the current nonlinear iteration number.
bool _use_coloring_finite_difference
TransientNonlinearImplicitSystem & _transient_sys
virtual NumericVector< Number > & RHS() override
virtual bool converged() override
Returns the convergence state.
NumericVector< Number > & solutionOld() override
virtual TransientNonlinearImplicitSystem & sys()
Nonlinear system to be solved.
void setupStandardFiniteDifferencedPreconditioner()
Form preconditioning matrix via a standard finite difference method column-by-column.
virtual ~NonlinearSystem()