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"
30#include "libmesh/static_condensation.h"
31#include "libmesh/static_condensation_preconditioner.h"
38 const std::string & name_in,
39 const unsigned int number_in) :
41 Parent (es, name_in, number_in),
42 _n_linear_iterations (0),
43 _final_linear_residual (1.e20),
44 _shell_matrix(nullptr),
116 if (subset !=
nullptr)
117 libmesh_assert_equal_to (&subset->
get_system(),
this);
143 std::pair<unsigned int, Real> rval = std::make_pair(0,0.0);
379 *(this->
rhs) *= -1.0;
This is the EquationSystems class.
NumericVector< Number > * rhs
The system matrix.
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...
virtual std::pair< unsigned int, Real > get_linear_solve_parameters() const
SparseMatrix< Number > * matrix
The system matrix.
virtual void clear() override
Clear all the data structures associated with the system.
virtual void create_static_condensation() override
Request that static condensation be performed for this system.
void setup_static_condensation_preconditioner(T &solver)
Sets up the static condensation preconditioner for the supplied solver.
std::unique_ptr< LinearSolver< Number > > linear_solver
This class handles all the details of interfacing with various linear algebra packages like PETSc or ...
void attach_shell_matrix(ShellMatrix< Number > *shell_matrix)
This function enables the user to provide a shell matrix, i.e.
virtual LinearSolver< Number > * get_linear_solver() const override
LinearImplicitSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
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.
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.
virtual void init_data() override
Initializes new data members of the system.
ShellMatrix< Number > * _shell_matrix
User supplies shell matrix or nullptr if no shell matrix is used.
unsigned int _n_linear_iterations
The number of linear iterations required to solve the linear system Ax=b.
virtual void solve() override
Assembles & solves the linear system A*x=b.
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
Real _final_linear_residual
The final residual for the linear system Ax=b.
virtual void create_static_condensation() override
Request that static condensation be performed for this system.
virtual void assemble() override
Prepares matrix and _dof_map for matrix assembly.
virtual void clear() override
Clear all the data structures associated with the system.
SubsetSolveMode _subset_solve_mode
If restrict-solve-to-subset mode is active, this member decides what happens with the dofs outside th...
const SystemSubset * _subset
The current subset on which to solve (or nullptr if none).
virtual ~LinearImplicitSystem()
This base class can be inherited from to provide interfaces to linear solvers from different packages...
static std::unique_ptr< LinearSolver< T > > build(const libMesh::Parallel::Communicator &comm_in, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a LinearSolver using the linear solver package specified by solver_package.
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
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].
const Parallel::Communicator & comm() const
Generic shell matrix, i.e.
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
This is a base class for classes which represent subsets of the dofs of a System.
const System & get_system() const
virtual const std::vector< unsigned int > & dof_ids() const =0
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
bool prefix_with_name() const
bool assemble_before_solve
Flag which tells the system to whether or not to call the user assembly function during each call to ...
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
virtual void init_data()
Initializes the data for the system.
virtual void update()
Update the local values to reflect the solution on neighboring processors.
bool has_static_condensation() const
std::string prefix() const
const SparseMatrix< Number > * request_matrix(std::string_view mat_name) const
The libMesh namespace provides an interface to certain functionality in the library.
SubsetSolveMode
defines an enum for the question what happens to the dofs outside the given subset when a system is s...