|
WarpX
|
Point-Jacobi Preconditioner. More...
#include <JacobiPC.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 | |
| JacobiPC ()=default | |
| ~JacobiPC () override=default | |
| JacobiPC (const JacobiPC &)=delete | |
| JacobiPC & | operator= (const JacobiPC &)=delete |
| JacobiPC (JacobiPC &&) noexcept=delete | |
| JacobiPC & | operator= (JacobiPC &&) noexcept=delete |
| void | Define (const T &, Ops *) override |
| Define the preconditioner. | |
| void | Update (const T &a_U) override |
| Update the preconditioner. | |
| void | Apply (T &, const T &) override |
| Solve (I + M) x = b via damped Jacobi iteration. | |
| void | printParameters () const override |
| Print parameters. | |
| bool | IsDefined () const override |
| Check if the nonlinear solver has been defined. | |
| RT | computeResidualNorm (const T &a_x, const T &a_b) const |
| Compute ||b - (I+M)*x|| for residual monitoring. Uses the ghost-padded m_x_ghost (which must already be populated and boundary-filled) for stencil neighbor access. For diagonal-only mass matrices (ncomp=1), uses the fast diagonal formula from x directly. | |
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 |
| virtual void | getPCMatrix (amrex::Gpu::DeviceVector< int > &, amrex::Gpu::DeviceVector< int > &, amrex::Gpu::DeviceVector< int > &, amrex::Gpu::DeviceVector< RT > &, int &, int &) |
| Get the sparse matrix form of the preconditioner. | |
| virtual void | setName (const std::string &) |
| Set the name for screen output and parsing inputs. | |
| void | CurTime (const RT a_time) |
| Set the current time. | |
| void | CurTimeStep (const RT a_dt) |
| Set the current time step size. | |
Protected Types | |
| using | MFArr = amrex::Array<amrex::MultiFab,3> |
Protected Member Functions | |
| void | readParameters () |
| void | copyToGhostAndFill (const amrex::Vector< amrex::Array< amrex::MultiFab *, 3 > > &a_x_mfarrvec) |
Protected Attributes | |
| bool | m_is_defined = false |
| bool | m_verbose = false |
| int | m_max_iter = 200 |
| RT | m_omega = RT(1.0) |
| bool | m_adaptive_omega = true |
| RT | m_atol = 1.0e-16 |
| RT | m_rtol = 1.0e-4 |
| Ops * | m_ops = nullptr |
| int | m_num_amr_levels = 0 |
| const amrex::Vector< amrex::Array< amrex::MultiFab *, 3 > > * | m_bcoefs = nullptr |
| bool | m_has_offdiag = false |
| bool | m_work_defined = false |
| amrex::Vector< amrex::Array< amrex::MultiFab, 3 > > | m_work |
| amrex::Vector< amrex::Array< amrex::MultiFab, 3 > > | m_x_ghost |
| int | m_stencil_width = 0 |
Protected Attributes inherited from Preconditioner< T, Ops > | |
| RT | m_time = 0.0 |
| RT | m_dt = 0.0 |
Point-Jacobi Preconditioner.
Approximately solves (I + M) x = b using damped Jacobi iterations, where M is the scaled mass matrix (plasma response dJ/dE).
When the mass matrix is purely diagonal (mass_matrices_pc_width=0), the solve is exact in one step: x = b / (1 + M_diag). When the mass matrix has off-diagonal stencil entries, damped Jacobi iterations are performed.
Adaptive omega (enabled by default): the relaxation parameter omega starts at 1.0 and is automatically reduced (by a factor of 0.9) when the Jacobi residual increases, indicating that the current omega is too large for the spectral properties of the mass matrix. The adapted omega is cached for subsequent Apply() calls. This handles marginally diagonally dominant or non-symmetric mass matrices. When the user explicitly sets pc_jacobi.omega, adaptive behavior is disabled (can be re-enabled with pc_jacobi.adaptive_omega = true).
Matrix Elements Layout: The mass matrix MultiFab stores stencil coefficients as components. For a field direction dim, the per-spatial-direction component counts are given by GetMassMatricesPCnComp(dim, d). The total number of components is the product over spatial dimensions. The diagonal component is at index (nComp-1)/2. The stencil offset for component c is decoded from the component index using the per-direction counts.
Note: WarpXSolverVec MultiFabs have zero ghost cells. This class allocates its own ghost-padded temporaries (m_x_ghost) for stencil neighbor access. All FillBoundary calls operate on these temporaries.
|
protected |
| using JacobiPC< T, Ops >::RT = typename T::value_type |
|
default |
|
delete |
|
deletenoexcept |
|
overridevirtual |
Solve (I + M) x = b via damped Jacobi iteration.
Implements Preconditioner< T, Ops >.
| auto JacobiPC< T, Ops >::computeResidualNorm | ( | const T & | a_x, |
| const T & | a_b ) const |
Compute ||b - (I+M)*x|| for residual monitoring. Uses the ghost-padded m_x_ghost (which must already be populated and boundary-filled) for stencil neighbor access. For diagonal-only mass matrices (ncomp=1), uses the fast diagonal formula from x directly.
|
protected |
|
overridevirtual |
Define the preconditioner.
Implements 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 |
|
overridevirtual |
Update the preconditioner.
Implements Preconditioner< T, Ops >.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |