Go to the documentation of this file.
23 #include "libmesh/linear_implicit_system.h"
24 #include "libmesh/linear_solver.h"
25 #include "libmesh/equation_systems.h"
26 #include "libmesh/numeric_vector.h"
28 #include "libmesh/sparse_matrix.h"
29 #include "libmesh/system_subset.h"
38 const std::string & name_in,
39 const unsigned int number_in) :
41 Parent (es, name_in, number_in),
43 _n_linear_iterations (0),
44 _final_linear_residual (1.e20),
45 _shell_matrix(nullptr),
102 if (subset !=
nullptr)
103 libmesh_assert_equal_to (&subset->
get_system(),
this);
129 const unsigned int maxits =
130 es.
parameters.
get<
unsigned int>(
"linear solver maximum iterations");
136 std::pair<unsigned int, Real> rval = std::make_pair(0,0.0);
378 *(this->
rhs) *= -1.0;
Real _final_linear_residual
The final residual for the linear system Ax=b.
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
Manages consistently variables, degrees of freedom, and coefficient vectors.
const SparseMatrix< Number > * request_matrix(const std::string &mat_name) const
const EquationSystems & get_equation_systems() const
NumericVector< Number > * rhs
The system matrix.
virtual void clear() override
Clear all the data structures associated with the system.
const SystemSubset * _subset
The current subset on which to solve (or nullptr if none).
virtual void release_linear_solver(LinearSolver< Number > *) const override
Releases a pointer to a linear solver acquired by this->get_linear_solver()
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
The libMesh namespace provides an interface to certain functionality in the library.
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
virtual void solve() override
Assembles & solves the linear system A*x=b.
virtual void restrict_solve_to(const SystemSubset *subset, const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) override
After calling this method, any solve will be limited to the given subset.
ShellMatrix< Number > * _shell_matrix
User supplies shell matrix or nullptr if no shell matrix is used.
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
virtual void init_data() override
Initializes new data members of the system.
virtual LinearSolver< Number > * get_linear_solver() const override
virtual void clear() override
Clear all the data structures associated with the system.
const System & get_system() const
SparseMatrix< Number > * matrix
The system matrix.
virtual void assemble() override
Prepares matrix and _dof_map for matrix assembly.
virtual void assembly(bool get_residual, bool get_jacobian, bool apply_heterogeneous_constraints=false, bool apply_no_constraints=false) override
Assembles a residual in rhs and/or a jacobian in matrix, as requested.
SubsetSolveMode _subset_solve_mode
If restrict-solve-to-subset mode is active, this member decides what happens with the dofs outside th...
This is a base class for classes which represent subsets of the dofs of a System.
virtual ~LinearImplicitSystem()
Destructor.
This is the EquationSystems class.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
LinearImplicitSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
const std::string & name() const
This base class can be inherited from to provide interfaces to linear solvers from different packages...
virtual const std::vector< unsigned int > & dof_ids() const =0
bool on_command_line(std::string arg)
unsigned int _n_linear_iterations
The number of linear iterations required to solve the linear system Ax=b.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void init_data() override
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
const T & get(const std::string &) const
void attach_shell_matrix(ShellMatrix< Number > *shell_matrix)
This function enables the user to provide a shell matrix, i.e.
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
virtual void update()
Update the local values to reflect the solution on neighboring processors.
std::unique_ptr< LinearSolver< Number > > linear_solver
The LinearSolver defines the interface used to solve the linear_implicit system.
Parameters parameters
Data structure holding arbitrary parameters.