libMesh
Loading...
Searching...
No Matches
linear_implicit_system.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 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_LINEAR_IMPLICIT_SYSTEM_H
21#define LIBMESH_LINEAR_IMPLICIT_SYSTEM_H
22
23// Local Includes
24#include "libmesh/implicit_system.h"
25
26// C++ includes
27#include <cstddef>
28
29namespace libMesh
30{
31
32
33// Forward Declarations
34template <typename T> class LinearSolver;
35template <typename T> class ShellMatrix;
36
37
56{
57public:
58
63 const std::string & name,
64 const unsigned int number);
65
76
81
86
90 sys_type & system () { return *this; }
91
96 virtual void clear () override;
97
101 virtual void init_data () override;
102
107 virtual void reinit () override;
108
115 virtual void assemble () override { ImplicitSystem::assemble(); }
116
122 virtual void restrict_solve_to (const SystemSubset * subset,
123 const SubsetSolveMode subset_solve_mode=SUBSET_ZERO) override;
124
128 virtual void solve () override;
129
134 virtual LinearSolver<Number> * get_linear_solver() const override;
135
140 virtual void assembly(bool get_residual,
141 bool get_jacobian,
142 bool apply_heterogeneous_constraints = false,
143 bool apply_no_constraints = false) override;
144
149 virtual std::string system_type () const override { return "LinearImplicit"; }
150
155 unsigned int n_linear_iterations() const { return _n_linear_iterations; }
156
161
171 void attach_shell_matrix (ShellMatrix<Number> * shell_matrix);
172
177
183
184 virtual void create_static_condensation() override;
185
186protected:
187
193
198
203
208
214};
215
216} // namespace libMesh
217
218#endif // LIBMESH_LINEAR_IMPLICIT_SYSTEM_H
This is the EquationSystems class.
Manages consistently variables, degrees of freedom, coefficient vectors, and matrices for implicit sy...
virtual void assemble() override
Prepares matrix and rhs for system assembly, then calls user assembly function.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and linear solvers ...
void attach_shell_matrix(ShellMatrix< Number > *shell_matrix)
This function enables the user to provide a shell matrix, i.e.
LinearImplicitSystem & operator=(const LinearImplicitSystem &)=delete
LinearImplicitSystem(const LinearImplicitSystem &)=delete
Special functions.
virtual LinearSolver< Number > * get_linear_solver() const override
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 std::string system_type() const override
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...
LinearImplicitSystem sys_type
The type of system.
void detach_shell_matrix()
Detaches a shell matrix.
Real _final_linear_residual
The final residual for the linear system Ax=b.
ShellMatrix< Number > * get_shell_matrix()
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.
LinearImplicitSystem(LinearImplicitSystem &&)=default
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).
ImplicitSystem Parent
The type of the parent.
This base class can be inherited from to provide interfaces to linear solvers from different packages...
Generic shell matrix, i.e.
This is a base class for classes which represent subsets of the dofs of a System.
const std::string & name() const
Definition system.h:2385
unsigned int number() const
Definition system.h:2393
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...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real