|
WarpX
|
Matrix Preconditione. More...
#include <MatrixPC.H>
Public Types | |
| using | RT = typename T::value_type |
Public Types inherited from Preconditioner< T, Ops > | |
| using | RT = typename T::value_type |
Public Member Functions | |
| MatrixPC ()=default | |
| Default constructor. | |
| ~MatrixPC () override=default | |
| Default destructor. | |
| MatrixPC (const MatrixPC &)=delete | |
| MatrixPC & | operator= (const MatrixPC &)=delete |
| MatrixPC (MatrixPC &&) noexcept=delete | |
| MatrixPC & | operator= (MatrixPC &&) noexcept=delete |
| void | Define (const T &, Ops *const) override |
| Define the preconditioner. | |
| void | Update (const T &a_U) override |
| Update the preconditioner. | |
| int | Assemble (const T &a_U) |
| Assemble the matrix. | |
| void | Apply (T &, const T &) override |
| Apply (solve) the preconditioner given a RHS. | |
| void | getPCMatrix (amrex::Gpu::DeviceVector< int > &a_r_indices_g, amrex::Gpu::DeviceVector< int > &a_num_nz, amrex::Gpu::DeviceVector< int > &a_c_indices_g, amrex::Gpu::DeviceVector< RT > &a_a_ij, int &a_n, int &a_ncols_max) override |
| Get the sparse matrix form of the preconditioner. | |
| void | printParameters () const override |
| Print parameters. | |
| bool | IsDefined () const override |
| Check if the nonlinear solver has been defined. | |
| void | setName (const std::string &a_name) override |
| Set the name for screen output and parsing inputs. | |
Public Member Functions inherited from Preconditioner< T, Ops > | |
| Preconditioner ()=default | |
| Default constructor. | |
| virtual | ~Preconditioner ()=default |
| Default destructor. | |
| Preconditioner (const Preconditioner &)=default | |
| Preconditioner & | operator= (const Preconditioner &)=default |
| Preconditioner (Preconditioner &&) noexcept=default | |
| Preconditioner & | operator= (Preconditioner &&) noexcept=default |
| void | CurTime (const RT a_time) |
| Set the current time. | |
| void | CurTimeStep (const RT a_dt) |
| Set the current time step size. | |
Protected Member Functions | |
| void | readParameters () |
| Read parameters. | |
Protected Attributes | |
| bool | m_is_defined = false |
| bool | m_verbose = true |
| Ops * | m_ops = nullptr |
| int | m_num_amr_levels = 0 |
| amrex::Vector< amrex::Geometry > | m_geom |
| int | m_ndofs_l = 0 |
| int | m_ndofs_g = 0 |
| bool | m_pc_diag_only = false |
| int | m_pc_mat_nnz = 1 |
| int | m_pc_mass_matrix_width = 0 |
| bool | m_pc_mass_matrix_include_ij = false |
| std::string | m_name = "noname" |
| amrex::Gpu::DeviceVector< int > | m_r_indices_g |
| amrex::Gpu::DeviceVector< int > | m_num_nz |
| amrex::Gpu::DeviceVector< int > | m_c_indices_g |
| amrex::Gpu::DeviceVector< amrex::Real > | m_a_ij |
| const amrex::Vector< amrex::Array< amrex::MultiFab *, 3 > > * | m_bcoefs = nullptr |
| int | m_num_realloc = 0 |
Protected Attributes inherited from Preconditioner< T, Ops > | |
| RT | m_time = 0.0 |
| RT | m_dt = 0.0 |
Matrix Preconditione.
This class is templated on a solution-type class T and an operator class Ops. It implements a preconditioner based on constructing and solving the sparse matrix representation of the Jacobian. Currently, it implements constructing/assembling the sparse matrix. An external library with sparse matrix solvers (for example, PETSc) is needed to apply the preconditioner.
The Ops class must have the following function:
The T class must have the following functions:
| using MatrixPC< T, Ops >::RT = typename T::value_type |
|
default |
Default constructor.
|
delete |
|
deletenoexcept |
|
overridevirtual |
Apply (solve) the preconditioner given a RHS.
Given a right-hand-side b, solve: A x = b where A is the linear operator, in this case, the curl-curl operator: A x = curl (alpha * curl (x) ) + beta * x
Implements Preconditioner< T, Ops >.
| int MatrixPC< T, Ops >::Assemble | ( | const T & | a_U | ) |
Assemble the matrix.
Returns 0 if matrix assembly is successful; returns positive integer if allocated arrays are insufficient to hold all non-zero elements (return value is difference in current number of nonzero elements and the desired number).
|
overridevirtual |
Define the preconditioner.
Implements Preconditioner< T, Ops >.
|
inlineoverridevirtual |
Get the sparse matrix form of the preconditioner.
If the preconditioner is based on constructing and solving the sparse matrix form, this function will return the sparse matrix form. Base class implementation aborts with an error message to ensure this function is not called for operator-form preconditioners
Reimplemented from Preconditioner< T, Ops >.
|
inlinenodiscardoverridevirtual |
Check if the nonlinear solver has been defined.
Implements Preconditioner< T, Ops >.
|
delete |
|
deletenoexcept |
|
overridevirtual |
Print parameters.
Reimplemented from Preconditioner< T, Ops >.
|
protected |
Read parameters.
|
inlineoverridevirtual |
Set the name for screen output and parsing inputs.
Reimplemented from Preconditioner< T, Ops >.
|
overridevirtual |
Update the preconditioner.
Implements Preconditioner< T, Ops >.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |