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),
112 if (subset !=
nullptr)
113 libmesh_assert_equal_to (&subset->
get_system(),
this);
139 std::pair<unsigned int, Real> rval = std::make_pair(0,0.0);
375 *(this->
rhs) *= -1.0;
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.
void attach_shell_matrix(ShellMatrix< Number > *shell_matrix)
This function enables the user to provide a shell matrix, i.e.
virtual void assemble() override
Prepares matrix and _dof_map for matrix assembly.
virtual void create_static_condensation() override
Request that static condensation be performed for this system.
This is the EquationSystems class.
ShellMatrix< Number > * _shell_matrix
User supplies shell matrix or nullptr if no shell matrix is used.
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.
unsigned int _n_linear_iterations
The number of linear iterations required to solve the linear system Ax=b.
virtual void create_static_condensation() override
Request that static condensation be performed for this system.
virtual std::pair< unsigned int, Real > get_linear_solve_parameters() const
virtual void reinit()
Reinitializes degrees of freedom and other required data on the current mesh.
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 clear() override
Clear all the data structures associated with the system.
virtual void init_data()
Initializes the data for the system.
LinearImplicitSystem(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
NumericVector< Number > * rhs
The system matrix.
const Parallel::Communicator & comm() const
virtual void reinit() override
Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be use...
SubsetSolveMode _subset_solve_mode
If restrict-solve-to-subset mode is active, this member decides what happens with the dofs outside th...
virtual LinearSolver< Number > * get_linear_solver() const override
bool has_static_condensation() const
The libMesh namespace provides an interface to certain functionality in the library.
virtual void solve() override
Assembles & solves the linear system A*x=b.
const SparseMatrix< Number > * request_matrix(std::string_view mat_name) const
void setup_static_condensation_preconditioner(T &solver)
Sets up the static condensation preconditioner for the supplied solver.
virtual void init_data() override
Initializes new data members of the system.
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.
std::string prefix() const
This is a base class for classes which represent subsets of the dofs of a System. ...
Manages consistently variables, degrees of freedom, and coefficient vectors.
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
virtual const std::vector< unsigned int > & dof_ids() const =0
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
Real _final_linear_residual
The final residual for the linear system Ax=b.
virtual void update()
Update the local values to reflect the solution on neighboring processors.
virtual void close()=0
Calls the SparseMatrix's internal assembly routines, ensuring that the values are consistent across p...
SparseMatrix< Number > * matrix
The system matrix.
const System & get_system() const
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).
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< LinearSolver< Number > > linear_solver
This class handles all the details of interfacing with various linear algebra packages like PETSc or ...
SubsetSolveMode
defines an enum for the question what happens to the dofs outside the given subset when a system is s...
virtual ~LinearImplicitSystem()
bool prefix_with_name() const